Bug 137881 - Assigning .innerHTML should give a warning when invalid markup is ignored
Summary: Assigning .innerHTML should give a warning when invalid markup is ignored
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-10-20 07:48 PDT by Shad Sterling
Modified: 2022-08-18 16:01 PDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shad Sterling 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.
Comment 1 Alexey Proskuryakov 2014-10-20 21:00:41 PDT
Sounds like a good idea to me!
Comment 2 Shad Sterling 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
Comment 3 Ahmad Saleem 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!
Comment 4 Alexey Proskuryakov 2022-08-18 16:01:12 PDT
This is not a web spec matter, and still seems like a good idea to me.