Loading servo/components/style/gecko/pseudo_element.rs +9 −5 Original line number Diff line number Diff line Loading @@ -27,12 +27,16 @@ include!(concat!( impl ::selectors::parser::PseudoElement for PseudoElement { type Impl = SelectorImpl; // ::slotted() should support all tree-abiding pseudo-elements, see // https://drafts.csswg.org/css-scoping/#slotted-pseudo // https://drafts.csswg.org/css-pseudo-4/#treelike fn valid_after_slotted(&self) -> bool { // TODO(emilio): Remove this function or this comment after [1] is // resolved. // // [1]: https://github.com/w3c/csswg-drafts/issues/3150 self.is_before_or_after() matches!( *self, PseudoElement::Before | PseudoElement::After | PseudoElement::Placeholder ) } fn supports_pseudo_class(&self, pseudo_class: &NonTSPseudoClass) -> bool { Loading testing/web-platform/meta/css/css-scoping/slotted-parsing.html.ini 0 → 100644 +4 −0 Original line number Diff line number Diff line [slotted-parsing.html] [Should be a valid selector: '::slotted(*)::marker'] expected: FAIL testing/web-platform/tests/css/css-scoping/slotted-parsing.html +2 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ // Allow tree-abiding pseudo elements after ::slotted test_valid_selector("::slotted(*)::before"); test_valid_selector("::slotted(*)::after"); test_valid_selector("::slotted(*)::placeholder"); test_valid_selector("::slotted(*)::marker"); // Other pseudo elements not valid after ::slotted test_invalid_selector("::slotted(*)::first-line"); Loading testing/web-platform/tests/css/css-scoping/slotted-placeholder-ref.html 0 → 100644 +6 −0 Original line number Diff line number Diff line <!doctype html> <style> ::placeholder { color: green } </style> <input placeholder="I should be green"> <textarea placeholder="I should be green"></textarea> testing/web-platform/tests/css/css-scoping/slotted-placeholder.html 0 → 100644 +19 −0 Original line number Diff line number Diff line <!doctype html> <meta charset="utf-8"> <title>CSS Scoping Test: ::slotted() allows ::placeholder</title> <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> <link rel="author" title="Mozilla" href="https://mozilla.org"> <link rel="help" href="https://drafts.csswg.org/css-scoping/#slotted-pseudo"> <link rel="match" href="slotted-placeholder-ref.html"> <div id="host"> <input placeholder="I should be green"> <textarea placeholder="I should be green"></textarea> </div> <script> host.attachShadow({ mode: "open" }).innerHTML = ` <style> ::slotted(*)::placeholder { color: green } </style> <slot></slot> `; </script> Loading
servo/components/style/gecko/pseudo_element.rs +9 −5 Original line number Diff line number Diff line Loading @@ -27,12 +27,16 @@ include!(concat!( impl ::selectors::parser::PseudoElement for PseudoElement { type Impl = SelectorImpl; // ::slotted() should support all tree-abiding pseudo-elements, see // https://drafts.csswg.org/css-scoping/#slotted-pseudo // https://drafts.csswg.org/css-pseudo-4/#treelike fn valid_after_slotted(&self) -> bool { // TODO(emilio): Remove this function or this comment after [1] is // resolved. // // [1]: https://github.com/w3c/csswg-drafts/issues/3150 self.is_before_or_after() matches!( *self, PseudoElement::Before | PseudoElement::After | PseudoElement::Placeholder ) } fn supports_pseudo_class(&self, pseudo_class: &NonTSPseudoClass) -> bool { Loading
testing/web-platform/meta/css/css-scoping/slotted-parsing.html.ini 0 → 100644 +4 −0 Original line number Diff line number Diff line [slotted-parsing.html] [Should be a valid selector: '::slotted(*)::marker'] expected: FAIL
testing/web-platform/tests/css/css-scoping/slotted-parsing.html +2 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ // Allow tree-abiding pseudo elements after ::slotted test_valid_selector("::slotted(*)::before"); test_valid_selector("::slotted(*)::after"); test_valid_selector("::slotted(*)::placeholder"); test_valid_selector("::slotted(*)::marker"); // Other pseudo elements not valid after ::slotted test_invalid_selector("::slotted(*)::first-line"); Loading
testing/web-platform/tests/css/css-scoping/slotted-placeholder-ref.html 0 → 100644 +6 −0 Original line number Diff line number Diff line <!doctype html> <style> ::placeholder { color: green } </style> <input placeholder="I should be green"> <textarea placeholder="I should be green"></textarea>
testing/web-platform/tests/css/css-scoping/slotted-placeholder.html 0 → 100644 +19 −0 Original line number Diff line number Diff line <!doctype html> <meta charset="utf-8"> <title>CSS Scoping Test: ::slotted() allows ::placeholder</title> <link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io"> <link rel="author" title="Mozilla" href="https://mozilla.org"> <link rel="help" href="https://drafts.csswg.org/css-scoping/#slotted-pseudo"> <link rel="match" href="slotted-placeholder-ref.html"> <div id="host"> <input placeholder="I should be green"> <textarea placeholder="I should be green"></textarea> </div> <script> host.attachShadow({ mode: "open" }).innerHTML = ` <style> ::slotted(*)::placeholder { color: green } </style> <slot></slot> `; </script>