Bug Tracker

Opened 11 years ago

Closed 11 years ago

#3848 closed bug (fixed)

Child selector bug

Reported by: LosT Owned by: john
Priority: undecided Milestone: 1.3.1
Component: selector Version: 1.3
Keywords: Cc:
Blocked by: Blocking:

Description

Child selector in the attached file has a very strange (and buggy) behaviour, it's broken by markup which shouldn't interfere.

Broken in: FF3, IE6/7, Opera 9 Works in: Safari 3, Opera 10

jQuery 1.2.6 was fine

Attachments (3)

test1-1.3-broken.html (459 bytes) - added by LosT 11 years ago.
New test - broken
test1-1.3-works.html (423 bytes) - added by LosT 11 years ago.
New test - works
test-case-adamh.html (742 bytes) - added by adamh 11 years ago.
Should alert("Yay, it works"); alerts, "WHY AM I SELECTED?"

Download all attachments as: .zip

Change History (16)

comment:1 Changed 11 years ago by balazs.endresz

It works for me, in both cases the expected element is selected. But the coloring is a bit misleading.

Changed 11 years ago by LosT

Attachment: test1-1.3-broken.html added

New test - broken

Changed 11 years ago by LosT

Attachment: test1-1.3-works.html added

New test - works

comment:2 Changed 11 years ago by LosT

Sorry, I was in a hurry and I uploaded the wrong files. I just reuploaded them.

My issue is that the selector (.m2>li>b) should add the red background only on the first "test" (B tag) and not on all three Bs inside. The strange thing is that this behaviour is triggered by a B outside the first ul that should be checked (the one with class m2). Without that all goes fine.

comment:3 Changed 11 years ago by balazs.endresz

Those elements are red, even if you don't use any javascript.

comment:4 Changed 11 years ago by LosT

I re-uploded the files without the styles, sorry for thet, it was a mistake.

comment:5 Changed 11 years ago by balazs.endresz

Still working fine. Try this: jQuery('.m2>li>b')[0] in Firebug!

comment:6 Changed 11 years ago by balazs.endresz

Sorry, rather this: jQuery('.m2>li>b')

comment:7 Changed 11 years ago by LosT

hmmm... for me it's wrong, it selects 3 elements instead of 1

comment:8 Changed 11 years ago by balazs.endresz

Oh, sorry, I was testing with an earlier build, you're right!

comment:9 Changed 11 years ago by balazs.endresz

This issue has appeared in 1.3rc1, b2 was fine.

comment:10 Changed 11 years ago by brucealdridge

i also have this problem using

  $('div.editable > div').css('border','green 1px solid');

all divs on the page are given a green border, whereas

  $('.editable > div').css('border','green 1px solid');

works

comment:11 Changed 11 years ago by john

Milestone: 1.31.3.1
need: ReviewTest Case
Version: 1.2.61.3

Changed 11 years ago by adamh

Attachment: test-case-adamh.html added

Should alert("Yay, it works"); alerts, "WHY AM I SELECTED?"

comment:12 Changed 11 years ago by adamh

Added my own test case, which I am guessing is the same bug (or at least closely related)

comment:13 Changed 11 years ago by john

Resolution: fixed
Status: newclosed

Thanks for the test cases, everyone. It was a rather obscure bug, but I just fixed it: http://github.com/jeresig/sizzle/commit/ecb9808024ccb7de6948423df6fc43664be509e6

Will be merging in to jQuery shortly.

Note: See TracTickets for help on using tickets.