]> source.dussan.org Git - jquery.git/commit
Deprecated: Improve $.trim performance for strings with lots of whitespace
authorVladimir Sitnikov <sitnikov.vladimir@gmail.com>
Wed, 20 Jul 2022 08:51:13 +0000 (11:51 +0300)
committerGitHub <noreply@github.com>
Wed, 20 Jul 2022 08:51:13 +0000 (10:51 +0200)
commit699401008fbc6cdfc5d6a1d531e1bc5013a94bec
treec9cfb47a214b08cd69d02f626f2715cf784378e7
parent410d5cf0c3d0d92b2e9abd7fe0b16eb79c9a2a51
Deprecated: Improve $.trim performance for strings with lots of whitespace

Regex imp implementation takes `O(N^2)` time to trim the string when
multiple adjacent spaces were present.

The new expression require that the "whitespace run" starts from
a non-whitespace to avoid `O(N^2)` behavior when the engine would
try matching `\s+$` at each space position.

Closes gh-5068
src/deprecated.js