Commit f3573769 authored by Anders Hartvoll Ruud's avatar Anders Hartvoll Ruud Committed by Commit Bot

[:is/:where] Add WPT is-specificity-shadow.html

Our specificity calculation for :host() incorrectly uses the
maximum specificity for the selector that _matched_ inside :host().
Since no selector matches in this case, the specificity is zero, and
we end up applying the wrong thing.

Bug: 1143404
Change-Id: Ib3f4d132c36aedeade3fd79d86c960c352eba120
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2505896Reviewed-by: default avatarRune Lillesveen <futhark@chromium.org>
Commit-Queue: Anders Hartvoll Ruud <andruud@chromium.org>
Cr-Commit-Position: refs/heads/master@{#822070}
parent dbdf72f1
This is a testharness.js-based test.
FAIL Specificity of :host() inside :is() assert_equals: expected "rgb(0, 128, 0)" but got "rgb(255, 0, 0)"
Harness: the test ran to completion.
<!DOCTYPE html>
<title>Specificity of :host() inside :is()</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<link rel="help" href="https://drafts.csswg.org/selectors-4/#matches">
<link rel="help" href="https://drafts.csswg.org/css-scoping/#host-selector">
<style>
main :not(:is(:host(#a))) { color: green; }
main :not(:is(:host(.a))) { color: red; }
</style>
<main>
<div id=element>Green</div>
</main>
<script>
test(function() {
assert_equals(getComputedStyle(element).color, 'rgb(0, 128, 0)');
}, 'Specificity of :host() inside :is()');
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment