Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit a89ae7c

Browse files
committed
Remove {NodeList,NamedNodeMap,HTMLCollection}.forEach, use .array instead
1 parent 2b89598 commit a89ae7c

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/dom.js

+4-12
Original file line numberDiff line numberDiff line change
@@ -43,27 +43,19 @@
4343
oldName && this.remove(oldName);
4444
newName && this.add(newName);
4545
};
46-
47-
// add array() and forEach() to NodeList, NamedNodeMap, HTMLCollection
46+
47+
// add array() to NodeList, NamedNodeMap, HTMLCollection
4848

4949
var ArraySlice = function() {
5050
return Array.prototype.slice.call(this);
5151
};
5252

5353
var namedNodeMap = (window.NamedNodeMap || window.MozNamedAttrMap || {});
54-
54+
5555
NodeList.prototype.array = ArraySlice;
5656
namedNodeMap.prototype.array = ArraySlice;
5757
HTMLCollection.prototype.array = ArraySlice;
5858

59-
var ArrayForEach = function(cb, context) {
60-
ArraySlice.call(this).forEach(cb, context);
61-
};
62-
63-
NodeList.prototype.forEach = ArrayForEach;
64-
namedNodeMap.prototype.forEach = ArrayForEach;
65-
HTMLCollection.prototype.forEach = ArrayForEach;
66-
6759
// polyfill performance.now
6860

6961
if (!window.performance) {
@@ -104,7 +96,7 @@
10496
// utility
10597

10698
function createDOM(inTagOrNode, inHTML, inAttrs) {
107-
var dom = typeof inTagOrNode == 'string' ?
99+
var dom = typeof inTagOrNode == 'string' ?
108100
document.createElement(inTagOrNode) : inTagOrNode.cloneNode(true);
109101
dom.innerHTML = inHTML;
110102
if (inAttrs) {

0 commit comments

Comments
 (0)