Closed
Bug 220898
Opened 21 years ago
Closed 6 years ago
__defineSetter__ removes the value attribute from an INPUT tag
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: gerbert, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030827 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030827 When attaching a function to the value property of an input tag by using __defineSetter__ . The property itself is removed from the object: oInput.value == 'undefined' However the value can still be accessed through oInput.getAttribute('value') When I set the value (oInput.value = 'something') the setter is NOT called. Running code example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> </head> <script type="text/javascript"> function Add_Setter(oObj,sProp) { oObj.__defineSetter__(sProp, function (sVal) { alert(this + ": " + sProp + " = " + sVal); }); } function GO() { var oObj = document.getElementById("zebra"); Add_Setter(oObj, "value"); oObj.setAttribute("value", "notw00t"); alert(oObj.getAttribute("value")); // Returns 'notw00t' alert(oObj.value); // Returns undefined } </script> <body onload="GO();"> <form> <input type="text" name="zebra" id="zebra" value="w00t" /><br /> </form> </body> </html> Reproducible: Always Steps to Reproduce: 1. See code example 2. 3. Actual Results: the value property is gone.. the setter is not called Expected Results: Not remove the value property! :) Call the setter
Reporter | ||
Comment 1•21 years ago
|
||
Hmm.. Neil on Moznet helped me by adding oObj.__defineGetter__("value", oObj.__lookupGetter__("value")); this seems to eliminate the undefind problem. I still find his wierd though. Having to set the getter when I only want the setter. :) Anyway.. typing in the input field still does not trigger my Func. :(
Comment 2•21 years ago
|
||
This is an xpconnect/dom issue with the way the DOM objects are bound to JS...
Assignee: rogerl → BradleyJunk
Status: UNCONFIRMED → NEW
Component: JavaScript Engine → XPConnect
Ever confirmed: true
Updated•18 years ago
|
Assignee: dbradley → nobody
Updated•18 years ago
|
QA Contact: pschwartau → xpconnect
Comment 3•6 years ago
|
||
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
Comment 4•6 years ago
|
||
Invalid; that's just how accessor properties work in ES.
Resolution: INACTIVE → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•