This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 14234 - Rules for parsing non-negative integers should re-use rules for parsing signed integers and add a >= 0 check
Summary: Rules for parsing non-negative integers should re-use rules for parsing signe...
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
Depends on:
Reported: 2011-09-21 22:47 UTC by Mounir Lamouri
Modified: 2011-10-20 22:17 UTC (History)
8 users (show)

See Also:


Description Mounir Lamouri 2011-09-21 22:47:33 UTC
It would make things easier for everyone: increase readability, reduce chances of errors, of inconsistency, ...
In addition, it would fix the following bug in the specs:
"-0" is currently considered as an invalid value according at the rules for parsing non-negative integers which means if "-0" is set to a content attribute, the IDL attribute should return the default value. This is not what implementations I've tested (Presto, Webkit, Gecko) seem to do: "-0" is parsed as "0".
Comment 1 Ian 'Hixie' Hickson 2011-10-20 22:15:06 UTC
Do you have any test cases showing your tests? Opera and IE seem to do what the spec says for Refresh, Opera does what the spec says for <canvas width>...

Sample tests:
<meta http-equiv="Refresh" content="-0;URL=/">
x<canvas width=-0></canvas>x
<table><tr><td rowspan="-0"></table><script>w(document.getElementsByTagName('td')[0].rowSpan)</script>

Anyway, it does seem like at least some browsers do the -0 == 0 thing and the +2 == 2 for each of the things I tested, and in some cases all do, so I changed the spec as you suggest.

EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter's comments.
Comment 2 contributor 2011-10-20 22:17:43 UTC
Checked in as WHATWG revision r6717.
Check-in comment: Simplification in the microsyntax parsing rules, which makes non-negative integers accept leading - and + characters (- only for -0 of course).