Skip to content

Latest commit

 

History

History
21 lines (15 loc) · 1.29 KB

File metadata and controls

21 lines (15 loc) · 1.29 KB

4. Don’t Double Boolean Attributes

<script async='async' src='https://www.googletagservices.com/tag/js/gpt.js'></script>

From an Indian website; let’s start with a look at the HTML specification.

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.

The values “true” and “false” are not allowed on boolean attributes. To represent a false value, the attribute has to be omitted altogether.

checked, disabled, selected are popular examples for the Boolean attributes. async is a Boolean attribute, too. Unless you’re truly using and delivering XHTML, doubling these attributes isn’t necessary. Don’t.

The minimum for the sample code is:

<script src=https://www.googletagservices.com/tag/js/gpt.js async></script>