/// <summary>True if this element matches the given selector.</summary> public bool matches(string selectorText) { // Create the lexer: Css.CssLexer lexer = new Css.CssLexer(selectorText, this); // Read a value: Css.Value value = lexer.ReadValue(); // Read the selectors from the value: List <Css.Selector> selectors = new List <Css.Selector>(); Css.CssLexer.ReadSelectors(null, value, selectors); if (selectors.Count == 0) { return(false); } // Get renderable node: Css.IRenderableNode irn = (this as Css.IRenderableNode); if (irn == null) { // Can't select this element. return(false); } // Get the computed style: Css.ComputedStyle cs = irn.ComputedStyle; // Try and match it! return(selectors[0].StructureMatch(cs, new Css.CssEvent())); }
/// <summary>Gets the target computed style.</summary> public Css.ComputedStyle getComputedStyle() { Css.IRenderableNode irn = target as Css.IRenderableNode; return(irn.ComputedStyle); }