Closed Calvein closed 12 years ago
pre-define the methods on load rather than each run-time operation, then we got a pull request.
eg:
var hasClass = features.classList ? function (el, c) {
return el.classList.contains(c)
} : function (el, c) {
return classReg(c).test(el.className)
}
Done (I'll add this to masonry too).
why do you suppose i got something like this from that test page?
Hey guys, what do you think about this implementation:
idea from: https://github.com/rightjs/rightjs-core/blob/master/src/dom/element/styles.js
@ded ClassList is a bit slower than the RegExp on Chrome 15 but a bit faster on Chrome 16/17, in 2 weeks nobody will use Chrome 15 anymore. And it's way faster on Firefox/Opera.
@jots That's nice but it looks like classList will be faster on Firefox/Opera, we may let the classList, it's up to @ded.
It's way faster : http://jsperf.com/classlist-vs-bonzo
I first pull request to the brand new
vanilla-masonry
repo by David DeSandro (https://github.com/desandro/vanilla-masonry/pull/3)