Closed
Bug 814544
Opened 12 years ago
Closed 12 years ago
nsXULElement should support a 'disabled' property
Categories
(Core :: XUL, defect)
Core
XUL
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: markh, Assigned: markh)
Details
Attachments
(1 file)
2.33 KB,
patch
|
markh
:
review-
|
Details | Diff | Splinter Review |
nsXULElement has support for a number of boolean properties that simple set/remove an attribute of the same name. Currently this includes 'hidden', 'collapsed' and 'allowevents'. It would seem worthwhile to add 'disabled'.
My usecase is for use with command and key elements. Eg:
<key ... command="SomeCommand"/>
<command id="SomeCommand" hidden="true" disabled="true"/>
When code wants to toggle hidden, it can just say:
var elt = document.getElementById("SomeCommand")
elt.hidden = some_bool;
However, if it needs to update disabled too, it is forced to use setAttribute:
var elt = document.getElementById("SomeCommand")
elt.hidden = some_bool;
if (some_bool)
elt.setAttribute("disabled", "true")
else
elt.removeAttribute("disabled");
it would be much cleaner if the code could just do:
var elt = document.getElementById("SomeCommand")
elt.hidden = elt.disabled = some_bool;
Under the assumption I haven't missed anything obvious, I'm attaching a patch which implements this and works for the use-case I described above - but feel free to close as INVALID if there is a good reason I'm yet to be aware of!
Attachment #684548 -
Flags: review?(bzbarsky)
Comment 1•12 years ago
|
||
Does this conflict with e.g. the textbox binding, which has its own definition of the "disabled" property? Or that of the basecontrol binding that a bunch of other bindings inherit from?
I agree that this would be nice, but I'm not sure we can get away with it now from a compatibility POV. I'm also not sure that it has a well-defined meaning for all XUL elements the way "hidden" does, though I can't think of any examples offhand.
Comment 2•12 years ago
|
||
I don't think this should be done. It would imply that all elements can be disabled when most cannot.
Unfortunately there isn't a simple and reasonable fix for supporting this on command and key short of creating a different class/interface for them, but that isn't worth it just for this issue.
Assignee | ||
Comment 3•12 years ago
|
||
Fails on try with some obscure error with video controls, and given the other comments here, WONTFIX
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
Assignee | ||
Updated•12 years ago
|
Attachment #684548 -
Flags: review?(bzbarsky) → review-
You need to log in
before you can comment on or make changes to this bug.
Description
•