Comments (2)
Thanks for the report.
Valid HTML documents require IDs to be unique. I understand there are various APIs that work with bad structure, like querySelectorAll
, but jQuery has assumed this rule is followed from the beginning.
Querying by IDs is a very common thing and getElementById
is faster than querySelectorAll
so there was a conscious decision to choose the faster option and not support elements with repeated IDs.
At this point of life of Sizzle, it's not likely anything will change here. You could argue for a change in jQuery 4.0 which will not include Sizzle but I'd be surprised to not see speed difference since getElementById
can just stop scanning the document when it hits a matching ID. Not to mention that it doesn't need to parse the provided string which querySelectorAll
needs to do.
We would definitely need solid benchmarks before changing anything here.
from sizzle.
@mgol I see. Since it's by design I have no intentions to complain 🙂
Thank you for detailed reply
from sizzle.
Related Issues (20)
- Any chance to get jQuery functions .find(), .filter(), .add(), .not() aswell? HOT 3
- Mutation handling breaks querySelectorAll initialization HOT 4
- home page of sizle: documentation link is broken HOT 22
- TypeError: rbuggyQSA.test is not a function HOT 3
- The "Identifier with bad escape" test fails in Firefox 3.6 HOT 1
- Throw a better error when documentElement is missing HOT 1
- cannot find elements with ids that have special characters like /, . HOT 1
- Pushstate to a Hash doesn't update :target HOT 2
- Duplicate __Proto__ property HOT 1
- Why is sizzle loading a script from massehight.com ? HOT 2
- Sizzle Breaks when using the text "(Deprecated)" in a selector name HOT 7
- Is this project Dead ? HOT 5
- Pseudo-selectors named `is` no longer works on Chrome 88 HOT 8
- Unsupported pseudo: visible HOT 2
- upload script adds unwanted new lines HOT 2
- Support Trusted Types HOT 1
- Don't set attributes while querying HOT 3
- is it stable ? HOT 1
- Deprecated `unload` event handler used in `Sizzle.setDocument` HOT 2
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 sizzle.