Bug 75538

Summary: Adding stylesheet rules with shorthand properties automatically expands them
Product: WebKit Reporter: Kevin Haggerty <splatcol>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: davidbarr, menard, rniwa, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Mac (Intel)   
OS: OS X 10.7   
URL: http://jsbin.com/ececop/2/edit#javascript,live

Description Kevin Haggerty 2012-01-04 04:47:04 PST
I came across some inconsistent behavior in Safari 5.1 and latest WebKit nightly regarding Javascript-inserted CSS style rules that have shorthand notation.

My application allows users to design and style DOM elements, and I am creating style rules and inserting them into document style sheets.  When I save the user's work, I read the style rules from the style sheet, and send them to the server for storage.  However, once I started auto-compacting properties that can be expressed in shorthand notation, I discovered that WebKit is automatically expanding those shorthand rules, so that the output from reading a style rule is not what I passed in.

Reduced test case is here:  http://jsbin.com/ececop/2/edit#javascript,live

You can see there that once the style rule with shorthand is written to a style sheet, the single shorthand property is expanded to 4 separate properties for each of the border-width declarations.  While not a 'breaking' bug, this is radically increasing the size of the stylesheets that my application is creating (imagine that all border properties are expanded and repeated for multiple keyframes over multiple styles, and multiplied again for the @-moz-keyframe and prefix-free @keyframe rules).

Firefox 7 does not exhibit this behavior.

Would love to have this fixed somehow, thanks WebKit Folk!
Comment 1 Tony Chang 2012-01-05 12:19:32 PST
I think there might already be a bug for this.
Comment 2 David Barr 2012-02-15 19:29:11 PST

*** This bug has been marked as a duplicate of bug 73002 ***