Closed tomByrer closed 10 years ago
1% is still a heck of a lot of people - I don't think anyone should remove -moz for a long time.
Since -ms and -o weren't ever in production, it makes sense to remove them.
Unrolling the loop makes sense to me as well.
1% is still a heck of a lot of people
Might not be that many; FF9-22 + Firefox:Android 26? Not like I'd kill those browsers, just offer a very slightly less performant version of the 'manual' rAF. Seems earlier versions of FF were bugged, so this version is stronger than most others that poll mozRequestAnimationFrame. How does this look @ljharb ?
if ( window.webkitRequestAnimationFrame ) { // Chrome <= 23, Safari <= 6.1, Blackberry 10
window.requestAnimationFrame = window[ 'webkitRequestAnimationFrame' ];
window.cancelAnimationFrame = window[ 'webkitCancelAnimationFrame' ] || window[ 'webkitCancelRequestAnimationFrame' ];
return window.requestAnimationFrame
}
if ( window.mozCancelRequestAnimationFrame) { // Firefox9-22 & Ff:Android 26, Ff4?-8 ships without cancel support
window.requestAnimationFrame = window[ 'mozRequestAnimationFrame' ];
window.cancelAnimationFrame = window[ 'mozCancelAnimationFrame' ];
return window.requestAnimationFrame
}
Without the unnecessary spaces inside the brackets, that looks fine :-p
I copy pasted from another repo that I patched; followed his style :)
Good catch! Thanks for the contribution. I'm -0 on unrolling the loop -- since it's evaluated once, ever, it shouldn't be a perf issue.
Merged and published as v2.0.0; went the paranoid route with semver in this case. Thanks again!
Welcome!
since it's evaluated once, ever, it shouldn't be a perf issue.
I agree. Another PR for almost the same lib we only checked for webkitRequestAnimationFrame
& not moz, so a loop for 1 array-deep was overkill ;)
They were just beta prefixes, never in production. Paul Irish removed them as well. I'm tempted to remove -moz- since that is 1% of browser share.
Could unroll the loop also.