Exemplo n.º 1
0
 public HtmlTag GetTag()
 {
     if (hash >= 0)
     {
         return((HtmlTag)hash);
     }
     hash = (int)HtmlTagHash.GetTag(Source, Name.Name.StartIndex, Name.Name.Length);
     return((HtmlTag)hash);
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
        public void GetTokenHash_Should_Work_With_Actual_ArraySegment()
        {
            var actual = HtmlTagHash.GetTag("prefix title suffix".ToArray(), 7, 5);

            Assert.AreEqual(HtmlTag.Title, actual);
        }
Exemplo n.º 5
0
 public void GetTokenHash_Should_Resolve_Hash_For_UppercaseTags()
 {
     HtmlTestExtentions.TestHash(tagList, x => (int)HtmlTagHash.GetTag(x.ToUpper().ToArray(), 0, x.Length));
 }