improved caching and use subclassed Arrays for classList #1

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants

No description provided.

fearphage added some commits Feb 8, 2011

});
-})();
+// detech mutation support
+div.addEventListener('DOMAttrModified'
@wyuenho

wyuenho Feb 15, 2014

Contributor

Breaks IE8.

-window.DOMTokenList = DOMTokenList;
+// IE doesn't maintain the length of subclassed arrays but we don't need it
+DOMTokenList.prototype = new Array;
@wyuenho

wyuenho Feb 15, 2014

Contributor

DOMTokenList is not an array. DOMTokenList only has a length property. This implementation is not spec conformant.

- }
+ this.push.apply(this, el.className.split(regex));
+ // cache it if we can
+ if (mutationSupported) {
@wyuenho

wyuenho Feb 15, 2014

Contributor

Why do you need to cache anything? this._element.className is a perfectly good cache.

+ setToClassName(this._element, this);
+ },
+ contains: function(token) {
+ return this.indexOf(token) != -1;
@wyuenho

wyuenho Feb 15, 2014

Contributor

Breaks IE8.

Contributor

wyuenho commented Feb 15, 2014

#29 supercedes this.

@remy remy closed this Dec 27, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment