public HtmlTag GetTag() { if (hash >= 0) { return((HtmlTag)hash); } hash = (int)HtmlTagHash.GetTag(Source, Name.Name.StartIndex, Name.Name.Length); return((HtmlTag)hash); }
private bool ParseScriptOrStyle(TokenType tokenType) { int startIndex = index; var tagType = lastTag.GetTag(); var tagNameLength = lastTag.Name.Name.Length; GoToSequence("</"); if (HtmlTagHash.GetTag(content, index + 2, tagNameLength) == tagType) { stateAction = ParseCloseLastTag; return(FireValueToken(tokenType, startIndex)); } else { index += "</".Length; return(false); } }
private void ParseScript() { int startIndex = index; while (!IsEof()) { GoToSequence("</"); if (HtmlTagHash.GetTag(content, index + 2, "script".Length) == HtmlTag.Script) { FireValueToken(TokenType.Script, startIndex); FireToken(TokenType.CloseTag, new QualifiedName(index + 2, "script".Length)); index += "</script>".Length; isScript = false; break; } index += "</".Length; } }
public void GetTokenHash_Should_Work_With_Actual_ArraySegment() { var actual = HtmlTagHash.GetTag("prefix title suffix".ToArray(), 7, 5); Assert.AreEqual(HtmlTag.Title, actual); }
public void GetTokenHash_Should_Resolve_Hash_For_UppercaseTags() { HtmlTestExtentions.TestHash(tagList, x => (int)HtmlTagHash.GetTag(x.ToUpper().ToArray(), 0, x.Length)); }