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

Re: validitity of CSS z-index increments

Expand Messages
  • pauanyu
    According to the W3C and MDC, z-index is either auto or an integer. The integer can be positive or negative, but if it is positive, it does not need the plus
    Message 1 of 8 , Jan 28, 2010
    • 0 Attachment
      According to the W3C and MDC, z-index is either "auto" or an integer. The integer can be positive or negative, but if it is positive, it does not need the plus sign. `z-index: +1` and `z-index: 1` should be equivalent; however the former is invalid, and the latter is valid.

      --- In jslint_com@yahoogroups.com, Simon Kenyon Shepard <simon.shepard@...> wrote:
      >
      > Hi,
      >
      > A developer in my team is using the CSS code: z-index:+1; to increment the
      > z-index of an element by one. This fails the JSLint validator, I cannot seem
      > to find any documentation on this practice. Does anyone know anything about
      > it, whether it is valid and if it should pass Jslint?
      >
      > Thanks
      >
      > Simon
      >
      > --
      > "We are the music makers, And we are the dreamers of dreams"
      >
      >
      > [Non-text portions of this message have been removed]
      >
    • Aseem
      Everyone seems to have missed what Simon said specifically (emphasis mine): A developer in my team is using the CSS code: z-index:+1; to _increment_ the
      Message 2 of 8 , Jan 28, 2010
      • 0 Attachment
        Everyone seems to have missed what Simon said specifically (emphasis mine): "A developer in my team is using the CSS code: z-index:+1; to _increment_ the z-index of an element by one."

        As others have noted in previous replies, setting z-index to +1 is equivalent to setting it to just 1. That is, the + says "positive" as opposed to "negative". It does _not_ imply increment.

        In other words, it is indeed technically valid, and arguably JSLint should be accepting it, but your developer is using it with the wrong intent.

        As far as I know, there's no way to increment the z-index using standard CSS.

        Aseem

        --- In jslint_com@yahoogroups.com, "pauanyu" <pcxunlimited@...> wrote:
        >
        > According to the W3C and MDC, z-index is either "auto" or an integer. The integer can be positive or negative, but if it is positive, it does not need the plus sign. `z-index: +1` and `z-index: 1` should be equivalent; however the former is invalid, and the latter is valid.
        >
        > --- In jslint_com@yahoogroups.com, Simon Kenyon Shepard <simon.shepard@> wrote:
        > >
        > > Hi,
        > >
        > > A developer in my team is using the CSS code: z-index:+1; to increment the
        > > z-index of an element by one. This fails the JSLint validator, I cannot seem
        > > to find any documentation on this practice. Does anyone know anything about
        > > it, whether it is valid and if it should pass Jslint?
        > >
        > > Thanks
        > >
        > > Simon
        > >
        > > --
        > > "We are the music makers, And we are the dreamers of dreams"
        > >
        > >
        > > [Non-text portions of this message have been removed]
        > >
        >
      • Douglas Crockford
        ... Part of JSLint s mission is to save us from confusion. In this instance, JSLint did exactly the right thing.
        Message 3 of 8 , Jan 28, 2010
        • 0 Attachment
          --- In jslint_com@yahoogroups.com, "Aseem" <aseem.kishore@...> wrote:
          >
          > Everyone seems to have missed what Simon said specifically (emphasis mine): "A developer in my team is using the CSS code: z-index:+1; to _increment_ the z-index of an element by one."
          >
          > As others have noted in previous replies, setting z-index to +1 is equivalent to setting it to just 1. That is, the + says "positive" as opposed to "negative". It does _not_ imply increment.
          >
          > In other words, it is indeed technically valid, and arguably JSLint should be accepting it, but your developer is using it with the wrong intent.
          >
          > As far as I know, there's no way to increment the z-index using standard CSS.



          Part of JSLint's mission is to save us from confusion. In this instance, JSLint did exactly the right thing.
        • Dominic Mitchell
          ... +1 ! -Dom [Non-text portions of this message have been removed]
          Message 4 of 8 , Jan 29, 2010
          • 0 Attachment
            On Thu, Jan 28, 2010 at 6:02 PM, Douglas Crockford <douglas@...>wrote:

            > Part of JSLint's mission is to save us from confusion. In this instance,
            > JSLint did exactly the right thing.
            >

            +1 !

            -Dom


            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.