Question

What happens when there is a script tag with a defer attribute, no src or async attribute, and nothing inside it, as in:

<script type="text/javascript" defer="defer"></script>

As far as I understand it, defer simply tells the page it can keep rendering while this script tag loads; the spec says it should be used when the tag has an src attribute, not when it has JavaScript inside it, but what about when it has nothing inside it AND no src attribute? Why would someone want that?

This is from my school. It is on a Moodle page, version 1, not sure of minor version, so the page would be huge & change a lot based on who's logged in, etc.; please tell me what other source code you need to answer the question.

EDIT I wasn't very clear on what I'm asking. I know what happens in this situation, but I'm asking WHY someone would want it to happen this way. It seems useless to have a defer attribute with no JavaScript code to defer, so I'm wondering whether there are some side effects a website designer (circa 5-10 years ago) could use.

Was it helpful?

Solution

As Moodle is a big site, with many pages, it is possible that defer attribute is useful on some pages, but they put it on all the pages, even ones that don't need it. Other than that, I can not think of a reason for it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top