From 3d67ca92443c11a08f309509bfc004d776f04d4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Wed, 28 Jun 2023 03:17:53 +0000 Subject: [PATCH] Fix cssom subtest for nesting. As per https://github.com/w3c/csswg-drafts/issues/7961 bare tag selectors and so are fine now. Differential Revision: https://phabricator.services.mozilla.com/D181799 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=1839946 gecko-commit: b271d6ad5492b424ca52dd82097b08f90cd07be5 gecko-reviewers: boris --- css/css-nesting/cssom.html | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/css/css-nesting/cssom.html b/css/css-nesting/cssom.html index b5bd80d1b46e3c..fa22b2fb45368e 100644 --- a/css/css-nesting/cssom.html +++ b/css/css-nesting/cssom.html @@ -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 &,