Bugzilla – Bug 15047
Common microsyntaxes parsing rules allow non-numeric trailing characters
Last modified: 2011-12-03 03:55:24 UTC
The rules defined in section 2.5.4 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.
The related sections are:
184.108.40.206 Non-negative integers 
220.127.116.11 Signed integers 
18.104.22.168 Real numbers 
22.214.171.124 Percentages and lengths 
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">.
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:
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.