mirror of https://github.com/toddmotto/echo.git
Morozov Andrew
11 years ago
3 changed files with 35 additions and 15 deletions
@ -0,0 +1,21 @@
|
||||
if (!Array.prototype.indexOf) { |
||||
Array.prototype.indexOf = function (element , start) { |
||||
var start = start ? start : 0, length; |
||||
if (!this) { |
||||
throw new TypeError(); |
||||
} |
||||
length = this.length; |
||||
if (length === 0 || start >= length) { |
||||
return -1; |
||||
} |
||||
if (start < 0) { |
||||
start = length - Math.abs(start); |
||||
} |
||||
for (var i = start; i < length; i++) { |
||||
if (this[i] === element) { |
||||
return i; |
||||
} |
||||
} |
||||
return -1; |
||||
}; |
||||
} |
@ -0,0 +1,12 @@
|
||||
if (!document.querySelectorAll && document.createStyleSheet) { |
||||
document.querySelectorAll = function (selector) { |
||||
var all = document.all, result = [], style = document.createStyleSheet(); |
||||
style.addRule(selector, 'fake:fake'); |
||||
for (var i = all.length - 1; i >= 0; i--) { |
||||
if (all[i].currentStyle.fake === 'fake') { |
||||
result.push(all[i]); |
||||
} |
||||
} |
||||
style.removeRule(0); return result; |
||||
} |
||||
} |
Loading…
Reference in new issue