-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fix 8166 html tag validation #8176
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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.
Thanks @pmario just some minor points
@Jermolene -- There is a problem with the SPEC - https://html.spec.whatwg.org/#prod-potentialcustomelementname allows the following unicode characters:
99% of them can be converted to a js regexp, but the last range For 0x10000 and up we would need a poyfill see: Which leads to a ES6 polyfill I think this would cause a significant performance problem, since we do test every HTML element for validity. I think we could implement it without the last range or leave it as it is in this PR. Unicode table with easy to find ranges |
@Jermolene -- I did a bit more investigations. The main info I found about custom web-components was that web-components need to have a hyphen in the name. Almost none of the docs except the spec itself mentioned the full regexp. So I thought about a validity check like this:
@Jermolene -- what do you think? |
This PR fixes #8166
It adds a new function to
$tw.utils.makeTagNameSafe(tag, defaultTag)
It replaces all the hardcoded checks using
if(complex logic)
with a simple to read function call