Closed TrySound closed 9 years ago
For "copy-lib" you may build bundle. For package managers build just core file and maybe getMatchedCSSRules polyfill. Other polyfills will be loaded as dependencies.
Using closest
will a little increase performance.
Hi, thanks for the suggestions. I agree this could be done and have replaced the rAF polyfill with the one from npm.
I’ll see if I can make use of the closest polyfill and if it makes sense to use it here. Thanks for the hint.
For "copy-lib" you may build bundle. For package managers build just core file and maybe getMatchedCSSRules polyfill. Other polyfills will be loaded as dependencies.
Not sure what you mean here though? Can you explain this a bit more in detail perhaps?
I meant cdn libs or copying directly in project folder.
Also add rAF to bower, please.
Thanks so far for your suggestions. It seems the polyfill is indeed a bit faster now again. I’ll see if I can make the dependency stuff a bit less messy.
@anselmh Are you sure you need el.closest, not el.matches? closest polyfills both.
And rAF is not devDep
Closest is not devDependency too.
Nice! I asked Jonathan Neal to publish closest on npm.
@anselmh Closest added to npm https://www.npmjs.com/package/element-closest
@anselmh Are you sure you need el.closest instead of el.matches? closest polyfills both.
Thanks. Fixed to use the npm version now. Therefore closing this issue for now.
@anselmh Are you sure you need el.closest instead of el.matches? closest polyfills both.
I tested this and it didn’t fail while speeding up the polyfill. That’s why. If there’s any issue with it it’s easy to roll back.
@anselmh It works. But el.closest do some more work. It checks current or finds closest parent element with this selector. Better use el.matches.
@anselmh Prefomance, heh))
You can use external polyfill of requestAnimationFrame. It's a little smaller. And dependencies let the code be smaller.