Skip to main content

Bug Tracker

Side navigation

#5740 closed enhancement (invalid)

Opened January 01, 2010 03:58PM UTC

Closed November 14, 2010 04:16AM UTC

each method should support XML

Reported by: sephr Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.4
Keywords: e4x, xml, each Cc:
Blocked by: Blocking:
Description

When I say XML, I mean native XML via E4X (ECMA-357) which is implemented by SpiderMonkey and Rhino. If typeof this === "xml" for the each method, then the following algorithm should be used.

If xml.length() === 1, then let len = xml.*.length() and iterate over xml.*

If xml.length() !== 1 (do not use > 1 as it can also be 0), then let len = xml.length() and iterate over xml.

Of course, using xml.* is invalid ECMAScript 3 which would throw a SyntaxError on most JavaScript engines so the syntactic equivalent would be to use xml.children() instead.

This algorithm would iterate over XML nodes in XMLLists and XML child nodes in an XML node.

Attachments (0)
Change History (1)

Changed November 14, 2010 04:16AM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

Since E4X is an evolutionary dead end it doesn't seem worth complicating the code for it. These kind of traversals would be best done by separate code to prevent them slowing down the common cases that $.each handles the other 99% of the time.