[webcomponents] [Custom]: No way to differentiate attribute namespaces in attributeChanged callback (bugzilla: 24178) (#168)

Title: [Custom]: No way to differentiate attribute namespaces in attributeChanged callback (bugzilla: 24178)

Migrated from: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178

----
comment: 0
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178#c0
*Philip Rogers* wrote on 2013-12-29 23:57:40 +0000.

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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178#c1
*Cameron McCormack* wrote on 2013-12-30 01:38:06 +0000.

(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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178#c2
*Tab Atkins Jr.* wrote on 2014-01-03 19:38:21 +0000.

Note that SVG is dropping all of its extra namespaces in SVG2, so we can likely just ignore this.

----

comment: 3
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178#c3
*Dimitri Glazkov* wrote on 2014-01-17 00:17:28 +0000.

(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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178#c4
*Philip Rogers* wrote on 2014-01-17 00:24:41 +0000.

(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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178#c5
*Anne* wrote on 2014-02-10 11:30:01 +0000.

Should this callback not be aligned with mutation observers? We decided to allow for namespaces explicitly there.

----

comment: 6
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178#c6
*Dimitri Glazkov* wrote on 2014-02-10 17:40:57 +0000.

(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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178#c7
*Anne* wrote on 2014-02-10 19:31:58 +0000.

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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178#c8
*Dimitri Glazkov* wrote on 2014-05-08 21:48:01 +0000.

(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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178#c9
*Anne* wrote on 2014-05-12 09:22:41 +0000.

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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178#c10
*Dimitri Glazkov* wrote on 2014-05-12 18:26:00 +0000.

(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
comment_url: https://www.w3.org/Bugs/Public/show_bug.cgi?id=24178#c11
*Anne* wrote on 2015-01-05 10:59:28 +0000.

Seems this was fixed, no?

---
Reply to this email directly or view it on GitHub:
https://github.com/w3c/webcomponents/issues/168

Received on Monday, 6 July 2015 07:37:35 UTC