标签:nbsp type fun str prot rem font func lis
//添加class
DOMTokenList.prototype.adds = function(tokens) {
tokens.split(" ").forEach(function(token) { this.add(token); }.bind(this)); return this; }; var clList = document.body.classList; clList.adds("child1 child2 child3").toString(); // "a b c child1 child2 child3"
//移除class
DOMTokenList.prototype.removes = function(tokens) {
tokens.split(" ").forEach(function(token) {
this.remove(token);
}.bind(this));
return this;
};
var clList = document.body.classList;
clList.removes("child1 child2 child3").toString(); // "a b c child1 child2 child3"
标签:nbsp type fun str prot rem font func lis
原文地址:http://www.cnblogs.com/yanxiaoluo/p/7506274.html