-
Notifications
You must be signed in to change notification settings - Fork 120
Add missing HTMLStyleElement.innerHTML getter #1323
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
Conversation
Remove sinon usage from HTMLAnchorElement test
Bugfix iframe navigation handling
Centralize window.location in WindowBase
Bugfix worker baseUrl args
Remove Node insertAfter method
Make Node insertBefore work with null reference node
Custom protocol handlers for fetch
WebGL getContextAttributes behavior
WebGL instanceof inheritance
Bump window-xhr version
Bugfix fetch blob support
Add iterable support for DOM attributes
WebSocket origin header setting support
Add some HTMLIFrameElement stub methods
Add MediaStream stub methods
Bugfix Element append() method
| get innerHTML() { | ||
| return super.innerHTML; | ||
| } | ||
| set innerHTML(innerHTML) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be more correct to also construct and attach e.g. a Text node in the setter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but the intent of this PR is to fix the bug introduced by defining set innerHTML without defining get innerHTML. Forwarding to super.innerHTML takes care of the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this correctly return the set .innerHTML, or just default to the empty string?
If the superclass handles this, is it more appropriate to simply remove the interception on this subclass and let the parent class handle the innerHTML logic?
More generally, we should take the opportunity to "do the right thing" with regard to innerHTML setting on HTMLStyleElement. I'm confident many libraries in the wild depend on getting this correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is proof that you will go to any length not to merge pull requests from outside contributors (or at least from me). It speaks to the effectiveness of this project.
Even simple bug fixes are endlessly debated, analyzed, and random "what if?" scenarios are brought up for no apparent reason.
There is zero – and I do mean zero – reason not merge this PR. Your code for HTMLStyleElement is broken. This PR fixes it.
Merge it and make it better, if you want. Or do your usual thing of let it sit for 3 months and then do the same exact thing yourself in a slightly different way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Yes, libraries do rely on HTMLStyleElement .innerHTML actually returning the innerHTML. This is exactly the problem I ran into with exokit DOM, and why I spent time submitting this PR. It actually breaks for actual websites right now.)
Without this PR,
document.createElement('style').innerHTMLincorrectly returnsundefined:With this PR,
.innerHTMLis correctly returned: