premailer / css_parser

Ruby CSS Parser
Other
279 stars 110 forks source link

Fix use of inital value for background-position in shorthand. #78

Closed ehlertij closed 7 years ago

ehlertij commented 7 years ago

The use of the initial keyword as the value for the background-position in the background shorthand is causing the CSS to be invalid (at least in every browser I was able to test). Using the stated default of 0% 0% instead resolves the issue.

You can see the issue in action in this Codepen. Open the inspector to see the broken CSS:

screen shot 2016-11-28 at 12 54 19 pm

My company ran into the issue after upgrading to the latest version of the gem and had to roll it back to before this was introduced as a result. Issue was introduced in #65 and #66.

Let me know if you need anything else from me on this one.

Update:

According to this page on MDN, it appears that initial is not a valid value for the shorthand:

<position> = [[ left | center | right | top | bottom | <length-percentage> ] | [ left | center | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ] | [ center | [ left | right ] <length-percentage>? ] && [ center | [ top | bottom ] <length-percentage>? ]]

(notice how initial does not appear)

grosser commented 7 years ago

@mitio @mkigikm does this look good ?

mitio commented 7 years ago

@grosser Looks good to me.

ehlertij commented 7 years ago

Thanks guys, I appreciate the quick response to this one!

grosser commented 7 years ago

released as v1.4.7