public void RecycleSelectorConstructorBuild() { var sc1 = Pool.NewSelectorConstructor(); sc1.Apply(CssKeywordToken.Ident("div")); Assert.AreNotEqual(SimpleSelector.All, sc1.ToPool()); var sc2 = Pool.NewSelectorConstructor(); Assert.AreEqual(SimpleSelector.All, sc2.ToPool()); Assert.ReferenceEquals(sc1, sc2); }
/// <summary> /// Called in a value - an identifier has been found. /// </summary> /// <param name="token">The current keyword token.</param> /// <returns>The status.</returns> Boolean InSingleValueIdent(CssKeywordToken token) { if (token.Data == "inherit") { property.Value = CSSValue.Inherit; SwitchTo(CssState.AfterValue); return(true); } return(AddValue(new CSSPrimitiveValue(CssUnit.Ident, token.Data))); }
public void RecycleSelectorConstructorBuild() { var divIdent = new CssKeywordToken(CssTokenType.Ident, "div", new TextPosition()); var sc1 = Pool.NewSelectorConstructor(); sc1.Apply(divIdent); Assert.AreNotEqual(SimpleSelector.All, sc1.ToPool()); var sc2 = Pool.NewSelectorConstructor(); Assert.AreEqual(SimpleSelector.All, sc2.ToPool()); Assert.AreSame(sc1, sc2); }
public void RecycleSelectorConstructorBuild() { var divIdent = new CssKeywordToken(CssTokenType.Ident, "div", new TextPosition()); var starIdent = new CssKeywordToken(CssTokenType.Delim, "*", new TextPosition()); var sc1 = Pool.NewSelectorConstructor(Factory.AttributeSelector, Factory.PseudoClassSelector, Factory.PseudoElementSelector); sc1.Apply(divIdent); Assert.AreNotEqual(SimpleSelector.All, sc1.ToPool()); var sc2 = Pool.NewSelectorConstructor(Factory.AttributeSelector, Factory.PseudoClassSelector, Factory.PseudoElementSelector); sc2.Apply(starIdent); Assert.AreEqual(SimpleSelector.All, sc2.ToPool()); Assert.AreSame(sc1, sc2); }