• Resolved mmorpglife

    (@mmorpglife)


    When enabling lazy load images in LSCache it generates code at the end of the HTML body. It generates the following opening tag for the javascript tag:

    <script data-no-optimize=”1″ defer>….</script>

    When you put that piece of code through W3 validator it says:

    “Error: Element script must not have attribute defer unless attribute src is also specified.”

    I am not sure why this in-line javascript has the defer boolean, but if it is not needed it should be removed to have web pages pass html validation.

    Code generating this nopn-valid tag is in
    ./src/media.cls.php

    at the end of private function _finalize().

Viewing 5 replies - 1 through 5 (of 5 total)
  • This “error” only occures if a script tag has no src attribute. It would be up to LiteSpeed only to set defer attribute if there is a resource to a file and not an inline ressource.

    Thread Starter mmorpglife

    (@mmorpglife)

    Cache Crawler (@serpentdriver)
    3 days, 20 hours ago
    This “error” only occures if a script tag has no src attribute. It would be up to LiteSpeed only to set defer attribute if there is a resource to a file and not an inline ressource.

    That is why I’m posting this on the litespeed support forum hoping they fix their code and not introduce an inline script with defer attribute without a src attribute.

    I have the same issue. Came here to hopefully find a solution. Adding a comment to keep the thread alive

    @rudebon

    This is not an issue.

    html validation very often relates to an outdated status. The Internet is often faster as any html specification, so you don’t have to care about any hints that code wouldn’t be HTML confirm. It is better to care about your content, because content matters to have success.

    • This reply was modified 2 years, 5 months ago by serpentdriver.
    Plugin Support qtwrk

    (@qtwrk)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘lazy load breaks html validation Element script must not have attribute defer’ is closed to new replies.