This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24178 - [Custom]: No way to differentiate attribute namespaces in attributeChanged callback
Summary: [Custom]: No way to differentiate attribute namespaces in attributeChanged ca...
Status: RESOLVED MOVED
Alias: None
Product: WebAppsWG
Classification: Unclassified
Component: HISTORICAL - Component Model (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Dominic Cooney
QA Contact: public-webapps-bugzilla
URL: http://www.w3.org/TR/custom-elements/...
Whiteboard:
Keywords:
Depends on:
Blocks: 14968
  Show dependency treegraph
 
Reported: 2013-12-29 23:57 UTC by Philip Rogers
Modified: 2015-07-06 08:05 UTC (History)
7 users (show)

See Also:


Attachments

Description Philip Rogers 2013-12-29 23:57:40 UTC
Some valid html attributes have namespaces:
http://www.w3.org/html/wg/drafts/html/master/single-page.html#attributes-0

Because the attributeChanged callback does not specify the attribute's namespace, it's not possible to differentiate the following:
xuse.setAttributeNS('http://www.w3.org/1999/xlink', 'href', 'foo')
or
xuse.setAttribute('xlink:href', 'foo')
and
xuse.setAttribute('href', 'foo')

One way to fix this may be to just add an optional 4th argument to the attributeChanged callback for the namespace if it is not html.
Comment 1 Cameron McCormack 2013-12-30 01:38:06 UTC
(In reply to Philip Rogers from comment #0)
> One way to fix this may be to just add an optional 4th argument to the
> attributeChanged callback for the namespace if it is not html.

If it's not null; xuse.setAttribute("href", "foo") sets the "href" attribute in the null namespace.
Comment 2 Tab Atkins Jr. 2014-01-03 19:38:21 UTC
Note that SVG is dropping all of its extra namespaces in SVG2, so we can likely just ignore this.
Comment 3 Dimitri Glazkov 2014-01-17 00:17:28 UTC
(In reply to Tab Atkins Jr. from comment #2)
> Note that SVG is dropping all of its extra namespaces in SVG2, so we can
> likely just ignore this.

I would <3 that. Philip?
Comment 4 Philip Rogers 2014-01-17 00:24:41 UTC
(In reply to Dimitri Glazkov from comment #3)
> (In reply to Tab Atkins Jr. from comment #2)
> > Note that SVG is dropping all of its extra namespaces in SVG2, so we can
> > likely just ignore this.
> 
> I would <3 that. Philip?

I would <3 that too. I've suggested this to the SVG2 WG at http://lists.w3.org/Archives/Public/www-svg/2014Jan/0018.html
Comment 5 Anne 2014-02-10 11:30:01 UTC
Should this callback not be aligned with mutation observers? We decided to allow for namespaces explicitly there.
Comment 6 Dimitri Glazkov 2014-02-10 17:40:57 UTC
(In reply to Anne from comment #5)
> Should this callback not be aligned with mutation observers? We decided to
> allow for namespaces explicitly there.

I guess this depends on whether we want to keep truly namespaced attributes in HTML, or deprecate them.
Comment 7 Anne 2014-02-10 19:31:58 UTC
Well, unless we are removing setAttributeNS(), we'll have to deal somehow. But I guess I could see us not supporting that for custom elements.
Comment 8 Dimitri Glazkov 2014-05-08 21:48:01 UTC
(In reply to Anne from comment #7)
> Well, unless we are removing setAttributeNS(), we'll have to deal somehow.
> But I guess I could see us not supporting that for custom elements.

Here's one idea: https://github.com/dglazkov/webcomponents/pull/2

WDYT?
Comment 9 Anne 2014-05-12 09:22:41 UTC
It's close, but you actually want to queue for attribute's local name and namespace, not it's name and namespace. That would align with what we do for mutation observers and is the actual data you need to deal with namespaced attributes properly.
Comment 10 Dimitri Glazkov 2014-05-12 18:26:00 UTC
(In reply to Anne from comment #9)
> It's close, but you actually want to queue for attribute's local name and
> namespace, not it's name and namespace. That would align with what we do for
> mutation observers and is the actual data you need to deal with namespaced
> attributes properly.

https://github.com/w3c/webcomponents/pull/13 ?
Comment 11 Anne 2015-01-05 10:59:28 UTC
Seems this was fixed, no?
Comment 12 Hayato Ito 2015-07-06 08:05:11 UTC
Moved to https://github.com/w3c/webcomponents/issues/168