Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing setter for input element value #17

Closed
grundt opened this issue May 30, 2022 · 2 comments
Closed

missing setter for input element value #17

grundt opened this issue May 30, 2022 · 2 comments

Comments

@grundt
Copy link
Contributor

grundt commented May 30, 2022

Any idea why the setter in the overridden input element value property is commented out here (line 18)?

The result is that if any script tries to set the value of an input field, it'll throw an error:
Uncaught TypeError: setting getter-only property "value"
(i.e. by not providing a setter, it breaks existing functionality)

I tried simply removing the comment, and it resolved the error and didn't seem to have any ill effect on Leak Inspector.
So, curious if there's a reason why it's been commented out.

document.addEventListener("modifyInputElementSetterGetter", function (e) {
let inputElement = getElementByXpath(e.detail);
let realHTMLInputElement = Object.getOwnPropertyDescriptor(
HTMLInputElement.prototype,
"value"
);
Object.defineProperty(inputElement, "value", {
enumerable: true,
configurable: true,
// set: realHTMLInputElement.set,
get: function () {
const elValue = realHTMLInputElement.get.call(this);

@asumansenol
Copy link
Collaborator

Thanks @grundt, I haven't noticed that it may throw an error if we do not set this value. I will correct it by removing the comment.

asumansenol added a commit that referenced this issue May 30, 2022
@asumansenol
Copy link
Collaborator

asumansenol commented May 30, 2022

Solved with the commit 5d35b5f70e853d0998d8bed565228a5d1e004a3e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants