Closed Bug 635286 Opened 9 years ago Closed 9 years ago

":not()" pseudo class in ":-moz-any()" selector doesn't work correctly

Categories

(Core :: CSS Parsing and Computation, defect, P1)

x86
Windows Vista
defect

Tracking

()

VERIFIED FIXED
mozilla2.0

People

(Reporter: yuki, Assigned: bzbarsky)

Details

(Keywords: css-moz)

Attachments

(5 files)

Attached file simple testcase
Build identifier: Mozilla/5.0 (Windows NT 6.0; rv:2.0b12pre) Gecko/20110218 Firefox/4.0b12pre

When an element <div class="before"> becomes to <div class="after"> by changing its class, following four CSS selectors don't match to the element anymore:

  /* 1. any element which has a class "before" */
  :-moz-any(.before) { background: red; }
  /* 2. any element which doesn't have a class "after" */
  :not(.after) { background: red; }
  /* 3. equals to the case 2 but wrapped by :-moz-any */
  :-moz-any(:not(.after)) { background: red; }
  /* 4. equals to the case 2 but the inner selector is wrapped by :-moz-any */
  :not(:-moz-any(.after)) { background: red; }

However, actually the case 3 seems to be still applied to <div class="after">.  The attached HTML is a simple testcase based on this scenario. All four lines should become green, but actually the third line is still red on my Minefield.

Moreover, when I inspected actually-applied style declarations to the third line by the DOM Inspector addon, then the line suddenly became to green, even if I did no change on the DOM. It is very odd behavior.
Attached file mochitest version
mochitest version
I've verified that this problem appears on Windows 2000 with clean profile.

Build identifier: Mozilla/5.0 (Windows NT 5.0; rv:2.0b12pre) Gecko/20110218 Firefox/4.0b12pre
Yeah, the recurrence through :-moz-any in AddSelector needs to look at mNegations too.

Patch coming up.
Assignee: nobody → bzbarsky
Priority: -- → P1
Attached patch Proposed fixSplinter Review
Attachment #513538 - Flags: review?(dbaron)
Whiteboard: [need review]
Comment on attachment 513538 [details] [diff] [review]
Proposed fix

r+a2.0=dbaron
Attachment #513538 - Flags: review?(dbaron)
Attachment #513538 - Flags: review+
Attachment #513538 - Flags: approval2.0+
Whiteboard: [need review] → [need landing]
Pushed http://hg.mozilla.org/mozilla-central/rev/66167f6eccce

SHIMODA Hiroshi, thank you very much for the bug report and test!
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Whiteboard: [need landing]
Target Milestone: --- → mozilla2.0
Verified on Mozilla/5.0 (Windows NT 6.0; rv:2.0b13pre) Gecko/20110225 Firefox/4.0b13pre

Thanks a lot!
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.