W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2009

[whatwg] boolean attributes in javascript

From: Brian Kuhn <bnkuhn@gmail.com>
Date: Tue, 8 Dec 2009 14:59:25 -0800
Message-ID: <335a812d0912081459h2875f701q6af50f402453787e@mail.gmail.com>
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.htm>
Received on Tuesday, 8 December 2009 14:59:25 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:54 UTC