W3C home > Mailing lists > Public > whatwg@whatwg.org > August 2012

[whatwg] DOMTokenList enable

From: Erik Arvidsson <arv@chromium.org>
Date: Wed, 1 Aug 2012 14:07:12 -0700
Message-ID: <CAJ8+GohWa14nPe5zqou5_71bS468tYrJHbjVd4V26pdghhfbew@mail.gmail.com>
To: whatwg <whatwg@lists.whatwg.org>
Most JS libraries has a way to add or remove a class name based on a
boolean parameter.

I'm suggesting we add a way to do this to DOMTokenList. The semantics
would be the same as the following pure JS implementation.

DOMTokenList.prototype.enable = function(name, value) {
  value ? this.add(name) : this.remove(name);
};

-- 
erik
Received on Wednesday, 1 August 2012 21:08:00 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:48:09 GMT