The audio element is an HTML5 element, so you should familiarize yourself with the HTML5 drafts regarding its meaning. In this case, see the definition of logical attributes in the developer version of the WHATWG project. It actually says: a) that the presence or absence of an attribute determines whether the value of the DOM attribute is true or false , and b) as a requirement for documents, the value should be empty or (case insensitive) the attribute name, in this case loop='' or loop="loop" . The use of quotation marks around a value is defined elsewhere.
Thus, browsers should recognize loop=false in the same way as loop=loop or loop=true , but authors should not use such constructions, and HTML5 checkers generate error messages.
(Basically, you should only use loop in serializing HTML HTML5 and loop="loop" in serializing XHTML.)
So, if you have an x variable in JavaScript with an audio element object as its value, x.loop is true or false , while x.attributes['loop'].value indicates the value used in the HTML markup (which usually not interesting as such).
This is another complication regarding Firefox: it still does not support the loop attribute (see HTML5 Audio Looping question). This means that if you set, for example, loop="loop" , x.attributes['loop'].value will be loop , but Firefox does not even set x.loop (i.e. it is undefined ), however it implements functionality.
source share