- From: <bugzilla@jessica.w3.org>
- Date: Mon, 03 Nov 2014 23:52:23 +0000
- To: www-dom@w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=27228 Bug ID: 27228 Summary: Inconsistency in characters allowed in attribute names between setAttribute and HTML syntax specs Product: WebAppsWG Version: unspecified Hardware: PC OS: All Status: NEW Severity: normal Priority: P2 Component: DOM Assignee: annevk@annevk.nl Reporter: igor@angularjs.org QA Contact: public-webapps-bugzilla@w3.org CC: mike@w3.org, www-dom@w3.org According to http://www.w3.org/TR/html5/syntax.html#attributes-0 and http://www.w3.org/TR/html5/syntax.html#attribute-name-state non-ascii characters like "[", "]", "(", ")" and "?" are valid characters for attribute names. However, according to https://dom.spec.whatwg.org/#dom-element-setattribute setAttribute allows only attribute names that contain ascii characters. This means that while <div [foo]="bar"> is properly parsed by all browsers that I tried (Chrome, FF, Safari, IE), trying to set attributes via DOM apis throws an exception in all of these browsers. There is a workaround for this (http://jsperf.com/specialsetattribute) that comes with a performance hit. It would be great to have the setAttribute spec match the html syntax spec, so that we don't need to be working around the more restrictive DOM spec and taking a perf hit. The real-world usecase for this usage is DOM-based templating systems like those used by Angular and Polymer. Polymer already uses <my-component hidden?="{{exp}}"></> (note the "?" after hidden), and Angular is considering using <my-component [hidden]="exp"></> syntax for our next generation templating. The use of attribute name and "odd" characters is exactly what we need to build a templating language on top of HTML and DOM that will work well with Web Components. -- You are receiving this mail because: You are on the CC list for the bug.
Received on Monday, 3 November 2014 23:52:24 UTC