Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1752] ChildNodes for Android

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionInvalid
Resolution Date2012-08-20T16:18:35.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsAndroid
Labelsandroid, childnodes, domnode, domnodelist, haschilds, length, ti.domnodelist, xml
ReporterGilliard Lopes
AssigneeNeeraj Gupta
Created2011-04-15T03:01:21.000+0000
Updated2017-03-09T23:35:15.000+0000

Description

Hello,

I'm using the childNodes property for iPhone and Android. On iPhone, it works fine and return the children nodes correctly. But, on Android, it returns something very strange. According DOMNode documentation to childNodes property: "Returns a DOMNodeList that contains all children of this node. If there are no children, this is an empty DOMNodeList". You can see the Ti.DOMNodeList object for both (android and iPhone) but if you call childNodes.length on Android it returns a "magic" number different of the real number of childrens that is returned properly on iPhone. In other words, on iPhone is everything fine, on Android the childNodes property doesn't works properly.

Regards.

Comments

  1. Brion Vibber 2011-04-15

    Gilliard, is this simply because on Android the parsed DOM tree includes whitespace which appears to be stripped out by the parsing on iPhone?

    Please go ahead and iterate over the nodes and check what they are. You should find the same element nodes on both systems. (childNodes DOES NOT only include elements! It also includes text nodes, comment nodes, etc.)

  2. Gilliard Lopes 2011-04-15

    Hum, i understand what you said. I tested in my app and confirmed your affirmative.
    Thanks for the help!!

    Regards.

  3. Junaid Younus 2012-08-20

    No test case, ticket marked as invalid.
  4. Neeraj Gupta 2012-08-20

    It appears that it was a whitespace issue and not a platform issue. Please reopen this ticket if you can provide a test case or better description to reproduce this issue.
  5. Lee Morris 2017-03-09

    Closing ticket as invalid.

JSON Source