Bugzilla – Bug 972
Source code both validators are wrong and differ from the correct source code of Firefox
Last modified: 2013-04-19 16:55:06 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
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?
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
The page has changed no longer to say width="-2". It now says width="100%", which is invalid per spec, too.