W3C home > Mailing lists > Public > public-html-bugzilla@w3.org > June 2011

[Bug 12945] "On setting, if the given element has an id attribute, then the content attribute must be set to the value of that id attribute. Otherwise, the IDL attribute must be set to the empty string." is strange and breaks reflection. If the given element isn't in

From: <bugzilla@jessica.w3.org>
Date: Thu, 23 Jun 2011 12:36:41 +0000
To: public-html-bugzilla@w3.org
Message-Id: <E1QZj9F-00062z-7I@jessica.w3.org>

--- Comment #2 from Mounir Lamouri <mounir.lamouri@gmail.com> 2011-06-23 12:36:40 UTC ---
HTMLElement reflection is actually not consistent.
In one hand, we have input.list that is readonly and the specs say we should
set the id of the element in the content attribute then read the IDL attribute
which returns the datalist element (if any).
In the other hand, we have element.contextMenu that takes an element and keeps
it's id and return the given menu element (if any).

I think the second solution is bad because:
1. If you do:
element.contextMenu = foo;
element.contextMenu == foo;
This might be false if bar element if foo and bar share the same id and bar is
before foo in the document.
2. If you do:
element.contextMenu = foo;
Then read element.getAttribute('contextmenu'); the value you are going to read
will not be foo at all. AFAIK, that's not common in attribute reflection.

I think the distinction between the content attribute and the IDL attribute
with input.list is clever and makes thing clear. It might be annoying to change
the value from a script but prevent this auto-magic craziness that happens with
.centextMenu. In addition, it's consistent with other elements like the label

Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
Received on Thursday, 23 June 2011 12:36:47 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 20:01:53 UTC