Bug Tracker

Opened 13 years ago

Closed 12 years ago

#5740 closed enhancement (invalid)

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:


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 (1)

jquery-each-xml.xhtml (1.4 KB) - added by sephr 13 years ago.

Download all attachments as: .zip

Change History (2)

Changed 13 years ago by sephr

Attachment: jquery-each-xml.xhtml added


comment:1 Changed 12 years ago by dmethvin

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.

Note: See TracTickets for help on using tickets.