Comments (16)
closest is good for elements.matches
.
from object-fit.
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.
from object-fit.
Using closest
will a little increase performance.
from object-fit.
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?
from object-fit.
I meant cdn libs or copying directly in project folder.
from object-fit.
Also add rAF to bower, please.
from object-fit.
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.
from object-fit.
@anselmh Are you sure you need el.closest, not el.matches? closest polyfills both.
from object-fit.
And rAF is not devDep
from object-fit.
Closest is not devDependency too.
from object-fit.
Nice! I asked Jonathan Neal to publish closest on npm.
from object-fit.
@anselmh Closest added to npm
https://www.npmjs.com/package/element-closest
from object-fit.
@anselmh Are you sure you need el.closest instead of el.matches? closest polyfills both.
from object-fit.
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.
from object-fit.
@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.
from object-fit.
@anselmh Prefomance, heh))
from object-fit.
Related Issues (20)
- Initialise polyfill repeatedly HOT 8
- Firefox 17.0.6 script not responding HOT 4
- Does this also work with videos? HOT 12
- IE11 crashes because of css crawling HOT 1
- Issues with object-fit: cover and html5 videos on Project Spartan/Microsoft Edge browser HOT 1
- Can you use multiple css selectors? HOT 4
- Does not respond to height set inside media queries. HOT 4
- IE9 not working HOT 1
- Doesn't seem to work as expected HOT 2
- Missing 'scale-down`
- Not working in IE11 HOT 8
- Not working in Firefox 35 HOT 1
- Object-fit replaces classes on image HOT 5
- Tests not working in IE9 HOT 1
- Not working in Microsoft Edge HOT 2
- Doesn't work? HOT 1
- Warn developers about usage HOT 3
- Drop auto-detection for explicit usage HOT 3
- Alternative fallback HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from object-fit.