/// <summary>Gets all child elements with the given tag.</summary> /// <param name="selector">The selector string to match.</param> /// <returns>The set of all tags with this tag.</returns> public HTMLCollection querySelectorAll(string selector, bool one) { // Create results set: HTMLCollection results = new HTMLCollection(); if (string.IsNullOrEmpty(selector)) { // Empty set: return(results); } // Create the lexer: Css.CssLexer lexer = new Css.CssLexer(selector, this); // Read a value: Css.Value value = lexer.ReadValue(); // Read the selectors from the value: List <Selector> selectors = new List <Selector>(); Css.CssLexer.ReadSelectors(null, value, selectors); // Create a blank event to store the targets, if any: CssEvent e = new CssEvent(); // Perform the selection process: querySelectorAll(selectors.ToArray(), results, e, false); return(results); }
/// <summary>Gets all child elements with the given tag.</summary> /// <param name="selectors">The selectors to match.</param> /// <returns>The set of all tags with this tag.</returns> public void querySelectorAll(Selector[] selectors, INodeList results, CssEvent e, bool one) { if (childNodes_ == null) { return; } for (int i = 0; i < childNodes_.length; i++) { Node node = childNodes_[i]; Element child = node as Element; IRenderableNode irn = (child as IRenderableNode); if (child == null || irn == null) { continue; } ComputedStyle cs = irn.ComputedStyle; for (int s = 0; s < selectors.Length; s++) { // Match? if (selectors[s].StructureMatch(cs, e)) { // Yep! results.push(node); if (one) { return; } } } irn.querySelectorAll(selectors, results, e, one); if (one && results.length == 1) { return; } } }
/// <summary>Gets all child elements with the given tag.</summary> /// <param name="selectors">The selectors to match.</param> /// <returns>The set of all tags with this tag.</returns> public void querySelectorAll(Selector[] selectors, INodeList results, CssEvent e, bool one) { }