Skip to content

Commit

Permalink
Bug 1839946 - Fix cssom subtest for nesting. r=boris
Browse files Browse the repository at this point in the history
As per w3c/csswg-drafts#7961 bare tag
selectors and so are fine now.

Differential Revision: https://phabricator.services.mozilla.com/D181799
  • Loading branch information
emilio committed Jun 28, 2023
1 parent cc7cd4e commit 0167c03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
3 changes: 0 additions & 3 deletions testing/web-platform/meta/css/css-nesting/cssom.html.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[cssom.html]
[Simple CSSOM manipulation of subrules 9]
expected: FAIL

[Simple CSSOM manipulation of subrules 10]
expected: FAIL
13 changes: 5 additions & 8 deletions testing/web-platform/tests/css/css-nesting/cssom.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,22 +125,19 @@
}`, 'color is changed, new rule is ignored');
});

// We cannot insert anything starting with an tag, as that would cause
// the serialized rule not to parse back. Compounds starting with a tag
// that are _not_ the first compound in a complex selector are OK, though,
// as are complex selectors that are not the first in the list.
test(() => {
document.getElementById('ss').innerHTML = sampleSheetText;
let [ss] = document.styleSheets;
ss.cssRules[0].cssRules[0].selectorText = 'div.b .c &'; // Ignored.
ss.cssRules[0].cssRules[0].selectorText = 'div.b .c &'; // Allowed
ss.cssRules[0].cssRules[1].selectorText = '.c div.b &, div &'; // Allowed.
assert_throws_dom('SyntaxError', () => { ss.cssRules[0].insertRule('div & {}'); });
ss.cssRules[0].insertRule('div & {}'); // Allowed.
assert_equals(ss.cssRules[0].cssText,
`.a {
color: red;
& .b { color: green; }
div & { }
div.b .c & { color: green; }
.c div.b &, div & { color: blue; }
}`, 'one rule is kept unchanged, the other is changed');
}`, 'selectorText and insertRule');
});

// Rules that are dropped in forgiving parsing but that contain &,
Expand Down

0 comments on commit 0167c03

Please sign in to comment.