mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #18790 - upsuper:scope, r=emilio
Support :scope pseudo-class This fixes [bug 1406817](https://bugzilla.mozilla.org/show_bug.cgi?id=1406817). <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18790) <!-- Reviewable:end -->
This commit is contained in:
commit
bbb2a3cde9
10 changed files with 80 additions and 18 deletions
|
@ -152045,6 +152045,18 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"css/selectors4/scope-without-scoping.html": [
|
||||
[
|
||||
"/css/selectors4/scope-without-scoping.html",
|
||||
[
|
||||
[
|
||||
"/css/reference/ref-filled-green-100px-square.xht",
|
||||
"=="
|
||||
]
|
||||
],
|
||||
{}
|
||||
]
|
||||
],
|
||||
"css/selectors4/selector-required.html": [
|
||||
[
|
||||
"/css/selectors4/selector-required.html",
|
||||
|
@ -538672,6 +538684,10 @@
|
|||
"607553f41a33ce3630752cdf027c9f904833a19d",
|
||||
"reftest"
|
||||
],
|
||||
"css/selectors4/scope-without-scoping.html": [
|
||||
"f70b8d60543c5a28fcf955b1780f15c03d60991a",
|
||||
"reftest"
|
||||
],
|
||||
"css/selectors4/selector-required-ref.html": [
|
||||
"815bc765614b4c2e3d8f8f6303e6bb2ee0989c23",
|
||||
"support"
|
||||
|
@ -570101,7 +570117,7 @@
|
|||
"testharness"
|
||||
],
|
||||
"dom/nodes/Element-closest.html": [
|
||||
"4171fb8b70948ba2617e05b118aaf5d9367e916f",
|
||||
"5abddb81959019267d8b69002ee95b011b2fe34a",
|
||||
"testharness"
|
||||
],
|
||||
"dom/nodes/Element-firstElementChild-entity-xhtml.xhtml": [
|
||||
|
|
|
@ -4,3 +4,6 @@
|
|||
bug: https://github.com/servo/servo/issues/10781
|
||||
expected: FAIL
|
||||
|
||||
[Element.closest with context node 'test4' and selector ':has(> :scope)']
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<title>Selectors Level 4: :scope without scoping</title>
|
||||
<link rel="author" title="Xidorn Quan" href="mailto:me@upsuper.org">
|
||||
<link rel="author" title="Mozilla" href="https://www.mozilla.org">
|
||||
<link rel="help" href="https://drafts.csswg.org/selectors-4/#scope-pseudo">
|
||||
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
|
||||
<style>
|
||||
div {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
background: red;
|
||||
}
|
||||
:scope > body > div {
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
|
||||
<div></div>
|
||||
</body>
|
||||
</html>
|
|
@ -56,11 +56,10 @@
|
|||
do_test(":first-child" , "test12", "test3");
|
||||
do_test(":invalid" , "test11", "test2");
|
||||
|
||||
do_scope_test(":scope" , "test4");
|
||||
do_scope_test("select > :scope" , "test4");
|
||||
do_scope_test("div > :scope" , "test4");
|
||||
do_scope_test(":has(> :scope)" , "test4");
|
||||
|
||||
do_test(":scope" , "test4", "test4");
|
||||
do_test("select > :scope" , "test4", "test4");
|
||||
do_test("div > :scope" , "test4", "");
|
||||
do_test(":has(> :scope)" , "test4", "test3");
|
||||
function do_test(aSelector, aElementId, aTargetId) {
|
||||
test(function() {
|
||||
var el = document.getElementById(aElementId).closest(aSelector);
|
||||
|
@ -71,13 +70,4 @@ function do_test(aSelector, aElementId, aTargetId) {
|
|||
}
|
||||
}, "Element.closest with context node '" + aElementId + "' and selector '" + aSelector + "'");
|
||||
}
|
||||
|
||||
function do_scope_test(aSelector, aElementId) {
|
||||
test(function() {
|
||||
var el = document.getElementById(aElementId);
|
||||
assert_throws("SYNTAX_ERR", function() {
|
||||
el.closest(aSelector);
|
||||
});
|
||||
}, "Element.closest with context node '" + aElementId + "' and selector '" + aSelector + "' should throw");
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue