Skip to content

Commit

Permalink
selectors: Allow white space in the brackets of an attribute selector.
Browse files Browse the repository at this point in the history
  • Loading branch information
heycam committed Nov 18, 2017
1 parent e61a4d0 commit 29e300f
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 0 deletions.
3 changes: 3 additions & 0 deletions components/selectors/parser.rs
Expand Up @@ -1365,6 +1365,9 @@ where
{
let namespace;
let local_name;

input.skip_whitespace();

match parse_qualified_name(parser, input, /* in_attr_selector = */ true)? {
OptionalQName::None(t) => {
return Err(input.new_custom_error(
Expand Down
37 changes: 37 additions & 0 deletions tests/wpt/metadata/MANIFEST.json
Expand Up @@ -156085,6 +156085,18 @@
{}
]
],
"css/selectors/selectors-attr-white-space-001.html": [
[
"/css/selectors/selectors-attr-white-space-001.html",
[
[
"/css/selectors/selectors-attr-white-space-001-ref.html",
"=="
]
],
{}
]
],
"css/selectors/selectors-dir-selector-ltr-001.html": [
[
"/css/selectors/selectors-dir-selector-ltr-001.html",
Expand Down Expand Up @@ -178023,6 +178035,18 @@
{}
]
],
"css/selectors/selectors-attr-white-space-001-ref.html": [
[
"/css/selectors/selectors-attr-white-space-001-ref.html",
[
[
"/css/selectors/selectors-attr-white-space-001-ref.html",
"=="
]
],
{}
]
],
"css/vendor-imports/mozilla/mozilla-central-reftests/background/border-image-repeat-space-4-ref-1.html": [
[
"/css/vendor-imports/mozilla/mozilla-central-reftests/background/border-image-repeat-space-4-ref-1.html",
Expand Down Expand Up @@ -255927,6 +255951,11 @@
{}
]
],
"css/selectors/selectors-attr-white-space-001-ref.html": [
[
{}
]
],
"css/selectors/selectors-empty-001-ref.xml": [
[
{}
Expand Down Expand Up @@ -514302,6 +514331,14 @@
"601b8b8426c64717f82831e6258f8fe4188c797c",
"reftest"
],
"css/selectors/selectors-attr-white-space-001-ref.html": [
"0b790e2cb7a6ca66c7e6c8f769b61e3197f372fb",
"support"
],
"css/selectors/selectors-attr-white-space-001.html": [
"23c9560d06ddff28e5a1f43a10347a5e46377847",
"reftest"
],
"css/selectors/selectors-dir-selector-ltr-001.html": [
"3682f8a499ad2a1348f620b33b83944c0dc90788",
"reftest"
Expand Down
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Selectors: White space in attribute selectors (reference)</title>
<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au"/>
<style>
body { color: green; }
</style>
<p>This text should be green.</p>
<p>This text should be green.</p>
<p>This text should be green.</p>
<p>This text should be green.</p>
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Selectors: White space in attribute selectors</title>
<link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au"/>
<link rel="help" href="https://drafts.csswg.org/selectors-3/#w3cselgrammar"/>
<link rel="help" href="https://drafts.csswg.org/selectors-4/#grammar"/>
<link rel="match" href="selectors-attr-white-space-001-ref.html"/>
<style>
body { color: red; }
[ data-test-1] { color: green; }
[data-test-2 ] { color: green; }
[data-test-3 = x] { color: green; }
[ |data-test-4] { color: green; }
[ | data-test-4] { color: red; }
</style>
<p data-test-1="">This text should be green.</p>
<p data-test-2="">This text should be green.</p>
<p data-test-3="x">This text should be green.</p>
<p data-test-4="">This text should be green.</p>

0 comments on commit 29e300f

Please sign in to comment.