Repository navigation
Conversation
jQuery 4 removed $.camelCase and $.support.cors, creates .data() objects
without a prototype, and returns the value of a boolean attribute from
.attr() instead of its name. That broke several widgets:
- igHtmlEditor threw "$.camelCase is not a function" while creating its
toolbars, so it never rendered. Camel-case the option name with a
regular expression instead.
- igToolbar called hasOwnProperty on an element's .data() object, which
threw whenever the HTML editor disabled a toolbar item. Call
Object.prototype.hasOwnProperty instead.
- $.ig.util.ajax sent every request with crossDomain: false, because
$.support.cors was undefined. jQuery then added X-Requested-With, so
cross-origin requests needed a CORS preflight. Default to true, the
value $.support.cors had in every browser jQuery 4 supports.
- .attr() returns "" for a boolean attribute written without a value, so
igCombo ignored <select multiple>, the editors ignored disabled and
readonly in the markup, and igCheckboxEditor ignored checked. Check for
the attribute with .is("[name]"), which works the same on jQuery 3 and 4.
Update the tests to run on jQuery 4: use $.ig.util.getType instead of
$.type and String.prototype.trim instead of $.trim, check boolean
attributes for presence instead of comparing their values, patch the
vendored jquery.simulate, which used $.camelCase, and let [ID22] run
without $.trim. Add tests for $.ig.util.ajax without $.support.cors and
for boolean attributes without a value.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jQuery UI 1.14 sets $.uiBackCompat to false by default, so the button widget ignores the icons and text options igZoombar passed. The scroll buttons rendered without their icon element, and clicking them did not move the zoom window, because the click handler checks that element's class to tell left from right. jQuery 4 needs jQuery UI 1.14.2 or later, but this also affects jQuery 3 with jQuery UI 1.14. Pass icon and showLabel, the options jQuery UI 1.12 and later use, and keep icons and text for jQuery UI 1.11 and earlier. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jQuery UI 1.14 removed ui/core.js, so loading infragistics.core-lite.js or infragistics.lob-lite.js through AMD or a bundler failed with "Can't resolve 'jquery-ui/ui/core'". jQuery 4 needs jQuery UI 1.14.2 or later, so this also kept those users off jQuery 4. The headers already list the jQuery UI modules the bundles use. ui/core only added modules nothing in src/js uses (disable-selection, form, ie, labels, plugin, safe-active-element, safe-blur, scroll-parent, unique-id), so removing it changes nothing on jQuery UI 1.12 and 1.13. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- package.json and bower.json now allow jQuery 4. The lockfile still installs jQuery 3.7.1. - jquery-mockjax 2.6.0 called $.isFunction, $.isArray and $.parseJSON. 2.7.0 supports jQuery 4. - Karma loaded jQuery UI 1.13.0 from code.jquery.com instead of the jquery-ui package, which ships a bundle in dist/. Load it from node_modules and require 1.14.2, the first release tested with jQuery 4. - jquery.tmpl (beta1, from ajax.microsoft.com) calls jQuery.isArray and jQuery.trim. The data source filtering, paging and sorting tests only used it to render their data, so render it with $.ig.tmpl, skipping empty records as jquery.tmpl did, and stop loading jquery.tmpl. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The build job only tests the jQuery version in package-lock.json, which is 3.7.1. Add a job that installs jQuery 4.1 without saving it and runs the same Karma suite, so changes that break jQuery 4 show up in pull requests. The job skips the igZoombar tests for now: the charts scripts they load from the CDN call $.type, which jQuery 4 removed. Drop the --testPath argument once the charts package no longer calls it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment on lines
+43
to
+62
| name: Test on jQuery 4.1 | ||
|
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v7 | ||
| - name: Use Node.js 20.x | ||
| uses: actions/setup-node@v7 | ||
| with: | ||
| node-version: 20.x | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| - name: Install jQuery 4.1 | ||
| run: | | ||
| npm install --no-save jquery@4.1 | ||
| npm ls jquery | ||
| # Skips the igZoombar tests: the charts scripts they load from the CDN | ||
| # call $.type, which jQuery 4 removed. Remove the --testPath argument | ||
| # once the charts package no longer calls it. | ||
| - run: npx karma start --single-run --testPath 'unit/!(zoombar)/**' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2304
Part of #2291
Additional information (check all that apply):
Checklist:
README.MDWhat changed
Everything #2304 lists that is in this repository, plus four problems that only showed up when the Karma suite ran on jQuery 4.1.0. Five commits, easiest to review one at a time.
1.
fix(*): support jQuery 4(245c1ae)From the issue:
_createToolbarscalled$.camelCase, so the editor threw while it was created. It now camel-cases the option name with the same regular expression.$.ig.util.ajax:$.support.corsis gone, so every request went out withcrossDomain: false; jQuery then addsX-Requested-With, which makes a cross-origin request need a preflight. It now defaults totrue, the value$.support.corshad in every browser jQuery 4 supports.Not in the issue, found by running the suite on jQuery 4.1.0:
_getWidgetTypecalledhasOwnPropertyon an element's.data()object. jQuery 4 creates those objects without a prototype, so it threw whenever igHtmlEditor disabled a toolbar item, and every igHtmlEditor test failed. It now callsObject.prototype.hasOwnProperty..attr()returns the value of a boolean attribute instead of its name, and the value is""when the attribute is written without one. igCombo ignored<select multiple>, the editors ignoreddisabledandreadonlyin the markup, and igCheckboxEditor ignoredchecked. They now test for the attribute with.is("[name]"), which gives the result jQuery 3's.attr()gave, on every version.Tests:
$.typeis replaced with$.ig.util.getTypeand$.trimwithString.prototype.trim; the vendoredjquery.simulateno longer calls$.camelCase;[ID22]runs without$.trim; 17 assertions that compared.attr("disabled")or.attr("readonly")with"disabled"/"readonly"now test for the attribute. New tests:[ID23]for$.ig.util.ajaxwithout$.support.cors, and an editors test for boolean attributes written without a value.2.
fix(zoombar): render the scroll buttons on jQuery UI 1.14(eed12c1)jQuery UI 1.14, which jQuery 4 needs, sets
$.uiBackCompattofalseby default, so the button widget ignores theiconsandtextoptions igZoombar passed. The scroll buttons rendered without their icon element, and clicking them did not move the zoom window, because the click handler checks that element's class. This also affects jQuery 3 with jQuery UI 1.14. igZoombar now passesiconandshowLabelas well, and keeps the old options for jQuery UI 1.11 and earlier. No other module insrc/jsuses an option or API that jQuery UI 1.14 moved behind$.uiBackCompat.3.
fix(build): drop jquery-ui/ui/core from the bundle AMD headers(12716bb)jQuery UI 1.14 removed
ui/core.js, so loadinginfragistics.core-lite.jsorinfragistics.lob-lite.jsthrough AMD or a bundler failed withCan't resolve 'jquery-ui/ui/core'.ui/coreonly loaded other modules, and the headers already list the onessrc/jsuses. #2291 reports this for@infragistics/ignite-ui-full, which is built separately and needs the same change there, so this PR is part of #2291.4.
chore(*): allow jQuery 4 and update the test dependencies for it(18371d8)package.json:jqueryis^3.7.1 || ^4.0.0. The lockfile still installs 3.7.1, so the default setup and the existing CI job do not change.bower.json:^3.1.1 || ^4.0.0, was pinned to3.1.1. The publishedbuild/packages/package.jsonalready hasjquery: >=1.9.1as a peer dependency and is unchanged.jquery-mockjax^2.7.0: 2.6.0 called$.isFunction,$.isArrayand$.parseJSON.jquery-ui^1.14.2, the first release tested with jQuery 4. Karma loads it fromnode_modules/jquery-ui/distinstead of 1.13.0 from code.jquery.com, so the suite now runs on jQuery UI 1.14.2.jQuery.isArrayandjQuery.trim. The data source filtering, paging and sorting tests only used it to render their data. They now use$.ig.tmpl, skipping empty records as jquery.tmpl did, and Karma no longer loads jquery.tmpl.bower.jsondropsjquery-tmpl.5.
ci: run the tests on jQuery 4.1 too(ab78ccc)A second job installs
jquery@4.1withnpm install --no-saveand runs the same Karma suite. It skips the igZoombar tests with--testPath 'unit/!(zoombar)/**', because the charts scripts they load from the CDN call$.type. That fix belongs to the charts package and is being done there; once it ships, drop the--testPathargument.Verified
npx grunt hint:32 files lint free.1504tests,1 FAILED, igVideoPlayer test 50, which also fails onmaster(see fix(*): replace $.trim, which jQuery 4 removed #2302 #2303) and passed in other runs of this branch.node_modules/jquery:$.type is not a functionin the CDN charts scripts); with$.typeput back in a local experiment, all 21 pass on jQuery 4.1.0. The other two depend on order or timing: igUpload[ID4] igUpload SINGLE MODE resource test finish filealso fails when the upload tests run alone withmaster's jQuery UI 1.13.0 and mockjax 2.6.0, and igDataSource "Test binding to remote - error", which waits 500 ms for a real 404, passed in 2 of 3 runs on its own.npm install --no-save jquery@4.1, thennpx karma start --single-run --testPath 'unit/!(zoombar)/**':Executed 1483 of 1483 SUCCESS.[ID23]with the old$.support.corsline (jQuery 3.7.1), and the boolean attribute test with the old editors code on jQuery 4.1.0 (thedisabledoption staysfalse). igCombo[ID13] Multiple selection on <select multiple> elementfailed on jQuery 4.1.0 before the combo change.Not verified
infragistics.core-lite.jsandinfragistics.lob-lite.jsthrough an AMD loader or a bundler. I checked the headers by searchingsrc/jsfor the modulesui/coreloaded, but did not build the lite bundles and load them.iconsandtextoptions kept for it.node_modules/jquery; with the lockfile's 3.7.1 nothing changes for them, but they would not work on jQuery 4. Not changed here.infragistics.dvcommonwidget.js) is outside this repository; see commit 5.🤖 Generated with Claude Code