CSSSelector
From Virtual World Web Wiki
Manages a CSS Selector that can be used to search for matching nodes in a DOM tree, or to test a single node for a match.
Remarks [edit]
Properties
- CSSSelector Child {get; set;}
- When a selector string has multiple parts separated by a space (decendant selector) or a > symbol (direct descendant, or child selector) they are parsed into separate CSSSelector instances linked through this and the Parent property.
- bool DirectParent {get; set;}
- True if this selector's Parent selector must match the tested node's direct parent (true) or any parent (false)
- CSSSelector Parent {get; set;}
- When a selector string has multiple parts separated by a space (decendant selector) or a > symbol (direct descendant, or child selector) they are parsed into separate CSSSelector instances linked through this and the Child property.
Methods
- bool IsMatch(DOMObject obj)
- Tests a single object for a match (no recursion)
- CSSSelector Parse(string text)
- Parses a CSS-Like selector string and constructs a new CSSSeelctor instance representing it. Parsing is the expensive operation. The returned instance can then be used very efficiently, many times, to do tests and tree searches.
- DOMObject SelectFirst(DOMObject root)
- Returns the first matching object from the specified DOM tree
- IEnumerable<DOMObject> SelectFrom(DOMObject root)
- Returns an enumerable of matching objects from the specified DOM tree