Closed Bug 351932 Opened 19 years ago Closed 19 years ago

DOMParser and XMLHttpRequest insert whitespace nodes while parsing XUL

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED INVALID

People

(Reporter: account, Unassigned)

Details

(Keywords: helpwanted)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6 The problem occured while I tried to parse a XUL document which I got via XMLHttpRequest. The XUL document is retrieved correctly (req.responseText). But if I try to parse this text with the DOMParser() object (as 'text/xml'), the resulting DOM tree contains plenty of whitespace node. Furthermore, XMLHttpRequest does the same when getting the retrieved conten with req.responseXML. The actual workaround for this problem is to write a JavaScript function that strips existing whitespace text nodes from the new tree. Reproducible: Always Steps to Reproduce: 1. Get XUL content via XMLHttpRequest 2. Parse text response with DOMParser(text,'text/xml') Actual Results: view resulting tree in debugger --> contains lots of text nodes (type: #text) Expected Results: a dom tree _without_ whitespace nodes because they're not part of the original XUL document.
As filed, this is invalid. The XML document involved _does_ contain whitespace nodes. If you want this document parsed as non-XML (which is what the XUL parser does), you need to use non-XML tools. I suppose we could have a "XUL" mode for DOMParser, if XUL even makes it possible. Feel free to resummarize accordingly and move to Core:DOM. It's pretty similar to the requests to have an HTML mode for it.
Keywords: helpwanted
Ok. Bug has been reported to Core:DOM. ID: #352052.
Status: UNCONFIRMED → RESOLVED
Closed: 19 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.