WQuery

What is a WQuery?

WQuery enables parsing and then editing a HTML code with the assistance of a fluent interface just like in the case of a jQuery library. WQuery is a part of a Wojdav Bootstrap Mvc package. The parsing of the HTML code is based on a WHtmlParser library.

For now, a WHtmlParser contains some limitations when it comes to ability to parse the HTML code. The limitations directly influence the ability of parsing the code by the WQuery library. Before you start using WQuery, please look at the limitations at this address.

Usage

A WQuery object is created by using a static method.

                        
                            var html = WQ.Create("<div></div><p></p>");
                            html.Attr("class", "myClass");
                            html.Html(WQ.CreateTag("p").Attr("id", "myID"));
                            Console.WriteLine(html.ToHtml());
                        
                    
Creating a WQuery object.

A generated HTML code.

                        
                            <div class="myClass">
                                <p id="myID"></p>
                            </div>
                            <p class="myClass"></p>
                        
                    
A generated HTML code.

Methods

A current method list of a WQuery object. Most of them will be well-known to users of a jQuery library.

Text
Html
ForEachDeepNodes
ForEachDeep
Attr
AttrBoolean
AttrOrDefault
RemoveAttr
HasAttr
AttrOrRemove
Data
DataBoolean
DataOrDefault
RemoveData
HasData
DataOrRemove
Class
RemoveClass
HasClass
ClassOrRemove
Style
StyleOrDefault
RemoveStyle
Append
AppendText
Prepend
PrependText
After
Before
ReplaceWith
WrapAll
Unwrap
Find
Select
SelectAll
ToHtml
Elements
Nodes
Count
CountNodes
Item
RestoreConverter
ForEach
ForEachNodes
Clone
CloneNodes
EnumConverter
The list of WQuery methods and properties.

PS. In the future, the list will be replaced by a solid documentation.