Exemplo n.º 1
0
        /// <summary>
        /// Create a new CQ object from a single element. Unlike the constructor method <see cref="CsQuery.CQ"/>
        /// this new objet is not bound to any context from the element.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to wrap
        /// </param>
        ///
        /// <returns>
        /// A new CQ object
        /// </returns>

        public static CQ Create(IDomObject element)
        {
            CQ csq = new CQ();

            csq.CreateNewFragment(Objects.Enumerate(element));
            return(csq);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create a new CQ object from a single element. Unlike the constructor method <see cref="CsQuery.CQ"/>
        /// this new objet is not bound to any context from the element.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to wrap
        /// </param>
        ///
        /// <returns>
        /// A new CQ object
        /// </returns>

        public static CQ Create(IDomObject element)
        {
            CQ csq = new CQ();

            if (element is IDomDocument)
            {
                csq.Document = (IDomDocument)element;
                csq.AddSelection(csq.Document.ChildNodes);
            }
            else
            {
                csq.CreateNewFragment(Objects.Enumerate(element));
            }
            return(csq);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Insert every element in the set of matched elements to the end of the target.
        /// </summary>
        ///
        /// <param name="target">
        /// The element to which the elements in the current selection set should be appended.
        /// </param>
        ///
        /// <returns>
        /// A new CQ object containing the target elements.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/appendTo/
        /// </url>

        public CQ AppendTo(IDomObject target)
        {
            return(AppendTo(Objects.Enumerate(target)));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Reduce the set of matched elements to those that have the element passed as a descendant.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to match.
        /// </param>
        ///
        /// <returns>
        /// A new CQ object.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/has/
        /// </url>

        public CQ Has(IDomObject element)
        {
            return(Has(Objects.Enumerate(element)));
        }
Exemplo n.º 5
0
        /// <summary>
        /// Reduce the set of matched elements to those that matching the element passed by parameter.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to match.
        /// </param>
        ///
        /// <returns>
        /// A new CQ object.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/filter/
        /// </url>

        public CQ Filter(IDomObject element)
        {
            return(Filter(Objects.Enumerate(element)));
        }
Exemplo n.º 6
0
        /// <summary>
        /// Sets the selection set for this object to a single element..
        /// </summary>
        ///
        /// <param name="element">
        /// The element to add.
        /// </param>
        /// <param name="outputOrder">
        /// The default output order. If omitted, Ascending (DOM) order is the default.
        /// </param>
        ///
        /// <returns>
        /// The current CQ object
        /// </returns>

        protected CQ SetSelection(IDomObject element,
                                  SelectionSetOrder outputOrder = SelectionSetOrder.Ascending)
        {
            SelectionSet = new SelectionSet <IDomObject>(Objects.Enumerate(element), outputOrder, outputOrder);
            return(this);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Replace each element in the set of matched elements with the element passed by parameter.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to replace the content with.
        /// </param>
        ///
        /// <returns>
        /// The current CQ object.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/replaceWith/
        /// </url>

        public CQ ReplaceWith(IDomObject element)
        {
            return(ReplaceWith(Objects.Enumerate(element)));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Insert the element, specified by the parameter, before each element in the set of matched
        /// elements.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to insert.
        /// </param>
        ///
        /// <returns>
        /// The current CQ object.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/before/
        /// </url>

        public CQ Before(IDomObject element)
        {
            return(Before(Objects.Enumerate(element)));
        }
Exemplo n.º 9
0
        /// <summary>
        /// Insert content, specified by the parameter, to the beginning of each element in the set of
        /// matched elements.
        /// </summary>
        ///
        /// <param name="elements">
        /// One or more elements.
        /// </param>
        ///
        /// <returns>
        /// A new CQ object representing the inserte content.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/prepend/
        /// </url>

        public CQ Prepend(params IDomObject[] elements)
        {
            return(Prepend(Objects.Enumerate(elements)));
        }
Exemplo n.º 10
0
        /// <summary>
        /// Insert the element, specified by the parameter, to the end of each element in the set of
        /// matched elements.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to exclude.
        /// </param>
        ///
        /// <returns>
        /// The current CQ object.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/append/
        /// </url>

        public CQ Append(IDomObject element)
        {
            return(Append(Objects.Enumerate(element)));
        }
Exemplo n.º 11
0
        /// <summary>
        /// Return the element passed by parameter, if it is an ancestor of any elements in the selection
        /// set.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to target.
        /// </param>
        ///
        /// <returns>
        /// A new CQ object.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/closest/#closest1
        /// </url>

        public CQ Closest(IDomObject element)
        {
            return(Closest(Objects.Enumerate(element)));
        }
Exemplo n.º 12
0
        /// <summary>
        /// Selects all elements except the element passed as a parameter.
        /// </summary>
        ///
        /// <param name="element">
        /// The element to exclude.
        /// </param>
        ///
        /// <returns>
        /// A new CQ object.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/not/
        /// </url>

        public CQ Not(IDomObject element)
        {
            return(Not(Objects.Enumerate(element)));
        }
Exemplo n.º 13
0
 /// <summary>
 /// Get the ancestors of each element in the current set of matched elements, up to but not
 /// including the element matched by the selector.
 /// </summary>
 ///
 /// <param name="element">
 /// The element.
 /// </param>
 /// <param name="filter">
 /// (optional) a selector which limits the elements returned.
 /// </param>
 ///
 /// <returns>
 /// A new CQ object.
 /// </returns>
 ///
 /// <url>
 /// http://api.jquery.com/parentsUntil/
 /// </url>
 ///
 public CQ ParentsUntil(IDomElement element, string filter = null)
 {
     return(ParentsUntil(Objects.Enumerate(element), filter));
 }
Exemplo n.º 14
0
        /// <summary>
        /// Wrap an HTML structure around each element in the set of matched elements.
        /// </summary>
        ///
        /// <param name="element">
        /// An element which is the structure to wrap around the selection set.
        /// </param>
        ///
        /// <returns>
        /// The current CQ object.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/wrap/
        /// </url>

        public CQ Wrap(IDomObject element)
        {
            return(Wrap(Objects.Enumerate(element)));
        }
Exemplo n.º 15
0
        /// <summary>
        /// Wrap an HTML structure around the content of each element in the set of matched elements.
        /// </summary>
        ///
        /// <param name="wrapper">
        /// A sequence of elements that is the structure to wrap around the content of the selection set.
        /// There may be multiple elements but there should be only one innermost element in the sequence.
        /// </param>
        ///
        /// <returns>
        /// The current CQ object.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/wrapinner/
        /// </url>

        public CQ WrapInner(IDomObject wrapper)
        {
            return(WrapInner(Objects.Enumerate(wrapper)));
        }
Exemplo n.º 16
0
        /// <summary>
        /// Replace the target element with the set of matched elements.
        /// </summary>
        ///
        /// <param name="target">
        /// An element.
        /// </param>
        ///
        /// <returns>
        /// The current CQ object.
        /// </returns>
        ///
        /// <url>
        /// http://api.jquery.com/replaceAll/
        /// </url>

        public CQ ReplaceAll(IDomObject target)
        {
            return(ReplaceAll(Objects.Enumerate(target)));
        }