[TIMOB-8551] iOS: XML: ownerDocument property is null for created nodes
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-08-01T22:38:19.000+0000 |
Affected Version/s | Release 2.0.0 |
Fix Version/s | Release 2.0.2, Release 2.1.0, Sprint 2012-09 API |
Components | iOS |
Labels | api, module_xml, qe-testadded |
Reporter | Jeff English |
Assignee | Vishal Duggal |
Created | 2012-04-05T11:21:18.000+0000 |
Updated | 2013-12-10T06:03:26.000+0000 |
Description
Attempting to access the 'ownerDocument' property of a created node (e.g. createElement, createElementNS) returns null rather than a valid document node.
When pulling in other open-source javascript libraries for various projects, some of them rely on the ownerDocument field, especially when creating new documents.
To reproduce, add the following code to an application and run:
var doc = Ti.XML.parseString('<?xml version="1.0"?><root><test>data</test></root>');
// The following retrieves the first node. The owner document will be valid and correct
var e1 = doc.firstChild;
var o1 = e1.ownerDocument;
// The following creates a new node. The owner document will be null
var e2 = doc.createElement("test");
var o2 = e2.ownerDocument;
Test code
Pull pending https://github.com/appcelerator/titanium_mobile/pull/2049
Tested with 2.0.2.v20120517141652 on iPhone 4s 5.1
Re-opening to edit label
Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/5039