- From: Xidorn Quan via GitHub <sysbot+gh@w3.org>
- Date: Thu, 02 Mar 2017 23:49:42 +0000
- To: public-css-archive@w3.org
Easy: get the specified value via CSSOM, which is the value before
cascading. e.g.
```html
<!DOCTYPE html>
<div style="background: none"></div>
<script>
var elem = document.querySelector('div');
alert(elem.style.backgroundColor);
</script>
```
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
```html
<!DOCTYPE html>
<div style="background: none; background-size: 10px;
background-position: initial;"></div>
<script>
var elem = document.querySelector('div');
alert(elem.style.backgroundPosition); // -> "initial"
elem.style.cssText = elem.style.cssText;
alert(elem.style.backgroundPosition); // -> "0% 0%"
</script>
```
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
https://github.com/w3c/csswg-drafts/issues/1068#issuecomment-283820452
using your GitHub account
Received on Thursday, 2 March 2017 23:49:49 UTC