Bug 15047 - Common microsyntaxes parsing rules allow non-numeric trailing characters
Summary: Common microsyntaxes parsing rules allow non-numeric trailing characters
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: All All
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
Depends on:
Reported: 2011-12-02 21:33 UTC by Sylvain Galineau
Modified: 2011-12-03 03:55 UTC (History)
5 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain Galineau 2011-12-02 21:33:18 UTC
The rules defined in section 2.5.4 [1]seem to allow numbers followed by any non-numeric characters i.e. not only is "41  " valid, but so is "41xyz". Both evaluate to 41. A value such as "41q20" would also evaluate to 41. 

This is because what follows the collected sequence of numeric character is never checked.

It is unclear why a sequences of number followed by any non-numeric character should be valid. 


Once the algorithm is done collecting the last numeric sequence and before returning a value, it should:

- Skip whitespace
- If position is *not* past the end of input, return an error.

[1] http://www.w3.org/TR/html5/common-microsyntaxes.html#numbers
Comment 1 Sylvain Galineau 2011-12-02 21:50:40 UTC
The related sections are: Non-negative integers [1] Signed integers [2] Real numbers [3] Percentages and lengths [4] 

[1] http://www.w3.org/TR/html5/common-microsyntaxes.html#non-negative-integers
[2] http://www.w3.org/TR/html5/common-microsyntaxes.html#signed-integers
[3] http://www.w3.org/TR/html5/common-microsyntaxes.html#real-numbers
[4] http://www.w3.org/TR/html5/common-microsyntaxes.html#percentages-and-dimensions
Comment 2 L. David Baron (Mozilla) 2011-12-03 02:30:34 UTC
Isn't it this way because that's how browsers work (interoperably)?  I certainly remember <table border="5"> being the same as <table border="5px"> or <table border="5em"> or <table border="5zzz">.
Comment 3 Ian 'Hixie' Hickson 2011-12-03 03:55:24 UTC
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: Rejected
Change Description: no spec change
Rationale: The rules don't "allow" numbers; and numbers like "41xyz" aren't "valid". However, the parser does handle those errors by ignoring the invalid trailing content. That's intentional, for back compat reasons.