[whatwg] boolean attributes in javascript

Brian Kuhn bnkuhn at gmail.com
Tue Dec 8 14:59:25 PST 2009


I can accept that.  It's just a shame that true and false can't be supported
for something called a boolean attribute.

Anyone have any thoughts on setAttribute vs. setting the attribute
directly?  My test show that they both work.

Thanks,
     Brian

On Dec 8, 2009 1:57 PM, "Tab Atkins Jr." <jackalmage at gmail.com> wrote:

On Tue, Dec 8, 2009 at 3:48 PM, Brian Kuhn <bnkuhn at gmail.com> wrote: >>  but
it's invalid to set it ...
Indeed, async="true" does set it to be on.  However, so does
async="false", async="off", async="no", and any other string you can
think of that might imply that it's turned off.  Setting it to *any*
value turns it on, so it's best to avoid values that would lead to
confusing results.  The two values that are currently valid are the
minimum necessary, and neither have antonyms that would confuse
people.

~TJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20091208/e54eb488/attachment-0002.htm>


More information about the whatwg mailing list