Auto merge of #19263 - heycam:attr-ws, r=SimonSapin

selectors: Allow white space in the brackets of an attribute selector.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19263)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-11-18 00:47:57 -06:00 committed by GitHub
commit 7b886b4479
4 changed files with 58 additions and 0 deletions

View file

@ -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(

View file

@ -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",
@ -255927,6 +255939,11 @@
{}
]
],
"css/selectors/selectors-attr-white-space-001-ref.html": [
[
{}
]
],
"css/selectors/selectors-empty-001-ref.xml": [
[
{}
@ -514302,6 +514319,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"

View file

@ -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>

View file

@ -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>