BOM as a whitespace #722

Closed
wants to merge 1 commit into
from
Jump to file
+15 −3
Split
View
@@ -913,9 +913,21 @@ if ( jQuery.browser.webkit ) {
}
// IE doesn't match non-breaking spaces with \s
-if ( rnotwhite.test( "\xA0" ) ) {
- trimLeft = /^[\s\xA0]+/;
- trimRight = /[\s\xA0]+$/;
+if ( rnotwhite.test ( "\xA0" ) ) {
sindresorhus
sindresorhus Apr 1, 2012 Contributor

Wrong style. Please read the jQuery Core Style Guidelines.

Correct:
if ( rnotwhite.test("\xA0") ) {

Also applies to the other if statements.

curiousdannii
curiousdannii Apr 2, 2012

The original is wrong too then ;)

dmethvin
dmethvin Apr 2, 2012 Owner

@rwldrn did we decide to remove the style exception for spaces around quotes within parens? TBH they have always confused me too; I know there was some recent discussion.

rwaldron
rwaldron Apr 2, 2012 Member

@dmethvin Correct, we switched to no spaces around single string args.

Krinkle
Krinkle Apr 4, 2012 Member

There shouldn't be a space before the arguments list: ".test("

rwaldron
rwaldron Apr 4, 2012 Member

Please update to match the latest style guide, thank you!

+ // BOM is not a whitespace in EcmaScript 3
+ if ( rnotwhite.test ("\uFEFF") ) {
+ trimLeft = /^[\s\xA0\uFEFF]+/;
+ trimRight = /[\s\xA0\uFEFF]+$/;
+ } else {
+ trimLeft = /^[\s\xA0]+/;
+ trimRight = /[\s\xA0]+$/;
+ }
+} else {
+ // BOM is not a whitespace in EcmaScript 3
+ if ( rnotwhite.test ( "\uFEFF" ) ) {
+ trimLeft = /^[\s\uFEFF]+/;
+ trimRight = /[\s\uFEFF]+$/;
+ }
}
// All jQuery objects should point back to these