webcompat / css-fixme

A script that adds standardised equivalents to CSS declarations that uses only prefixed code
https://www.webcompat.com/tools/cssfixme
Mozilla Public License 2.0
9 stars 3 forks source link

CSSfixme throws if given a -webkit-gradient expression with a bogus color-stop #14

Closed dholbert closed 8 years ago

dholbert commented 8 years ago

STR:

  1. Open your Browser Console (ctrl shift J)
  2. Visit http://hallvord.com/temp/moz/cssfixme.php and paste in the following CSS:

    .a { background-image: -webkit-gradient(linear, 1 1, 2 2, 3); }

    ...and press the button.

  3. Check your Browser Console.

ACTUAL RESULTS: TypeError: position is undefined cssfixme.php:431:1

We're trying to parse 3 as a color-stop() expression there, and failing.

Rejecting bad input is reasonable, but throwing is bad, because it prevents later unprefixing. E.g. if you had this slightly-longer CSS... .a { background-image: -webkit-gradient(linear, 1 1, 2 2, 3); -webkit-transition: length } ...then we fail to suggest an unprefixed form of the the -webkit-transition property, because we threw when processing the earlier gradient expression.

hallvors commented 8 years ago

The commit message was perhaps a bit unspecific - should have read "don't add presumed fixed code if parsing/interpreting an invalid gradient declaration causes an exception" or something like that..