CSSOM cssText property is missing styles from stylesheet
Categories
(Core :: DOM: CSS Object Model, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox73 | --- | fixed |
People
(Reporter: probablyup, Assigned: nordzilla, Mentored)
Details
(Keywords: good-first-bug, Whiteboard: [lang=rust], [wptsync upstream])
Attachments
(1 file)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.70 Safari/537.36
Steps to reproduce:
- Go to a page and create a style element in head with this content:
<style id="style-test">
.a{border:none;font-size:36px;border-image:linear-gradient(315deg,#fff8c5,#fdb3e4);border-width:3px;border-style:solid;border-image-slice:1;background-color:white;}
</style>
- Go to your console and inspect it:
document.getElementById("style-test").sheet.cssRules[0]
- Notice that .cssText is missing the border-image declaration, but if you access the style property it's actually there:
document.getElementById("style-test").sheet.cssRules[0].style['border-image']
Actual results:
.cssText returns this:
.a { border: 3px solid; font-size: 36px; background-color: white; }
Expected results:
.cssText should return:
.a { border: none; font-size: 36px; border-image: linear-gradient(315deg, #fff8c5, #fdb3e4); border-width: 3px; border-style: solid; border-image-slice: 1; background-color: white; }
Comment 1•4 years ago
|
||
Bugbug thinks this bug should belong to this component, but please revert this change in case of error.
Comment 2•4 years ago
|
||
Yeah, this is clearly a bug.
The border
shorthand always resets border-image, etc, to its initial value: https://searchfox.org/mozilla-central/rev/8b7aa8af652f87d39349067a5bc9c0256bf6dedc/servo/components/style/properties/shorthands/border.mako.rs#147
But it doesn't check whether those properties are initial when serializing back: https://searchfox.org/mozilla-central/rev/8b7aa8af652f87d39349067a5bc9c0256bf6dedc/servo/components/style/properties/shorthands/border.mako.rs#182
Should be a pretty easy bug to fix, we effectively need to add a check like:
% for name in "outset repeat slice source width".split():
if self.border_image_${name} != border_image_${name}::get_initial_specified_value() {
return Ok(());
}
% endfor
Somewhere around here.
And add a regression test if there's none of course.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 3•4 years ago
|
||
Updated•4 years ago
|
Pushed by btara@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e31cda624e1b Check for border-image-* initial specified values when serializing border shorthand r=emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/20590 for changes under testing/web-platform/tests
Comment 6•4 years ago
|
||
bugherder |
Can't merge web-platform-tests PR due to failing upstream checks: Github PR https://github.com/web-platform-tests/wpt/pull/20590 * Community-TC (pull_request) (https://community-tc.services.mozilla.com/tasks/groups/CqRSQ6FfQmeaUHCTqbO0IQ)
Upstream PR was closed without merging
Upstream PR merged by moz-wptsync-bot
Description
•