Closed
Bug 556805
Opened 14 years ago
Closed 14 years ago
When setting a boolean from the IDL attribute, the content attribute value should be the attribute name
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
INVALID
People
(Reporter: mounir, Assigned: Ms2ger)
References
()
Details
(Keywords: html5)
Attachments
(1 file, 1 obsolete file)
3.29 KB,
patch
|
bzbarsky
:
review+
sicking
:
superreview-
|
Details | Diff | Splinter Review |
In other words: When i set: element.foo = true; I should have: element.getAttribute('foo') == 'foo'; I will provide a patch as soon as possible (later today). This is really easy to fix.
Assignee | ||
Comment 1•14 years ago
|
||
Sorry for stealing your bug; I still had this patch lying around.
Assignee: nobody → Ms2ger
Attachment #436729 -
Flags: review?(bzbarsky)
Reporter | ||
Comment 2•14 years ago
|
||
No problem, that's fine :)
Comment 3•14 years ago
|
||
Comment on attachment 436729 [details] [diff] [review] Patch nsDependentAtomString, please.
Attachment #436729 -
Flags: review?(bzbarsky) → review-
Comment 4•14 years ago
|
||
Unless nsAttrValue will share a stringbuffer with the passed-in string?
Assignee | ||
Comment 5•14 years ago
|
||
Attachment #436729 -
Attachment is obsolete: true
Attachment #436741 -
Flags: review?(bzbarsky)
Comment 6•14 years ago
|
||
Comment on attachment 436741 [details] [diff] [review] Patch v2 r=me, but sicking should look too.
Attachment #436741 -
Flags: superreview?(jonas)
Attachment #436741 -
Flags: review?(bzbarsky)
Attachment #436741 -
Flags: review+
Ugh, why?! Does this match what IE does?
Reporter | ||
Comment 8•14 years ago
|
||
I don't know what IE does (I don't have a Windows system around to test) but that's what is in the specs in HTML5 specs at the moment and I do not think that is going to break compatibility as, AFAIK, a boolean attribute is considered true as long as it is present. To set it to false, it has to be removed. Webkit is doing it (at least, I checked for autofocus attribute) and Opera was doing it and it looks like it is now setting attribute to 'true'. I suppose this is a regression. Why don't you like that change ?
Well, for one it means that we'll serialize to a very ugly syntax. Currently a disabled input element gets serialized to <input disabled> With this patch we'd serialize to <input disabled="disabled"> Which is something you'd rarely see someone write by hand. I looked at what IE does, and unfortunately its .getAttribute implementation is a bit weird. In this case it returns "true". But If you serialize, using for example .innerHTML, you'll get the same short serialization as gecko. The other concern I have here is simply wasting memory and cycles. I really can't see a reason to stick the full string "disabled" into memory. I think we should argue for a spec change here given that in basically all cases people set boolean attributes to the empty string when using markup. So it'd be nice to be consistent when setting those same boolean attributes through the DOM. And given that browsers do different things here, compatibility doesn't seem to be a big argument one way or another.
Comment on attachment 436741 [details] [diff] [review] Patch v2 Minusing for now. Let me know if you'd like me to raise this with WhatWG or the HTML WG.
Attachment #436741 -
Flags: superreview?(jonas) → superreview-
Assignee | ||
Updated•14 years ago
|
Comment 11•14 years ago
|
||
I changed the spec.
Assignee | ||
Updated•14 years ago
|
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•