JQuery core transaction code for trim method

Can someone help me understand this commit

What is \ u00A0?

+3
source share
4 answers

Encodes leading and leading space characters in addition to breaking spaces \u00A0- this is a unicode point / code / number / alias for a non-working space. You can open Firebug and enter it.

>>> '\u00A0'
" "

Additional information about this character:

http://www.fileformat.info/info/unicode/char/00a0/index.htm

Edit: I just tried this code in Firebug, which checks for matches from the generated non-decaying space and matches:

javascript:alert( String.fromCharCode(160).match(/\s/) )

, IE6 null, IE, , .

Update # 2 - , , , -.

r = /(\s|\u00A0)+|(\s|\u00A0)+$/g;

s = '  wh  at'

s = s.replace( r, '' )

"what"
+9

, , String.fromCharCode(160) - . , , \s.

+1

. -, ​​ JavaScript- Internet Explorer, \s \u00a0.

+1

, \u0020.

0

Source: https://habr.com/ru/post/1726098/


All Articles