[whatwg] DOMTokenList enable

Erik Arvidsson arv at chromium.org
Wed Aug 1 14:07:12 PDT 2012


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


More information about the whatwg mailing list