You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
645 B
23 lines
645 B
export const registClassFun = (Element) => { |
|
Element.registerFunction('addClass', function (classList) { |
|
var self = this; |
|
BI.each(classList.split(' '), (i, cls) => { |
|
if (cls && !self.classMap[cls]) { |
|
self.classList.push(cls); |
|
} |
|
cls && (self.classMap[cls] = true); |
|
}); |
|
return this; |
|
}); |
|
|
|
Element.registerFunction('removeClass', function (classList) { |
|
var self = this; |
|
BI.each(classList.split(' '), (i, cls) => { |
|
if (cls && self.classMap[cls]) { |
|
delete self.classMap[cls]; |
|
self.classList.splice(self.classList.indexOf(cls), 1); |
|
} |
|
}); |
|
return this; |
|
}); |
|
};
|
|
|