Defering javascript - what is the correct html syntax defer or defer=“defer”

前端 未结 4 702
别跟我提以往
别跟我提以往 2020-12-21 03:10

What is the correct syntax for using the defer attribute in your javascript?

I have seen it done two ways:

1:



        
4条回答
  •  -上瘾入骨i
    2020-12-21 03:37

    HTML 5.1 nightly

    2.4.2 Boolean attributes

    A number of attributes are boolean attributes. The presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value.

    If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace.

    so defer is right, and so is defer="defer" and defer="DeFeR" and defer=""

提交回复
热议问题