W3C home > Mailing lists > Public > public-css-archive@w3.org > March 2017

Re: [csswg-drafts] [css-cascade] About omitted subproperty value in shorthand

From: Xidorn Quan via GitHub <sysbot+gh@w3.org>
Date: Thu, 02 Mar 2017 23:49:42 +0000
To: public-css-archive@w3.org
Message-ID: <issue_comment.created-283820452-1488498581-sysbot+gh@w3.org>
Easy: get the specified value via CSSOM, which is the value before 
cascading. e.g.
<!DOCTYPE html>
<div style="background: none"></div>
var elem = document.querySelector('div');
gives us
* Firefox & Edge -> `transparent`
* Chrome & Safari -> `initial`

Also, by "makes serialization code more complicated" in my first post,
 I meant I imagine that it makes serialization code potentially more 
complicated and error-prone in all browsers if follow that way, not 
just in Servo. At least, makes shorthand harder to round-trip.

For example, Blink has this kind of behavior that
<!DOCTYPE html>
<div style="background: none; background-size: 10px; 
background-position: initial;"></div>
var elem = document.querySelector('div');
alert(elem.style.backgroundPosition); // -> "initial"
elem.style.cssText = elem.style.cssText;
alert(elem.style.backgroundPosition); // -> "0% 0%"
And WebKit is somehow worse in this case that the second one returns 
empty directly. This kind of issues are fixable, but that just makes 
the logic unnecessarily complicated.

GitHub Notification of comment by upsuper
Please view or discuss this issue at 
 using your GitHub account
Received on Thursday, 2 March 2017 23:49:49 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:41:09 UTC