blob: 4bb8510549da3d3ec8e37f695d2f404017ae4e93 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
//order:0 - Must be loaded before anything else.
/* classList.toggle() */
(function() {
var historic = DOMTokenList.prototype.toggle;
DOMTokenList.prototype.toggle = function(token, force) {
if(arguments.length > 0 && this.contains(token) === force) {
return force;
}
return historic.call(this, token);
};
})();
/* Element.matches() and Element.closest() */
if(!Element.prototype.matches)
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
if(!Element.prototype.closest)
Element.prototype.closest = function(s) {
var el = this;
if(!document.documentElement.contains(el)) return null;
do {
if(el.matches(s)) return el;
el = el.parentElement || el.parentNode;
} while(el !== null && el.nodeType === 1);
return null;
};
/* NodeList.forEach */
if(window.NodeList && !NodeList.prototype.forEach) {
NodeList.prototype.forEach = Array.prototype.forEach;
}
|