W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2010

[whatwg] Treatment of negative values for li

From: Aryeh Gregor <Simetrical+w3c@gmail.com>
Date: Thu, 12 Aug 2010 16:24:14 -0400
Message-ID: <AANLkTi=Fuw1KNCTDG3uyeQx8whwLX+eCwX34T5RFA_ex@mail.gmail.com>
The HTML5 spec doesn't say UAs should treat <li value="-1"> different
from a negative value specified for any long.  For example, a get on
the reflected attribute li.value should return "-1".  In this test

<!doctype html>
    var el = document.createElement("li");
    el.setAttribute("value", "-1");

Chrome dev, Safari 5, and Opera 10.60 all alert "-1" as expected, but
Firefox 4.0b3 and IE8/9 (all modes) alert "0".  In fact, Firefox and
IE clamp all negative values to 0.  Does anyone think this behavior is
valuable, or should Firefox and IE change to match the spec?  I don't
see any reason to treat negative values specially, if the author goes
out of their way to specify them.

Relatedly, only Opera seems to handle markup like

<!doctype html>
    <li value="-2">...
    <li value="-1">...
    <li value="0">...
    <li value="1">...

correctly.  IE8 and WebKit give 1, 2, 3, 1 (treating nonpositive value
attribute the same as if it were missing), and Firefox gives 0, 0, 0,
1 (clamping negative values to 0).  Opera gives -2, -1, 0, 1 as
expected.  Again, I think the spec is correct here, but since browsers
disagree so widely, I'm asking for opinions before I file bugs against
Received on Thursday, 12 August 2010 13:24:14 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:26 UTC