Summary: | Incorrect node type for whitespace when setting innerHTML in an XHTML document | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Max Barel <max> | ||||||||||||||
Component: | DOM | Assignee: | Alexey Proskuryakov <ap> | ||||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||||
Severity: | Normal | CC: | ap, cdumez | ||||||||||||||
Priority: | P2 | ||||||||||||||||
Version: | 528+ (Nightly build) | ||||||||||||||||
Hardware: | Mac | ||||||||||||||||
OS: | OS X 10.5 | ||||||||||||||||
Attachments: |
|
Description
Max Barel
2008-01-04 08:37:20 PST
Created attachment 18266 [details]
base xhtml file
Created attachment 18267 [details]
injected xhtml chunk, NS
Created attachment 18268 [details]
injected xhtml chunk, no NS
Created attachment 18269 [details]
javascript injection
(In reply to comment #0) > Worth noting also, when using XMLHttpRequest to get an xhtml chunk, served as > application/xhtml+xml and injected from responseXML using DOM methods, injected > elements are not valid HTML elements if there is no explicit namespace through > xmlns attribute on the container element. This part is correct: elements being inserted have a null namespace, so they are not treated as XHTML elements. Firefox gives the same result, of course. It's a bit unfortunate that Web Inspector gives no indication of a problem in this case: e.g., both xhtml:a and null:a elements are displayed as "a". Also, XMLSerializer serializes this incorrectly (Firefox has the same problem). Filed bug 16739 and bug 16740 for these issues; let's keep this bug focused on tracking just #cdata-section issue. Confirmed as a difference with Firefox. Created attachment 18289 [details]
reduced test case
Created attachment 18302 [details]
proposed fix
I do not quite understand the theory behind this, but the change looks straightforward.
Note that parsing a whole document is different from parsing a fragment for some reason. In the former case, we get "characters" callbacks, and do not need to handle ignorableWhitespace - yet for fragments, it seems necessary.
Comment on attachment 18302 [details]
proposed fix
r=me
Committed revision 29211. Mass moving XML DOM bugs to the "DOM" Component. |