1. 17 10月, 2023 1 次提交
    • M
      Build: Run pretest before test:* npm scripts · 1ad66aeb
      Michał Gołębiowski-Owczarek 提交于
      Build was already happening in scripts like `test:browser` but those scripts
      were missing `pretest`, meaning that running `npm install && npm test:browser`
      may have failed if `pretest` wasn't run before or if its results were out of
      date.
      
      Even worse, with such stale data some tests may erroneously succeed.
      
      This also removes a separate `pretest` step from GitHub Actions as it's no
      longer needed.
      
      Closes gh-5338
      1ad66aeb
  2. 22 9月, 2023 2 次提交
  3. 21 9月, 2023 5 次提交
  4. 20 9月, 2023 4 次提交
    • M
      CSS:Selector: Align with 3.x, remove the outer `selector.js` wrapper · 53cf7244
      Michał Gołębiowski-Owczarek 提交于
      Bring some changes from `3.x-stable`:
      * rename `rtrim` to `rtrimCSS` to distinguish from the previous `rtrim`
        regex used for `jQuery.trim`
      * backport one `id` selector test that avoids the selector engine path
      
      Other changes:
      * remove the inner function wrapper from `selector.js` by renaming
        the imported `document.js` value
      * use `jQuery.error` in `selectorError`
      * make Selector tests pass in all-modules runs by fixing a sinon mistake
        in Core tests - Core tests had a spy set up for `jQuery.error` that wasn't
        cleaned up, influencing Selector tests when all were run together
      
      Closes gh-5295
      53cf7244
    • M
      Core: Add more info about named exports · 5f869590
      Michał Gołębiowski-Owczarek 提交于
      Also, fix an example importing from `jquery/src/css.js` as that is supposed
      to use named exports now.
      
      Closes gh-5328
      5f869590
    • M
      Core: Simplify code post browser support reduction · 93ca49e6
      Michał Gołębiowski-Owczarek 提交于
      Summary of the changes:
      * Core: Simplify code post browser support reduction
      * Tests: Remove legacy jQuery.cache & oldIE leftovers
      * Tests: Reformat JavaScript in delegatetest.html
      * Docs: "jQuery Foundation Projects" -> "jQuery Projects"
      * Tests: Drop an unused localfile.html file (modern browsers don't support
        the `file:` protocol this way, there's no point in keeping the file around)
      * Effects: Remove a redundant `!fn` check (`fn || !fn && easing` is equivalent
        to `fn || easing`; simplify the code)
      * CSS: Explain the fallback to direct object access in curCSS better
      * Tests: Deduplicate `jQuery.parseHTML` test titles
      * Dimensions: Add a test for fractional values
      * Tests: Fix a buggy WebKit regex
      
      Closes gh-5296
      93ca49e6
    • M
      Core: Move the factory to separate exports · 46f6e3da
      Michał Gołębiowski-Owczarek 提交于
      Since versions 1.11.0/2.1.0, jQuery has used a module wrapper with one strange
      addition - in CommonJS environments, if a global `window` with a `document` was
      not present, jQuery exported a factory accepting a `window` implementation and
      returning jQuery.
      
      This approach created a number of problems:
      1. Properly typing jQuery would be a nightmare as the exported value depends on
         the environment. In practice, typing definitions ignored the factory case.
      2. Since we now use named exports for the jQuery module version, it felt weird
         to have `jQuery` and `$` pointing to the factory instead of real jQuery.
      
      Instead, for jQuery 4.0 we leverage the just added `exports` field in
      `package.json` to expose completely separate factory entry points: one for the
      full build, one for the slim one.
      
      Exports definitions for `./factory` & `./factory-slim` are simpler than for `.`
      and `./slim` - this is because it's a new entry point, we only expose a named
      export and so there's no issue with just pointing Node.js to the CommonJS
      version (we cannot use the module version for `import` from Node.js to avoid
      double package hazard). The factory entry points are also not meant for the Web
      browser which always has a proper `window` - and they'd be unfit for an
      inclusion in a regular script tag anyway. Because of that, we also don't
      generate minified versions of these entry points.
      
      The factory files are not pushed to the CDN since they are mostly aimed
      at Node.js.
      
      Closes gh-5293
      46f6e3da
  5. 19 9月, 2023 2 次提交
  6. 12 9月, 2023 1 次提交
    • M
      Core: Use named exports in `src/` · f75daab0
      Michał Gołębiowski-Owczarek 提交于
      The `default` export is treated differently across tooling when transpiled
      to CommonJS - tools differ on whether `module.exports` represents the full
      module object or just its default export. Switch `src/` modules to named
      exports for tooling consistency.
      
      Fixes gh-5262
      Closes gh-5292
      f75daab0
  7. 06 9月, 2023 1 次提交
  8. 25 8月, 2023 1 次提交
  9. 11 8月, 2023 1 次提交
  10. 11 7月, 2023 4 次提交
    • M
      Build: Add `exports` to package.json, export slim & esm builds · 8be4c0e4
      Michał Gołębiowski-Owczarek 提交于
      Summary of the changes:
      * define the `exports` field in `package.json`; `jQuery` & `$` are also
        exported as named exports in ESM builds now
      * declare `"type": "module"` globally except for the `build` folder
      * add the `--esm` option to `grunt custom`, generating jQuery as an ECMAScript
        module into the `dist-module` folder
      * expand `node_smoke_tests` to test the slim & ESM builds and their various
        combinations; also, test both jQuery loaded via a path to the file as well
        as from module specifiers that should be parsed via the `exports` feature
      * add details about ESM usage to the release package README
      * run `compare_size` on all built minified files; don't run it anymore on
        unminified files where they don't provide lots of value
      * remove the remove_map_comment task; SWC doesn't insert the
      `//# sourceMappingURL=` pragma by default so there's nothing to strip
      
      Fixes gh-4592
      Closes gh-5255
      8be4c0e4
    • M
      CSS: Make the reliableTrDimensions support test work with Bootstrap CSS · 65b85031
      Michał Gołębiowski-Owczarek 提交于
      Bootstrap 5 includes the following CSS on the page:
      
      ```css
      *,
      *::before,
      *::after {
        box-sizing: border-box;
      }
      ```
      
      That threw our `reliableTrDimensions` support test off. This change fixes the
      support test and adds a unit test ensuring support test values on a page
      including Bootstrap 5 CSS are the same as on a page without it.
      
      Fixes gh-5270
      Closes gh-5278
      Ref gh-5279
      65b85031
    • M
      Build: Switch form Terser to SWC for JS minification (#5286) · e2421875
      Michał Gołębiowski-Owczarek 提交于
      Also, as part of this, fix the `file` & `sources` properties of the source map
      file.
      
      Fixes gh-5285
      Closes gh-5286
      Ref gh-5258
      e2421875
    • M
      Build: Make sure `*.cjs` & `*.mjs` files use UNIX line endings as well · 198b41c8
      Michał Gołębiowski-Owczarek 提交于
      We've had this rule for `*.js` files so far but we now have two new JS
      extensions.
      
      Closes gh-5290
      198b41c8
  11. 10 7月, 2023 1 次提交
  12. 03 7月, 2023 1 次提交
  13. 28 6月, 2023 3 次提交
  14. 23 6月, 2023 1 次提交
  15. 14 6月, 2023 1 次提交
  16. 13 6月, 2023 2 次提交
    • T
      Core: Fix regression in jQuery.text() on HTMLDocument objects · a75d6b52
      Timo Tijhof 提交于
      Fixes gh-5264
      Closes gh-5265
      
      (cherry picked from commit 44c56f87)
      a75d6b52
    • M
      Selector: Re-expose jQuery.find.{tokenize,select,compile,setDocument} · 338de359
      Michał Gołębiowski-Owczarek 提交于
      `Sizzle.tokenize` is an internal Sizzle API, but exposed. As a result,
      it has historically been available in jQuery via `jQuery.find.tokenize`.
      That got dropped during Sizzle removal; this change restores the API.
      
      Some other APIs so far only exposed on the `3.x` line are also added
      back:
      * `jQuery.find.select`
      * `jQuery.find.compile`
      * `jQuery.find.setDocument`
      
      In addition to that, Sizzle tests have been backported for the following
      APIs:
      * `jQuery.find.matchesSelector`
      * `jQuery.find.matches`
      * `jQuery.find.compile`
      * `jQuery.find.select`
      
      A new test was also added for `jQuery.find.tokenize` - even Sizzle was
      missing one.
      
      Fixes gh-5259
      Closes gh-5263
      Ref gh-5260
      Ref jquery/sizzle#242
      Ref gh-5113
      Ref gh-4395
      Ref gh-4406
      338de359
  17. 01 6月, 2023 3 次提交
    • M
      Build: Switch the minifier from UglifyJS to Terser · 27303c6b
      Michał Gołębiowski-Owczarek 提交于
      UglifyJS is ES5-only, while Terser supports newer ECMAScript versions. jQuery
      is authored in ES5 but jQuery 4.x will also have an ESM build that cannot be
      minified using UglifyJS directly.
      
      We could strip the `export` statement, minify via UglifyJS and re-add one but
      that increases complexity & may not fully play nice with source maps.
      
      On the other hand, switching to Terser increases the minfied size by just 324
      bytes and the minified gzipped one by just 70 bytes. Such differences largely
      disappear among bigger size gains from the `3.x-stable` line - around 2.7 KB
      minified gzipped as of now.
      
      Closes gh-5258
      27303c6b
    • M
      Docs: Remove the "Grunt build" section from the PR template · 988a5684
      Michał Gołębiowski-Owczarek 提交于
      Now that unit tests are run on GitHub Actions in all three major
      engines and for multiple custom jQuery builds, the request for PR
      authors to run unit tests locally and confirm they pass is needless
      overhead; let's drop the checkbox.
      
      Closes gh-5261
      988a5684
    • M
      Build: Make the `eslint:dev` task not lint the `dist/` folder · 44906a83
      Michał Gołębiowski-Owczarek 提交于
      There was a mistake in paths logic that made the `dist/` folder linted
      even in the `eslint:dev` task which is run before the build. Fix that by
      explicitly ignoring the `dist/` folder at the end of the file list.
      
      Closes gh-5257
      44906a83
  18. 23 5月, 2023 1 次提交
  19. 22 5月, 2023 1 次提交
  20. 05 4月, 2023 1 次提交
  21. 04 4月, 2023 3 次提交