Skip to main content

Bug Tracker

Side navigation

#13846 closed bug (fixed)

Opened May 01, 2013 02:37PM UTC

Closed May 01, 2013 03:37PM UTC

Last modified May 01, 2013 03:38PM UTC

jQuery 2.0.0 reversing order of returned elements

Reported by: slubowsky Owned by:
Priority: undecided Milestone: 2.0.1
Component: traversing Version: 2.0.0
Keywords: Cc:
Blocked by: Blocking:
Description

See http://jsbin.com/oxisur/2/edit where jQuery 1.9.1 iterates through elements in expected order but jQuery 2.0.0 reverses them.

Sample code below as well:

<!DOCTYPE html>
<html>
<head>
    <title>test</title>
</head>
<body>
    <div>Foo 1</div>
    <blockquote>
        foo 1 stuff
    </blockquote>
    <div>Foo 2</div>
    <blockquote>
        foo 2 stuff
    </blockquote>
    <div>Foo 3</div>
    <blockquote>
        foo 3 stuff
    </blockquote>
    <!--<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>-->
    <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
    <script>
        $(function () {
            $('body>blockquote').prev().each(function process(i, v) {
                console.log(i + ': ' + $(v).text());
            });
        });
    </script>
</body>
</html>
Attachments (0)
Change History (2)

Changed May 01, 2013 03:37PM UTC by Richard Gibson comment:1

resolution: → fixed
status: newclosed

Fix #13846: .prev sort direction

Changeset: 9c4a428528cc47b0ef87a273f191c0fbbccc9678

Changed May 01, 2013 03:38PM UTC by gibson042 comment:2

component: unfiledtraversing
milestone: None2.0.1

Yeah, this was my mistake. Thanks for the report!