Comments (3)
Thanks for the report. This is on the main
branch, isn't it? That's code for future jQuery 4.0 which is not stable yet. When building for production use, it's recommended to check out the latest tag and build there.
In jQuery 3.x, the ATTR
filter uses find.attr
:
Line 1057 in 87467a6
defined in the same file:
Lines 853 to 876 in 87467a6
On the main
branch, I removed the selector version and started using jQuery.attr
:
Line 454 in c98597e
which lies outside of this module and this dependency was not made explicit.
Depending on attr.js
is a bit hard because that module depends on selector
itself:
Line 7 in c98597e
but that's mostly an artifact from jQuery 3.x previously depending on
jQuery.find.attr
from the selector module here:Line 68 in 87467a6
while on the
main
branch a native getAttribute
is used:Line 61 in c98597e
We should remove the dependency on selector.js
from attr.js
. As for fixing the selector issue, we have then two options:
- Move from using
jQuery.attr
to the nativegetAttribute
directly - this is more in line with what jQuery 3.x was doing as thefind.attr
wrapper was in most cases deferring to the native method. However, that avoidsattrHooks
for attribute matching which is consulted when using the jQueryattr
method. - Add the dependency on
attr.js
toselector.js
. That will makeattrHooks
respected.
I'm gravitating towards the first option for the following reasons:
- It's more in line with the current
selector
behavior that has been followed for many years. - There are not that many built-in
attrHooks
left on themain
branch. There's one fortype
but that's just for IE and only a setter (selector
only needs getters) and there's one for boolean attributes - this latter one may actually constitute a breaking change as the value for all boolean attributes is always its lowercase name.
from jquery.
Actually, I was wrong about the logic change. Expr.attrHandle
used to be populated in src/attr.js
in 3.x
:
Line 13 in b922eed
Line 13 in b922eed
On the 4.x
line, this has been moved to be a regular member of jQuery.attrHooks
:
Lines 102 to 128 in 99151d7
Thus, the logic is fine, we just need to declare the dependency explicitly.
I submitted removing unneeded selector.js
dependencies in PR #5383, I'll submit a separate one to add the dependency on attr.js
to selector.js
.
from jquery.
PR: #5384
from jquery.
Related Issues (20)
- Cannot read properties of null (reading 'compareDocumentPosition') HOT 3
- Invalid links in blog article HOT 2
- The jquery.factory.js bundle is missing in the npm package in the 4.0.0-beta release HOT 2
- `require( "jquery" )` returns a module object when used with Webpack & jQuery 4.0.0-beta HOT 24
- v4 beta : mottie/tablesorter plugin fails with sort() and trim() missing HOT 1
- Jquery-UI getting Error With jQuery jQuery 4.0.0 BETA! HOT 4
- jQuery.get() 4.0 backward compatibility issue HOT 3
- Permissions policy violation due to unload event HOT 1
- Avoiding JQuery version disclosure on Angular's Script.JS HOT 1
- Scripts in dynamically set html always asynchronously loaded HOT 3
- jQuery 3.7.1 is still making wrong calculation of dimensions in Firefox. HOT 1
- Memory Leak: OriginAnchor HOT 6
- Memory Leak: boxSizingReliable HOT 4
- Triggering after an `alert()` in an event handler results in a JS error HOT 3
- The strange behavior generated by the append method HOT 1
- Avoid counting scroll twice in offset HOT 1
- jQuery Migrate 3.4.0 - elem.focus() is not working HOT 3
- Issue or behaviour??? - 2.2.3 to 3.6.0 - active element changed on focus. HOT 2
- Issue using JQuery 3.7.1 and CSP HOT 2
- Jquery Vite installation doesnt work. HOT 1
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 jquery.