Skip to main content

Bug Tracker

Side navigation

#3848 closed bug (fixed)

Opened January 14, 2009 05:46PM UTC

Closed January 17, 2009 06:52PM UTC

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)
  • test-case-adamh.html (0.7 KB) - added by adamh January 16, 2009 05:55PM UTC.

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

  • test1-1.3-broken.html (0.4 KB) - added by LosT January 14, 2009 08:11PM UTC.

    New test - broken

  • test1-1.3-works.html (0.4 KB) - added by LosT January 14, 2009 08:11PM UTC.

    New test - works

Change History (13)

Changed January 14, 2009 07:48PM UTC by balazs.endresz comment:1

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

Changed January 14, 2009 08:18PM UTC by LosT comment:2

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.

Changed January 14, 2009 08:24PM UTC by balazs.endresz comment:3

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

Changed January 14, 2009 08:34PM UTC by LosT comment:4

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

Changed January 14, 2009 08:39PM UTC by balazs.endresz comment:5

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

Changed January 14, 2009 08:40PM UTC by balazs.endresz comment:6

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

Changed January 14, 2009 08:42PM UTC by LosT comment:7

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

Changed January 14, 2009 08:49PM UTC by balazs.endresz comment:8

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

Changed January 14, 2009 09:03PM UTC by balazs.endresz comment:9

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

Changed January 14, 2009 10:46PM UTC by brucealdridge comment:10

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

Changed January 15, 2009 01:44PM UTC by john comment:11

milestone: 1.31.3.1
need: ReviewTest Case
version: 1.2.61.3

Changed January 16, 2009 05:55PM UTC by adamh comment:12

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

Changed January 17, 2009 06:52PM UTC by john comment:13

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.