mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Shorthand with variable reference should not have extra whitespace after colon for serialization
This commit is contained in:
parent
299f9446e6
commit
05b5aabc69
3 changed files with 46 additions and 4 deletions
|
@ -561,9 +561,6 @@ pub fn append_serialization<'a, W, I, N>(dest: &mut W,
|
|||
|
||||
// for normal parsed values, add a space between key: and value
|
||||
match &appendable_value {
|
||||
&AppendableValue::Css(_) => {
|
||||
try!(write!(dest, " "))
|
||||
},
|
||||
&AppendableValue::Declaration(decl) => {
|
||||
if !decl.value_is_unparsed() {
|
||||
// for normal parsed values, add a space between key: and value
|
||||
|
@ -572,7 +569,8 @@ pub fn append_serialization<'a, W, I, N>(dest: &mut W,
|
|||
},
|
||||
// Currently append_serialization is only called with a Css or
|
||||
// a Declaration AppendableValue.
|
||||
&AppendableValue::DeclarationsForShorthand(..) => unreachable!()
|
||||
&AppendableValue::DeclarationsForShorthand(..) => unreachable!(),
|
||||
&AppendableValue::Css(_) => {}
|
||||
}
|
||||
|
||||
try!(append_declaration_value(dest, appendable_value));
|
||||
|
|
|
@ -83640,6 +83640,12 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"cssom/serialize-variable-reference.html": [
|
||||
[
|
||||
"/cssom/serialize-variable-reference.html",
|
||||
{}
|
||||
]
|
||||
],
|
||||
"cssom/shorthand-serialization.html": [
|
||||
[
|
||||
"/cssom/shorthand-serialization.html",
|
||||
|
@ -159941,6 +159947,10 @@
|
|||
"329fe02cb9e54b1a24a8f9dedcfcf5c0f61c7f24",
|
||||
"testharness"
|
||||
],
|
||||
"cssom/serialize-variable-reference.html": [
|
||||
"5e83f084efc82184c3052a40bb4a061fd4a1336f",
|
||||
"testharness"
|
||||
],
|
||||
"cssom/shorthand-serialization.html": [
|
||||
"bd514834dbd48c267c16a4329af6fec7f6cbc081",
|
||||
"testharness"
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
<!doctype html>
|
||||
<meta charset="utf-8">
|
||||
<title>CSSOM - Serialization with variable preserves original serialization.</title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="longhand-whitespace" style="font-size: var(--a);"></div>
|
||||
<div id="shorthand-whitespace" style="font: var(--a);"></div>
|
||||
<div id="longhand" style="font-size:var(--a);"></div>
|
||||
<div id="shorthand" style="font:var(--a);"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var elem = document.getElementById('longhand-whitespace');
|
||||
|
||||
assert_equals(elem.style.cssText, 'font-size: var(--a);');
|
||||
}, 'Longhand with variable preserves original serialization: with withespace')
|
||||
|
||||
test(function() {
|
||||
var elem = document.getElementById('shorthand-whitespace');
|
||||
|
||||
assert_equals(elem.style.cssText, 'font: var(--a);');
|
||||
}, 'Shorthand with variable preserves original serialization: with withespace')
|
||||
|
||||
test(function() {
|
||||
var elem = document.getElementById('longhand');
|
||||
|
||||
assert_equals(elem.style.cssText, 'font-size:var(--a);');
|
||||
}, 'Longhand with variable preserves original serialization: without withespace')
|
||||
|
||||
test(function() {
|
||||
var elem = document.getElementById('shorthand');
|
||||
|
||||
assert_equals(elem.style.cssText, 'font:var(--a);');
|
||||
}, 'Shorthand with variable preserves original serialization: without withespace')
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue