зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1639533 - Fix a case where we'd allow parsing functional :host incorrectly. r=heycam
This is a missing check I should've introduced in bug 1632647. Differential Revision: https://phabricator.services.mozilla.com/D76161
This commit is contained in:
Родитель
d623bd478b
Коммит
a594bf82aa
|
@ -1310,6 +1310,9 @@ function runTests() {
|
||||||
test_parseable("::-moz-color-swatch:hover");
|
test_parseable("::-moz-color-swatch:hover");
|
||||||
test_balanced_unparseable("::-moz-color-swatch:not(.foo)");
|
test_balanced_unparseable("::-moz-color-swatch:not(.foo)");
|
||||||
test_balanced_unparseable("::-moz-color-swatch:first-child");
|
test_balanced_unparseable("::-moz-color-swatch:first-child");
|
||||||
|
test_balanced_unparseable("::-moz-color-swatch:host");
|
||||||
|
test_balanced_unparseable("::-moz-color-swatch:host(div)");
|
||||||
|
test_balanced_unparseable("::-moz-color-swatch:nth-child(1)");
|
||||||
test_balanced_unparseable("::-moz-color-swatch:hover#foo");
|
test_balanced_unparseable("::-moz-color-swatch:hover#foo");
|
||||||
test_balanced_unparseable(".foo::after:not(.bar) ~ h3");
|
test_balanced_unparseable(".foo::after:not(.bar) ~ h3");
|
||||||
|
|
||||||
|
|
|
@ -2207,7 +2207,12 @@ where
|
||||||
"nth-last-of-type" => return parse_nth_pseudo_class(parser, input, state, Component::NthLastOfType),
|
"nth-last-of-type" => return parse_nth_pseudo_class(parser, input, state, Component::NthLastOfType),
|
||||||
"is" if parser.parse_is_and_where() => return parse_is_or_where(parser, input, state, Component::Is),
|
"is" if parser.parse_is_and_where() => return parse_is_or_where(parser, input, state, Component::Is),
|
||||||
"where" if parser.parse_is_and_where() => return parse_is_or_where(parser, input, state, Component::Where),
|
"where" if parser.parse_is_and_where() => return parse_is_or_where(parser, input, state, Component::Where),
|
||||||
"host" => return Ok(Component::Host(Some(parse_inner_compound_selector(parser, input, state)?))),
|
"host" => {
|
||||||
|
if !state.allows_tree_structural_pseudo_classes() {
|
||||||
|
return Err(input.new_custom_error(SelectorParseErrorKind::InvalidState));
|
||||||
|
}
|
||||||
|
return Ok(Component::Host(Some(parse_inner_compound_selector(parser, input, state)?)));
|
||||||
|
},
|
||||||
"not" => {
|
"not" => {
|
||||||
if state.intersects(SelectorParsingState::INSIDE_NEGATION) {
|
if state.intersects(SelectorParsingState::INSIDE_NEGATION) {
|
||||||
return Err(input.new_custom_error(
|
return Err(input.new_custom_error(
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
test_invalid_selector("::slotted(*).class");
|
test_invalid_selector("::slotted(*).class");
|
||||||
test_invalid_selector("::slotted(*)#id {}");
|
test_invalid_selector("::slotted(*)#id {}");
|
||||||
test_invalid_selector("::slotted(*)[attr]");
|
test_invalid_selector("::slotted(*)[attr]");
|
||||||
|
test_invalid_selector("::slotted(*):host");
|
||||||
|
test_invalid_selector("::slotted(*):host(div)");
|
||||||
test_invalid_selector("::slotted(*):hover");
|
test_invalid_selector("::slotted(*):hover");
|
||||||
test_invalid_selector("::slotted(*):read-only");
|
test_invalid_selector("::slotted(*):read-only");
|
||||||
test_invalid_selector("::slotted(*)::slotted(*)");
|
test_invalid_selector("::slotted(*)::slotted(*)");
|
||||||
|
|
Загрузка…
Ссылка в новой задаче