Loading ...
Sorry, an error occurred while loading the content.

Re: `rgba` is unrecognized

Expand Messages
  • Douglas Crockford
    ... Thanks. Please try it now.
    Message 1 of 3 , Jan 19, 2010
    View Source
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, Mike West <mike@...> wrote:
      >
      > JSLint doesn't appear to recognize the (relatively new) `rgba` syntax
      > for defining colors with alpha channels. Specifically:
      >
      > @charset "UTF-8";
      >
      > div {
      > background: rgb( 0, 0, 0 );
      > background: rgba( 0, 0, 0, 0.5 );
      > }
      >
      > gives the following errors:
      >
      > Error:
      > Problem at line 5 character 21: Unexpected token 'rgba'.

      Thanks. Please try it now.
    • Mike West
      On Tue, Jan 19, 2010 at 6:31 PM, Douglas Crockford ... Wow, quick turnaround! Works wonderfully. In the meantime, I ve made another mistake regarding RGBA
      Message 2 of 3 , Jan 19, 2010
      View Source
      • 0 Attachment
        On Tue, Jan 19, 2010 at 6:31 PM, Douglas Crockford
        <douglas@...> wrote:

        >> JSLint doesn't appear to recognize the (relatively new) `rgba` syntax
        >> for defining colors with alpha channels.  Specifically:
        >
        > Thanks. Please try it now.


        Wow, quick turnaround! Works wonderfully. In the meantime, I've made
        another mistake regarding RGBA that JSLint might catch: the last
        parameter must be a decimal between 0 and 1, but it's easy to forget
        and try to use a percentage...

        I've updated http://gist.github.com/281085 to show a possible way to
        approach throwing warnings for this parameter. Using the following
        test data, it seems to work well, throwing warnings for the last two
        rules:

        @charset "UTF-8";

        div {
        background: rgb( 0, 0, 0 );
        background: rgba( 0, 0, 0, 0.5 );
        background: rgba( 0, 0, 0, 255 );
        background: rgba( 0, 0, 0, 0.5% );
        }

        Thanks!

        -Mike
      Your message has been successfully submitted and would be delivered to recipients shortly.