WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED CONFIGURATION CHANGED
50125
can't define value getter on input element
https://bugs.webkit.org/show_bug.cgi?id=50125
Summary
can't define value getter on input element
Andreas Madsen
Reported
2010-11-27 09:37:41 PST
Created
attachment 74962
[details]
testcase I all browser, except Safari Webkit, i am able to manipulate the input.value with __defineGetter__. There is no error, the function there is set in defineGetter will just never run. Test case: _______________________________________ <input type="text" value="2" id="input"> <script type="text/javascript"> var input = document.getElementById('input'); input.__defineGetter__('value', function () { return parseInt(this.getAttribute('value')) * 2; }); console.log(input.value); if (input.value == 4) { input.style.background = "#0F0"; } else { input.style.background = "#F00"; } </script> _______________________________________ In this testcase safari webkit return 2, in all other browsers it return 4.
Attachments
testcase
(584 bytes, text/html)
2010-11-27 09:37 PST
,
Andreas Madsen
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2010-11-27 17:01:55 PST
This is probably a known issue, but I'm not sure what to dupe to. See also:
bug 26760
.
Andreas Madsen
Comment 2
2010-11-28 03:30:48 PST
(In reply to
comment #1
)
> This is probably a known issue, but I'm not sure what to dupe to. See also:
bug 26760
.
I don't think is the same issue, the reason why it don't work is because input.value is a native value (if you understand what i mean). If the testcase was for input.id or input.style i still won't work. But if I try input.test there is no problem because it not defined in the browser by default. As i know Function.prototype.displayName is not a default property/value. But it is possible that the source problem is the same in the two bugs (50125, 26760).
Oliver Hunt
Comment 3
2010-11-28 18:47:50 PST
This is a duplicate of the bug that needs us to expose DOM attributes as getters/setters at the appropriate level of the prototype chain.
Ahmad Saleem
Comment 4
2022-07-29 17:07:20 PDT
I am unable to reproduce this bug since now all browsers have same results and show "2" with green background in <input> field and it matches with Chrome Canary 106, Firefox Nightly 105 and Safari 15.6 on macOS 12.5. I think this can be marked as "RESOLVED CONFIGURATION CHANGED" or "RESOLVED INVALID" (latter since other browsers changed their behavior as per
Comment 0
). Thanks!
Brent Fulgham
Comment 5
2022-07-29 18:05:25 PDT
Sounds good. Thank you for testing!
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug