You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
jQuery 4: $.trim is not a function in igDataSource, igHtmlEditor and the loader #2302
jQuery 4.0 removed jQuery.trim, which jQuery 3.5 had deprecated. Ignite UI still calls $.trim in 19 places, so with jQuery 4 these code paths throw TypeError: $.trim is not a function. In $.ig.DataSource this breaks binding to a remote URL and local filtering, and with them every control that binds through the data source.
jQuery: 4.1.0. The same code works with jQuery 3.8.0.
Steps to reproduce
Load jQuery 4.x and the Ignite UI data source.
Run:
// Remote data: fails in analyzeDataSourcenew$.ig.DataSource({dataSource: "/api/products",responseDataKey: "d.results"}).dataBind();// Local filtering: fails in _findMatchvards=new$.ig.DataSource({dataSource: [{ID: 1},{ID: 2},{ID: 3}],schema: {fields: [{name: "ID",type: "number"}]}});ds.dataBind();ds.filter([{fieldName: "ID",expr: 2,cond: "greaterThan"}],"AND",true);
Result
Both calls throw TypeError: $.trim is not a function.
Expected result
The same as with jQuery 3.x: the first data source binds without an error, and after the filter ds.dataView() holds only the record with ID 3.
Suggested fix
Replace every $.trim(x) with code that behaves the same on every supported jQuery version, including the way $.trim handles null and undefined (it returns ""):
x==null ? "" : String(x).trim()
A small helper in infragistics.util.js (for example $.ig.util.trim) keeps the call sites short, and also gives the consistent trim calls that #2007 asked for.
Activity
Merge pull request #2303 from IgniteUI/sstoychev/replace-jquery-trim