4 ms·
I'm not sure you are correct. According to the w3 spec for HTML attributes [0], html element attribute names must consist of one or more characters other than t
by pfooti 11y ago
I'm not sure you are correct. According to the w3 spec for HTML attributes [0], html element attribute names must consist of one or more characters other than the space characters, U+0000 NULL, """, "'", ">", "/", "=", the control characters, and any characters that are not defined by Unicode.
Granted, it isn't necessarily what I'd expect to be legal, but it doesn't look illegal either. We may just need to add some logic to HTML colorizing syntax checkers in our IDEs is all.
[0]: http://www.w3.org/TR/html-markup/syntax.html#syntax-attributes http://www.w3.org/TR/html-markup/syntax.html#syntax-attribut...
- jrochkind1 11y agointeresting!
- joshuacc 11y agoTo emphasize what you are saying, on multiple occasions the Angular team has said that they chose this new syntax because it is valid.
- Touche 11y agoIt's illegal. Go to your console and type el.setAttribute("(foo)", "bar") and see what happens.
- joshuacc 11y agoNo it is not. See the discussion here: https://github.com/angular/angular/issues/133 https://github.com/angular/angular/issues/133
- Touche 11y agoWhat there contradicts what I said? I'm aware of innerHTML hacks that make it possible to work around but those are not valid attribute names. I'm not even against the syntax; i like it, but that doesn't change the fact that it is invalid html.
- sangnoir 11y agoParent quotes the W3 Spec to prove that it's legal, and your response is "it's illegal because $BROWSER say's so"? I trust the spec more than an implementation.
- Touche 11y agoThe parent didn't quote the spec, they quoted a GitHub issue with 71 participants. If you want to post a link to the spec text please do. If true I'm not sure it matters if every browser throws an exception.
- joshuacc 11y agoUser pfooti's comment referenced the specification[1]. You said that a browsers' implementation of the DOM API proves that it is illegal. I then linked to an issue with a detailed discussion of how the DOM API isn't consistent with itself, much less the HTML specification. [1]:http://www.w3.org/TR/html-markup/syntax.html#syntax-attributes http://www.w3.org/TR/html-markup/syntax.html#syntax-attribut...