Is setting a boolean attribute to true valid?
From the video, I see this sets the attribute value to the string 'true' in the DOM. According to the HTML specification
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.
And XML specifications accept only the full attribute name.
I understand all major browsers will accept attribute
='true', and I wouldn't stop anyone from doing it; however, an exercise is trying to make me put
.attr('download', true) when the standards indicate otherwise. The
download attribute is somewhat odd, since it's not even boolean:
The download attribute, if present, indicates that the author intends the hyperlink to be used for downloading a resource. The attribute may have a value; the value, if any, specifies the default file name that the author recommends for use in labeling the resource in a local file system.
Compliant web-browsers would offer the name 'true' for the file to save. As a separate matter, that exercise may need some attention.
Rob AllessiTreehouse Staff
Thanks, Luis! We'll look into it. We're currently on a company retreat, so this investigation will likely be delayed until next week.