[Bug 27228] New: Inconsistency in characters allowed in attribute names between setAttribute and HTML syntax specs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 27228] New: Inconsistency in characters allowed in attribute names between setAttribute and HTML syntax specs

Bugzilla from bugzilla@jessica.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: [hidden email]
          Reporter: [hidden email]
        QA Contact: [hidden email]
                CC: [hidden email], [hidden email]

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.

Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Bug 27228] Inconsistency in characters allowed in attribute names between setAttribute and HTML syntax specs

Bugzilla from bugzilla@jessica.w3.org
https://www.w3.org/Bugs/Public/show_bug.cgi?id=27228

Anne <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #8 from Anne <[hidden email]> ---
Joe, yeah, though it seems unlikely we'll be able to cut the tie between Attr
and Node. See https://github.com/whatwg/dom/issues/102 for details.

Closing this since nothing actionable came out of this and nobody seems keen on
running experiments. Sorry Igor.

--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...