Re: [whatwg] boolean attributes in javascript

2010-03-24 Thread Ian Hickson
On Tue, 8 Dec 2009, Brian Kuhn wrote: > > How do I correctly set a boolean attribute on a DOM element object in > Javascript? Content attribute or IDL attribute? > var script = document.createElement('script'); > > script.async = true; For IDL attributes, this is the way to do it. > To me, b

Re: [whatwg] boolean attributes in javascript

2009-12-08 Thread Brian Kuhn
Thanks Tab, and everyone else. This has been enlightening! On Tue, Dec 8, 2009 at 3:22 PM, Tab Atkins Jr. wrote: > Some clarification is in order; I didn't answer fully and was > corrected elsewhere. > > There are two distinct notions of attributes here. The first, the > "content attribute",

Re: [whatwg] boolean attributes in javascript

2009-12-08 Thread Garrett Smith
On Tue, Dec 8, 2009 at 4:49 PM, Dean Edwards wrote: > On 08/12/2009 23:04, Garrett Smith wrote: >> >> Setting an attribute to the empty string may have the effect of >> removing the attribute in some browsers. > > Which browsers/properties? > s/removing the attribute/setting a false value. Try s

Re: [whatwg] boolean attributes in javascript

2009-12-08 Thread Dean Edwards
On 08/12/2009 23:04, Garrett Smith wrote: Setting an attribute to the empty string may have the effect of removing the attribute in some browsers. Which browsers/properties? -dean

Re: [whatwg] boolean attributes in javascript

2009-12-08 Thread Thomas Broyer
On Tue, Dec 8, 2009 at 8:49 PM, Brian Kuhn wrote: > How do I correctly set a boolean attribute on a DOM element object in > Javascript? > var script = document.createElement('script'); > > script.async = true;        // makes the most sense, but appears go against > the spec > script.async = 'true

Re: [whatwg] boolean attributes in javascript

2009-12-08 Thread Markus Ernst
Tab Atkins Jr. schrieb: On Tue, Dec 8, 2009 at 3:48 PM, Brian Kuhn wrote: but it's invalid to set it to anything other than the two values I just mentioned. That's the part I'd like to see changed. I understand that if it's present, it's on. So, why can't async="true" be valid? I think al

Re: [whatwg] boolean attributes in javascript

2009-12-08 Thread Tab Atkins Jr.
Some clarification is in order; I didn't answer fully and was corrected elsewhere. There are two distinct notions of attributes here. The first, the "content attribute", is what you're manipulating when you do foo.setAttribute() or foo.getAttribute(). The second, the "IDL attribute" (may be call

Re: [whatwg] boolean attributes in javascript

2009-12-08 Thread Garrett Smith
On Tue, Dec 8, 2009 at 1:41 PM, Tab Atkins Jr. wrote: > On Tue, Dec 8, 2009 at 1:49 PM, Brian Kuhn wrote: >> How do I correctly set a boolean attribute on a DOM element object in >> Javascript? >> var script = document.createElement('script'); >> >> script.async = true;        // makes the most s

Re: [whatwg] boolean attributes in javascript

2009-12-08 Thread Brian Kuhn
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." wrot

Re: [whatwg] boolean attributes in javascript

2009-12-08 Thread Tab Atkins Jr.
On Tue, Dec 8, 2009 at 3:48 PM, Brian Kuhn wrote: >>  but it's invalid to set it to anything other than the two values I just >> mentioned. > > That's the part I'd like to see changed.  I understand that if it's present, > it's on.  So, why can't async="true" be valid?  I think all browser vendors

Re: [whatwg] boolean attributes in javascript

2009-12-08 Thread Brian Kuhn
> but it's invalid to set it to anything other than the two values I just mentioned. That's the part I'd like to see changed. I understand that if it's present, it's on. So, why can't async="true" be valid? I think all browser vendors will implement it that way anyway. They'd be crazy not to.

Re: [whatwg] boolean attributes in javascript

2009-12-08 Thread Tab Atkins Jr.
On Tue, Dec 8, 2009 at 1:49 PM, Brian Kuhn wrote: > How do I correctly set a boolean attribute on a DOM element object in > Javascript? > var script = document.createElement('script'); > > script.async = true;        // makes the most sense, but appears go against > the spec > script.async = 'true

[whatwg] boolean attributes in javascript

2009-12-08 Thread Brian Kuhn
How do I correctly set a boolean attributeon a DOM element object in Javascript? var script = document.createElement('script'); 1. script.async = true;// makes the most sense, but appears go against the spec 2. script