WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
137881
Assigning .innerHTML should give a warning when invalid markup is ignored
https://bugs.webkit.org/show_bug.cgi?id=137881
Summary
Assigning .innerHTML should give a warning when invalid markup is ignored
Shad Sterling
Reported
2014-10-20 07:48:57 PDT
if you call document.getElementById("someid").innerHTML = htmlString when htmlString contains malformed tags, the malformed tags are silently dropped. For example,
http://jsbin.com/qikeha/2/edit?html,console,output
This should not be silent, a warning should be logged.
Attachments
Add attachment
proposed patch, testcase, etc.
Alexey Proskuryakov
Comment 1
2014-10-20 21:00:41 PDT
Sounds like a good idea to me!
Shad Sterling
Comment 2
2014-10-20 21:42:19 PDT
The example URL in
comment 0
fails to illustrate the problem. In that example, nothing is actually dropped, what is intended as the second paragraph is taken to be part of a property on the <p> tag. To get the second paragraph to disappear, the third paragraph must be omitted. Here's an updated example:
http://jsbin.com/qikeha/4/edit?html,console,output
Ahmad Saleem
Comment 3
2022-08-08 17:19:57 PDT
I am not sure on web-spec but all browsers (Chrome Canary 106, Firefox Nightly 105 and Safari 15.6 on macOS 12.5) and does not show any warning in console on comment saying there should be a warning before and after this? Appreciate if someone can comment aligned with web-spec whether it is something to be discussed in WHATWG Github or something since all agree to mark as "RESOLVED WONTFIX"? Thanks!
Alexey Proskuryakov
Comment 4
2022-08-18 16:01:12 PDT
This is not a web spec matter, and still seems like a good idea to me.
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