Skip to content

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

3 participants