-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ref: comptime lookup for tagName #1544
base: master
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: de28f51 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -202,7 +202,7 @@ function getValidTagName(element: HTMLElement): string { | |||
if (element instanceof HTMLFormElement) { | |||
return 'FORM'; | |||
} | |||
return element.tagName.toUpperCase(); | |||
return element.tagName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe for XML the tagNames are not always uppercased. But maybe this is more correct in that case. Also I'm not sure in what cases we record XML (maybe for some older XHTML websites?).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe for XML the tagNames are not always uppercased.
Correct. The only thing I'm unsure of if if this change has any downstream effects. I dont know if we rely on this to be uppercase, but my knowledge here is pretty limited.
Could this be made with less boilerplate code if we populate HTML_TAGNAMES dynamically after first call for a given tag name? |
Indeed, that would make it more future proof at a small performance and correctness loss (#1544 (comment)). I think it could go both ways, but I'll defer to you for this since you are the active maintainers |
8bd74b7
to
f9028de
Compare
Attempt to bypass tagName regexp execution by performing a lookup for the most common static tagName values. Also skips a call to uppercase since tagName is already uppercase
Related to #1271