Closed Bug 271545 Opened 21 years ago Closed 21 years ago

XML() does not create empty text nodes

Categories

(Rhino Graveyard :: E4X, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: igor, Assigned: igor)

Details

Attachments

(1 file)

Werner Sharp wrote: > > In the appendChild behavior below, it looks like Rhino is treating "new > XML()" different than "new XML("")". The same issue appears when doing... > > x = new XML(); > x.a = "foo"; > print (x.toXMLString()); > x = new XML(""); > x.a = "foo"; > print (x.toXMLString()); > > The first case creates "<a>foo</a>" while the second case does not.
Here is a relevant section of ECMA 357: 13.4.2 The XML Constructor Syntax new XML ( [ value ] ) ... Semantics When the XML constructor is called with no arguments or a single argument value, the following steps are taken: 1. If value is null, undefined or not supplied, let value be the empty string ...
Changing the title: the actual bug is that while XML() creates true leaf empty text object which should ignore attempts to add xml child to it, the resulting XML("") does allow child insertion. Note that XML(nonEmptyStringWithoutXMLMarkup) behaves properly and creates text node which ignore any attempt to add a child to it.
Summary: XML() does not behave as XML("") → XML("") does not create empty text nodes
Changing title one more time: The bug is that while XML("") does create empty text node, XML() creates non-leaf object.
Summary: XML("") does not create empty text nodes → XML() does not create empty text nodes
I added e4x/Regress/regress-271545.js to the test suite which currently generates: Bug Number 271545 STATUS: XML("") should create empty text node Failure messages were: FAILED!: Section 1 of test - FAILED!: Expected value: FAILED!: FAILED!: Actual value: FAILED!: <a>foo</a> FAILED!:
I committed the fix
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.6R1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: