Reputation: 10287
Surprisingly can't find this on google...
Can the name of a custom element (a la the Web Components set of W3C specs) contain unicode?
This HTML 5 Custom element names? says that a custom element name must begin with an ASCII character, contain a hyphen, and ANY OTHER characters. Does that mean unicode?
Upvotes: 3
Views: 209
Reputation: 121000
TL;DR This great article explains what characters are permitted in javascript. Unfortunately, those won’t work as expected with elements. At least, at the moment.
The reason is that document.registerElement
which is being called on newly created custom elements, will fail:
var a = document.registerElement('a-ℵ');
//⇒ Uncaught SyntaxError: Failed to execute
// 'registerElement' on 'Document':
// Registration failed for type 'a-ℵ'.
// The type name is invalid.
That’s because registerElement
tries to create internal constructor, different from generic function HTMLElement()
/function HTMLUnknownElement()
for registered elements:
console.log(document.registerElement('a-b'));
//⇒ function a-b() { [native code] }
I would suggest the internals of browsers are not yet ready for:
//⇒ function a-ℵ() { [native code] }
though you might easily specify:
var ℵ = function() { console.log('IT WORKS') };
ℵ();
//⇒ IT WORKS
I understand this is not exactly an answer you expected, but I hope it sheds some light.
Upvotes: 1