Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2012-07-10 Thread Ian Hickson
On Wed, 2 May 2012, Rick Waldron wrote: On Wed, May 2, 2012 at 7:17 PM, Ian Hickson i...@hixie.ch wrote: On Wed, 2 May 2012, Rick Waldron wrote: JS APIs like this should always return the object (constructed instance or not) and therefore chain implicitly. Let me rephrase, I simply

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2012-05-03 Thread Jake Verbaten
Sidetracking whether chaining is a useful API design or not isn't useful. Choosing some mechanism to add multiple classes at once is useful, whether that's making add have an arbitary arity, allow it to take an array, allow it to take a space seperated string or allowing add calls to be chained.

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2012-05-02 Thread Ian Hickson
On Fri, 28 Oct 2011, David H�s�ther wrote: It would be more useful if the DOMTokenList methods (contains, add, remove, toggle) would take a space separated list of tokens. This is the behavior most DOM libraries have when dealing with class names. So, when setting two classes, instead of

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2012-05-02 Thread Rick Waldron
On Wed, May 2, 2012 at 6:13 PM, Ian Hickson i...@hixie.ch wrote: On Fri, 28 Oct 2011, David Håsäther wrote: It would be more useful if the DOMTokenList methods (contains, add, remove, toggle) would take a space separated list of tokens. This is the behavior most DOM libraries have when

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2012-05-02 Thread Ian Hickson
On Wed, 2 May 2012, Rick Waldron wrote: On Wed, May 2, 2012 at 6:13 PM, Ian Hickson i...@hixie.ch wrote: On Fri, 28 Oct 2011, David H�s�ther wrote: It would be more useful if the DOMTokenList methods (contains, add, remove, toggle) would take a space separated list of tokens. This is

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2012-05-02 Thread Anne van Kesteren
On Wed, 02 May 2012 15:41:07 -0700, Ian Hickson i...@hixie.ch wrote: On Wed, 2 May 2012, Rick Waldron wrote: Adding 1 class at a time is a _very_ common pattern in real world web development. As mentioned above, this API has now moved to DOM Core. If you still want this I recommend filing a

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2012-05-02 Thread Rick Waldron
On Wednesday, May 2, 2012 at 6:41 PM, Ian Hickson wrote: On Wed, 2 May 2012, Rick Waldron wrote: On Wed, May 2, 2012 at 6:13 PM, Ian Hickson i...@hixie.ch wrote: On Fri, 28 Oct 2011, David Håsäther wrote: It would be more useful if the DOMTokenList methods (contains, add,

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2012-05-02 Thread Ian Hickson
On Wed, 2 May 2012, Rick Waldron wrote: JS APIs like this should always return the object (constructed instance or not) and therefore chain implicitly. I understand that this is mostly a matter of taste in API design, but IMHO that's an anti-pattern. It encourages poor style; it discourages

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2012-05-02 Thread Rick Waldron
On Wed, May 2, 2012 at 7:17 PM, Ian Hickson i...@hixie.ch wrote: On Wed, 2 May 2012, Rick Waldron wrote: JS APIs like this should always return the object (constructed instance or not) and therefore chain implicitly. Let me rephrase, I simply expect modern DOM APIs to return something

[whatwg] DOMTokenList methods would be more useful with a space separated token list

2011-10-28 Thread David Håsäther
It would be more useful if the DOMTokenList methods (contains, add, remove, toggle) would take a space separated list of tokens. This is the behavior most DOM libraries have when dealing with class names. So, when setting two classes, instead of ele.classList.add(hey); ele.classList.add(ho);

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2011-10-28 Thread Philip Jägenstedt
On Fri, 28 Oct 2011 12:58:01 +0200, David Håsäther hasat...@gmail.com wrote: It would be more useful if the DOMTokenList methods (contains, add, remove, toggle) would take a space separated list of tokens. This is the behavior most DOM libraries have when dealing with class names. So, when

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2011-10-28 Thread Mike Taylor
On Fri, Oct 28, 2011 at 11:52 AM, Philip Jägenstedt phil...@opera.comwrote: On Fri, 28 Oct 2011 12:58:01 +0200, David Håsäther hasat...@gmail.com wrote: It would be more useful if the DOMTokenList methods (contains, add, remove, toggle) would take a space separated list of tokens. This is

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2011-10-28 Thread Aryeh Gregor
On Fri, Oct 28, 2011 at 12:07 PM, Mike Taylor michaelaarontay...@gmail.com wrote: I would prefer if it returned the DOMTokenList, to enable chaining like:   foo.toggle('bar baz').remove('bat'); Same for the rest of the DOMTokenList methods, as well.   foo.add('bar').remove('baz'); See

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2011-10-28 Thread Jonas Sicking
On Fri, Oct 28, 2011 at 9:42 AM, Aryeh Gregor a...@aryeh.name wrote: On Fri, Oct 28, 2011 at 12:07 PM, Mike Taylor michaelaarontay...@gmail.com wrote: I would prefer if it returned the DOMTokenList, to enable chaining like:   foo.toggle('bar baz').remove('bat'); Same for the rest of the

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2011-10-28 Thread Ojan Vafai
On Fri, Oct 28, 2011 at 1:23 PM, Jonas Sicking jo...@sicking.cc wrote: On Fri, Oct 28, 2011 at 9:42 AM, Aryeh Gregor a...@aryeh.name wrote: On Fri, Oct 28, 2011 at 12:07 PM, Mike Taylor michaelaarontay...@gmail.com wrote: I would prefer if it returned the DOMTokenList, to enable chaining

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2011-10-28 Thread Tab Atkins Jr.
On Fri, Oct 28, 2011 at 1:55 PM, Ojan Vafai o...@chromium.org wrote: I agree in general. Changing add/remove is definitely worth doing. In the case of toggle, WebKit already returns a boolean. Returning the DOMTokenList is clearly preferable IMO. It's a new enough API that maybe the web doesn't

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2011-10-28 Thread Ojan Vafai
On Fri, Oct 28, 2011 at 2:03 PM, Glenn Maynard gl...@zewt.org wrote: On Fri, Oct 28, 2011 at 4:55 PM, Ojan Vafai o...@chromium.org wrote: I agree in general. Changing add/remove is definitely worth doing. In the case of toggle, WebKit already returns a boolean. Returning the DOMTokenList

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2011-10-28 Thread Glenn Maynard
On Fri, Oct 28, 2011 at 4:55 PM, Ojan Vafai o...@chromium.org wrote: I agree in general. Changing add/remove is definitely worth doing. In the case of toggle, WebKit already returns a boolean. Returning the DOMTokenList is clearly preferable IMO. It's a new enough API that maybe the web

Re: [whatwg] DOMTokenList methods would be more useful with a space separated token list

2011-10-28 Thread Boris Zbarsky
On 10/28/11 4:55 PM, Ojan Vafai wrote: I agree in general. Changing add/remove is definitely worth doing. In the case of toggle, WebKit already returns a boolean Gecko likewise. -Boris