New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 706206 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
NOT IN USE
Closed: Mar 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocking:
issue 704848



Sign in to add a comment

Specificity of :not() selector wrong in the presence of a default namespace

Reported by r...@opera.com, Mar 28 2017

Issue description

When a stylesheet has a default namespace, we prepend a universal selector with that default namespace to any compound selectors without a type selector. That is not necessary for compounds as parameters to pseudo selectors. For :not() it causes an issue with computing specificity because we assume there is only one simple selector inside the :not(). In the case of the type selector prepend that's not the case.

 
specificity-not-and-default-ns.html
448 bytes View Download

Comment 1 by r...@opera.com, Mar 29 2017

Blocking: 704848
Labels: Update-Monthly
Project Member

Comment 4 by bugdroid1@chromium.org, Mar 29 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/76f8029bef50611fdddf565925b9420bdac05021

commit 76f8029bef50611fdddf565925b9420bdac05021
Author: rune <rune@opera.com>
Date: Wed Mar 29 11:42:47 2017

Corrected specificity for :not for default @namespace.

The argument to :not() consists of a universal, type, or a simple
selector. However, we prepend an implicit universal selector with the
default namespace URI to all compound selectors to correctly match only
elements in the default namespace. That is not necessary for compounds
inside pseudo argument lists, but we do in those cases as well.

When calculating the specificity for :not(), we assume its argument
consists of a single simple selectors, but in the case where we have a
default namespace, a namespaced universal selector is prepended. We
only added the specificity for the universal selector in that case.
Instead, walk all sub-selectors of the :not() compound when calculating
the specificity.

R=meade@chromium.org
BUG= 706206 

Review-Url: https://codereview.chromium.org/2777063007
Cr-Commit-Position: refs/heads/master@{#460355}

[add] https://crrev.com/76f8029bef50611fdddf565925b9420bdac05021/third_party/WebKit/LayoutTests/fast/css/specificity-not-and-default-ns.html
[modify] https://crrev.com/76f8029bef50611fdddf565925b9420bdac05021/third_party/WebKit/Source/core/css/CSSSelector.cpp
[modify] https://crrev.com/76f8029bef50611fdddf565925b9420bdac05021/third_party/WebKit/Source/core/css/parser/CSSSelectorParser.cpp

Comment 5 by r...@opera.com, Mar 29 2017

Status: Fixed (was: Started)

Sign in to add a comment