public HtmlAttributeManager(HtmlParser.HtmlAttributeContext context) : base( () => { return(context.htmlAttributeValue().ATTVALUE_VALUE().Symbol.Text); }, (value) => { var contextValue = context.htmlAttributeValue(); var newToken = new CommonToken(HtmlParser.ATTVALUE_VALUE, value); contextValue.Replace(contextValue.ATTVALUE_VALUE(), newToken); }) { }
public override object VisitHtmlAttribute([NotNull] HtmlParser.HtmlAttributeContext context) { var contextName = context.htmlAttributeName(); var name = contextName.GetText(); bool isId = string.Equals(attrId, name, StringComparison.OrdinalIgnoreCase); bool isClass = string.Equals(attrClass, name, StringComparison.OrdinalIgnoreCase); if (isId || isClass) { var contextValue = context.htmlAttributeValue(); var token = contextValue.ATTVALUE_VALUE(); int index = token.Symbol.TokenIndex; IToken newToken = editString.GetChangedToken(tokens[index]); tokens[index] = newToken; } return(base.VisitHtmlAttribute(context)); }