jquery / jquery

jQuery JavaScript Library
https://jquery.com
MIT License
58.96k stars 20.62k forks source link

Selector: Make `selector.js` module depend on `attributes/attr.js` #5384

Closed mgol closed 4 months ago

mgol commented 5 months ago

Summary

This fixes custom builds using the --include switch that don't include the attributes module.

Note: as of this change, jQuery.expr.match.bool is no longer defined.

Fixes gh-5379

Checklist

mgol commented 5 months ago

The size report for this is pretty surprising...

main @e8b7db4b0f1e1b8e08578641b30a92b955ccc4ec
   raw     gz Filename
   -51    +51 dist/jquery.min.js
   -47     +8 dist/jquery.slim.min.js
   -51    +51 dist-module/jquery.module.min.js
   -47    +10 dist-module/jquery.slim.module.min.js

I could use some gzip magic from @gibson042 here. 😉

mgol commented 5 months ago

After the latest changes:

main @e8b7db4b0f1e1b8e08578641b30a92b955ccc4ec
   raw     gz Filename
   -68    +37 dist/jquery.min.js
   -64    -10 dist/jquery.slim.min.js
   -68    +37 dist-module/jquery.module.min.js
   -64     -8 dist-module/jquery.slim.module.min.js

+37 bytes is still significant for something that in theory should remove bytes.

mgol commented 4 months ago

OK, without the addition of a dependency on attributes/attr.js to selector.js the size difference is as follows:

main @e8b7db4b0f1e1b8e08578641b30a92b955ccc4ec
   raw     gz Filename
   -51    -13 dist/jquery.min.js
   -51    -25 dist/jquery.slim.min.js
   -51    -16 dist-module/jquery.module.min.js
   -51    -25 dist-module/jquery.slim.module.min.js

so it looks this part is to blame.