Closed
Bug 310478
Opened 19 years ago
Closed 19 years ago
E4X handles whitespace in text incorrectly
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: conor, Unassigned)
References
()
Details
(Keywords: testcase)
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a1) Gecko/20050926 Firefox/1.6a1
Build Identifier: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.9a1) Gecko/20050926 Firefox/1.6a1
10.1 of the ECMA spec says that toXMLString should strip leading
and trailing spaces from a text node iff prettyPrint is true. This test shows
that the Mozilla E4X always strips spaces from some text nodes irrespective of
the prettyPrint setting.
Reproducible: Always
Steps to Reproduce:
var textAfterSpan = "<p><span> A sentence with a leading </span> and then one
with another leading space.</p>";
var xmlText = new XML(textAfterSpan);
XML.prettyPrinting = false;
var spanText = xmlText.children()[0].toXMLString();
var followingText = xmlText.children()[1].toXMLString();
XML.prettyPrinting = true;
var spanTextPretty = xmlText.children()[0].toXMLString();
var followingTextPretty = xmlText.children()[1].toXMLString();
// All ok: whitespace is preserved in spanText so it isn't the same as
// its "pretty" equivalent
if(spanText == spanTextPretty)
alert("Got bug: problem with whitespace in text inside embedded tags");
// Bug: leading whitespace removed no matter what
if(followingText == followingTextPretty)
alert("Got bug: problem with whitespace in text following an embedded tag");
Updated•19 years ago
|
Assignee: nobody → general
Component: General → JavaScript Engine
Keywords: testcase
Product: Firefox → Core
QA Contact: general → general
Version: unspecified → Trunk
Comment 1•19 years ago
|
||
You need to set XML.ignoreWhitespace = false; in addition to clearing XML.prettyPrinting to see whitespace preserved from input to toXMLString output. /be
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.
Description
•