-
Notifications
You must be signed in to change notification settings - Fork 20.6k
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
.html method does not give a warning when dropping malformed tags #1718
Comments
Our HTML parser is the browser's parser. Does it act differently, for example throw an exception, when you do not use jQuery and instead use direct DOM operations? |
I'm not familiar with the direct DOM operations, what would be equivalent? Using If this is a browser bug, why is it the same in multiple browsers? |
Yes, that is the equivalent operation, and the two behave similarly. No browser attempts to give an error, they just try to make sense of what you have given them. which may involve ignoring some of the input. See this article. |
I understand dropping some of the input, but preventing developers from seeing the problem is an impediment to debugging. If the browsers fix the bug in their innerHTML= implementations, will that also generate the warning on .html()? https://bugzilla.mozilla.org/show_bug.cgi?id=1085368 |
A console warning is exactly what I think is missing. |
@Polyergic I don't think it's jQuery's job to provide console warnings for such things; browsers would have it easy to implement them today and they're not doing it on purpose; otherwise devs would get flooded with warnings. jQuery's We're doing a right thing by not logging anything here by ourselves. |
... which is why I submitted bugs to the browsers... |
if you call
$("#someid").html( htmlString )
whenhtmlString
contains malformed tags, the malformedtags are silently dropped.
For example, http://jsbin.com/bucik/1/edit?html,console,output
This should not be silent, a warning should be logged.
The text was updated successfully, but these errors were encountered: