github.com/godaddy-x/freego@v1.0.156/goquery/doc.go (about)

     1  // Copyright (c) 2012-2016, Martin Angers & Contributors
     2  // All rights reserved.
     3  //
     4  // Redistribution and use in source and binary forms, with or without modification,
     5  // are permitted provided that the following conditions are met:
     6  //
     7  // * Redistributions of source code must retain the above copyright notice,
     8  // this list of conditions and the following disclaimer.
     9  // * Redistributions in binary form must reproduce the above copyright notice,
    10  // this list of conditions and the following disclaimer in the documentation and/or
    11  // other materials provided with the distribution.
    12  // * Neither the name of the author nor the names of its contributors may be used to
    13  // endorse or promote products derived from this software without specific prior written permission.
    14  //
    15  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
    16  // OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    17  // AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
    18  // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    19  // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    20  // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    21  // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
    22  // WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    23  
    24  /*
    25  Package goquery implements features similar to jQuery, including the chainable
    26  syntax, to manipulate and query an HTML document.
    27  
    28  It brings a syntax and a set of features similar to jQuery to the Go language.
    29  It is based on Go's net/html package and the CSS Selector library cascadia.
    30  Since the net/html parser returns nodes, and not a full-featured DOM
    31  tree, jQuery's stateful manipulation functions (like height(), css(), detach())
    32  have been left off.
    33  
    34  Also, because the net/html parser requires UTF-8 encoding, so does goquery: it is
    35  the caller's responsibility to ensure that the source document provides UTF-8 encoded HTML.
    36  See the repository's wiki for various options on how to do this.
    37  
    38  Syntax-wise, it is as close as possible to jQuery, with the same method names when
    39  possible, and that warm and fuzzy chainable interface. jQuery being the
    40  ultra-popular library that it is, writing a similar HTML-manipulating
    41  library was better to follow its API than to start anew (in the same spirit as
    42  Go's fmt package), even though some of its methods are less than intuitive (looking
    43  at you, index()...).
    44  
    45  It is hosted on GitHub, along with additional documentation in the README.md
    46  file: https://github.com/puerkitobio/goquery
    47  
    48  Please note that because of the net/html dependency, goquery requires Go1.1+.
    49  
    50  The various methods are split into files based on the category of behavior.
    51  The three dots (...) indicate that various "overloads" are available.
    52  
    53  * array.go : array-like positional manipulation of the selection.
    54      - Eq()
    55      - First()
    56      - Get()
    57      - Index...()
    58      - Last()
    59      - Slice()
    60  
    61  * expand.go : methods that expand or augment the selection's set.
    62      - Add...()
    63      - AndSelf()
    64      - Union(), which is an alias for AddSelection()
    65  
    66  * filter.go : filtering methods, that reduce the selection's set.
    67      - End()
    68      - Filter...()
    69      - Has...()
    70      - Intersection(), which is an alias of FilterSelection()
    71      - Not...()
    72  
    73  * iteration.go : methods to loop over the selection's nodes.
    74      - Each()
    75      - EachWithBreak()
    76      - Map()
    77  
    78  * manipulation.go : methods for modifying the document
    79      - After...()
    80      - Append...()
    81      - Before...()
    82      - Clone()
    83      - Empty()
    84      - Prepend...()
    85      - Remove...()
    86      - ReplaceWith...()
    87      - Unwrap()
    88      - Wrap...()
    89      - WrapAll...()
    90      - WrapInner...()
    91  
    92  * property.go : methods that inspect and get the node's properties values.
    93      - Attr*(), RemoveAttr(), SetAttr()
    94      - AddClass(), HasClass(), RemoveClass(), ToggleClass()
    95      - Html()
    96      - Length()
    97      - Size(), which is an alias for Length()
    98      - Text()
    99  
   100  * query.go : methods that query, or reflect, a node's identity.
   101      - Contains()
   102      - Is...()
   103  
   104  * traversal.go : methods to traverse the HTML document tree.
   105      - Children...()
   106      - Contents()
   107      - Find...()
   108      - Next...()
   109      - Parent[s]...()
   110      - Prev...()
   111      - Siblings...()
   112  
   113  * type.go : definition of the types exposed by goquery.
   114      - Document
   115      - Selection
   116      - Matcher
   117  
   118  * utilities.go : definition of helper functions (and not methods on a *Selection)
   119  that are not part of jQuery, but are useful to goquery.
   120      - NodeName
   121      - OuterHtml
   122  */
   123  package goquery