Skip to content
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

allow XML tag names #543

Merged
merged 2 commits into from
Mar 13, 2016
Merged

allow XML tag names #543

merged 2 commits into from
Mar 13, 2016

Conversation

alexlamsl
Copy link
Collaborator

Taking the XML specification and restrict it to within ASCII range, which seems reasonable enough a compromise until somebody wants their native language or emojis as tag names 🙈

@alexlamsl alexlamsl mentioned this pull request Mar 8, 2016
@kangax
Copy link
Owner

kangax commented Mar 9, 2016

Hm, do all browsers parse/tolerate it well?

@alexlamsl
Copy link
Collaborator Author

I've come across quite a few projects with these weird tag names - but yes, may be they all hit a brick wall at some point when they discover some browser breakage.

I will test against different browsers and report back.

@alexlamsl
Copy link
Collaborator Author

Both IE11 and Chrome (48 on Android) seems to be happy with this:

<html>
<body>
<a.b c="d"></a.b>
<script>
alert(document.getElementsByTagName('a.b')[0]);
</script>
</body>
</html>

in that they both give me a pop-up with [object HTMLUnknownElement].

@kangax
Copy link
Owner

kangax commented Mar 10, 2016

@mathias do you know of any problems with this? Safe to add?

@kangax
Copy link
Owner

kangax commented Mar 10, 2016

Whoops, I meant @mathiasbynens

@mathiasbynens
Copy link
Collaborator

This is an improvement but it’s still not fully accurate. The relevant production is NCName: https://www.w3.org/TR/1999/REC-xml-names-19990114/#NT-NCName E.g. elemænt is valid. There’s an npm package for that™: https://www.npmjs.com/package/ncname / https://github.com/sindresorhus/ncname

Custom element names (validator) have some further requirements (like - being required) but we probably shouldn’t bother with those at all.

@alexlamsl
Copy link
Collaborator Author

Didn't know modules with a bunch of RegExp's exist. 😮

I'll give this (or xml-char-classes) a go and see if I can implement this QName properly without performance regression.

@alexlamsl
Copy link
Collaborator Author

@mathiasbynens @kangax done - added browserified module for online version as well, with fallback when module isn't available.

kangax added a commit that referenced this pull request Mar 13, 2016
@kangax kangax merged commit ec74332 into kangax:gh-pages Mar 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants