Validator is misidentifying some images as identical

For technical support for all editions of CSS HTML Validator. Includes bug reports.
Post Reply
TomHTML
Rank II - Novice
Rank II - Novice
Posts: 28
Joined: Sun Feb 04, 2018 10:19 am

Validator is misidentifying some images as identical

Post by TomHTML » Sun Mar 18, 2018 10:42 am

Different base64 encoded images are being misidentified as being the same image by the validator, and it is issuing the following warning:
This image has alt text that does not match the previously used alt text for this same image.
What I believe is happening is that the validator is only reading a certain number of characters in the src attribute of an image, and using that substring for comparing one image src to the next. The result is that it's concluding that the images are the same, which they aren't, and is therefore issuing the warning.

Here's a test HTML that should provide the warning messages (it produces them when I run it in the validator). Notice that each base64 image begins the same way, but then ends differently. (I chose this as a simple example where I'm using transparent PNGs of different sizes in a lazyloading routine, where the actual image source is in data-src and is swapped into src by the lazyloader when the image enters the viewport. Other base64 images that are visible but which begin similarly for many characters cause the same warning message to be issued by the validator, which makes me wonder if the validator is only reading a certain number of characters in the src attribute):

Code: Select all

<!DOCTYPE html>
<html lang=en-us>
<head>
	<title>Lazyload Test</title>
</head>
<body class=hg>
	<p><img class=lazyload alt="Lorem ipsum dolor sit amet" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAVoAAADwCAIAAADOwzsdAAAABnRSTlMAAAAAAABupgeRAAAACXBIWXMAAA7EAAAOxAGVKw4bAAABCElEQVR4nO3BMQEAAADCoPVPbQwfoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgb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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4M8AAOsAAeXOoToAAAAASUVORK5CYII=" data-src="Class-aptent.jpg"></p>
</body>
</html>
Also see the attached screen shot.

Many thanks!
Attachments
Untitled.jpg
Untitled.jpg (81.05 KiB) Viewed 382 times

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3363
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: Validator is misidentifying some images as identical

Post by Albert Wiersch » Mon Mar 19, 2018 11:58 am

Thanks for the great report with all the details, sample HTML, and screenshot.

This should be fixed in the next update. I was also able to make some other improvements while looking into this.
Image
Albert Wiersch

TomHTML
Rank II - Novice
Rank II - Novice
Posts: 28
Joined: Sun Feb 04, 2018 10:19 am

Re: Validator is misidentifying some images as identical

Post by TomHTML » Tue Mar 20, 2018 2:52 pm

Excellent! Many thanks!

Post Reply