• Hi,

    If I use a3 Lazy Load, the w3c HTML validator is an error such that “Bad value for attribute srcset on element img: Must contain one or more image candidate strings”.

    Are there any solutions to fix this problem?

    Thank you,

Viewing 3 replies - 1 through 3 (of 3 total)
  • I have same problem. I think problem in file class-a3-lazy-load.php

    				$replaceHTML = '';
    				$replaceHTML = preg_replace( '/<img(.*?)src=/is', '<img$1src="' . $this->_placeholder_url . '" data-lazy-type="image" data-src=', $imgHTML );
    				$replaceHTML = preg_replace( '/<img(.*?)srcset=/is', '<img$1srcset="" data-srcset=', $replaceHTML );
    

    But what to do next, I have not come up with.

    I commented string with number 400 and i don’t have any errors. I don’t know this is right or wrong, but it’s working

    $replaceHTML = preg_replace( '/<img(.*?)srcset=/is', '<img$1srcset="" data-srcset=', $replaceHTML );

    • This reply was modified 5 years, 10 months ago by xelontmp.
    • This reply was modified 5 years, 10 months ago by xelontmp.
    • This reply was modified 5 years, 10 months ago by xelontmp.

    Great plugin!

    But I have the same issues with w3tc validator. And Google loves clean code… !

    @a3rev @nguyen Tuan
    Could you please incorporate the fix above or find even a better solution, if the solution from @xelontmp is not working?

    Best
    Tom

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘W3C Validator Error’ is closed to new replies.