Bug Tracker

Modify

Ticket #5740 (closed enhancement: invalid)

Opened 3 years ago

Last modified 3 years ago

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:
Blocking: Blocked by:

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

jquery-each-xml.xhtml Download (1.4 KB) - added by sephr 3 years ago.
Testcase

Change History

Changed 3 years ago by sephr

Testcase

comment:1 Changed 3 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to invalid

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.