NOTE: The current preferred location for bug reports is the GitHub issue tracker.
Bug 972 - Source code both validators are wrong and differ from the correct source code of Firefox
Source code both validators are wrong and differ from the correct source code...
Status: RESOLVED INTENTIONAL
Product: Validator.nu
Classification: Unclassified
Component: General
HEAD
All All
: P2 normal
Assigned To: Nobody
http://www.onions-potatoes.com/the-ne...
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-13 20:43 CEST by Alexander
Modified: 2013-04-19 16:55 CEST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander 2013-04-13 20:43:46 CEST
I render the "width" attribute of an image in PHP like this:
width=\"".$width_out."\"
The variable $width_out is calculated and passed the PHP function round() to get rid of the decimals.
When I validate the page with both validators (also validator.nu) the follwoing error message is generated:
<<<<
 Line 462, Column 156: Bad value -2 for attribute width on element img: Expected a digit but saw - instead.

…/index-images/money.jpg" width="-2" height="1"  alt="m" title="Index: m" /></a>

Syntax of non-negative integer:
    One or more digits (0–9). For example: 42 and 0 are valid, but -273 is not. 
<<<
But rightclick mouse source code gives :
<<<<<<<<<<<<
index-images/money.jpg" width="257"
<<<<<<<<<<<
With other words the correct value for $width_out,
Your validators source code is different to firefox's source code. 
I tried the function intval() and number-format(), no results.
The only way to trick your validator to validate my page is using:
str_replace ('-','',$width_out)
But your validators source code keeps on rendering the number 2 instead of 257!
The renders well in both caes. I am just curious what this is.
Alexander
Comment 1 Michael[tm] Smith 2013-04-13 21:47:37 CEST
The page http://www.onions-potatoes.com/the-new-english-page/index.php appears to validate without errors now. Do you have another URL or file that demonstrates the problem?
Comment 2 Alexander 2013-04-14 16:12:22 CEST
Michael,
I have removed the "trick" from the width attribute of the images, so now you will find 9 errors on my index page. I will leave like that for a while.
Please inform me if you find something. I am curious.
Alexander
Comment 3 Henri Sivonen 2013-04-19 16:55:06 CEST
The page has changed no longer to say width="-2". It now says width="100%", which is invalid per spec, too.