Issue #3554137: Replace jQuery functions removed in jQuery 4, preserving isNumeric() semantics

Follows on from !117.

!117 narrows the isNumeric check: typeof x === 'number' && !isNaN(x) rejects the numeric strings that jQuery.isNumeric() accepted, and accepts Infinity, which it did not. sortBranch() is public API, so a string column index is realistic - under !117 it stops being treated as a column index and is passed on as a comparator, throwing "The comparison function must be either a function or undefined".

This uses jQuery 3.7.1's own implementation instead, so behaviour is unchanged for every input I tested. The only deliberate difference is typeof in place of jQuery.type(), which is also removed in jQuery 4; that diverges only for boxed primitives such as new Number(1), which sortBranch() has no reason to receive.

The trim change from !117 is kept unchanged.

Credit to gueguerreiro, thatguy and bmadhu for the diagnosis and the original patch.

Edited by Mads Nørgaard

Merge request reports

Loading