Skip to content

Commit c6f0940

Browse files
committed
Made tagNameState faster (saves ~3% overall)
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401244
1 parent 3c5b658 commit c6f0940

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/html5lib/tokenizer.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,6 @@ def tagNameState(self):
489489
data = self.stream.char()
490490
if data in spaceCharacters:
491491
self.state = self.states["beforeAttributeName"]
492-
elif data in asciiLetters:
493-
self.currentToken["name"] += data +\
494-
self.stream.charsUntil(asciiLetters, True)
495492
elif data == u">":
496493
self.emitCurrentToken()
497494
elif data is EOF:
@@ -503,6 +500,8 @@ def tagNameState(self):
503500
self.state = self.states["beforeAttributeName"]
504501
else:
505502
self.currentToken["name"] += data
503+
# (Don't use charsUntil here, because tag names are
504+
# very short and it's faster to not do anything fancy)
506505
return True
507506

508507
def beforeAttributeNameState(self):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy