addClass, hasClass utility methods
This commit is contained in:
parent
06e0c90d75
commit
7e9d530f98
@ -54,6 +54,18 @@ L.DomUtil = {
|
||||
this._onselectstart = null;
|
||||
},
|
||||
|
||||
CLASS_RE: /(\\s|^)'+cls+'(\\s|$)/,
|
||||
|
||||
hasClass: function(el, name) {
|
||||
return (el.className.length > 0) &&
|
||||
new RegExp("(^|\\s)" + name + "(\\s|$)").test(el.className);
|
||||
},
|
||||
|
||||
addClass: function(el, name) {
|
||||
if (!L.DomUtil.hasClass(el, name)) {
|
||||
el.className += (el.className ? ' ' : '') + name;
|
||||
}
|
||||
},
|
||||
|
||||
//TODO refactor away this ugly translate/position mess
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user