-
Notifications
You must be signed in to change notification settings - Fork 20.5k
Core: rnotwhite -> rhtmlnotwhite and jQuery.trim -> stripAndCollapse #3316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Renames and changes rnotwhite to focus on HTML whitespace chars - Change internal use of jQuery.trim to more accurate strip and collapse - Adds tests to ensure HTML space characters are retained where valid - Doesn't add tests where the difference is inconsequential and existing tests are adequate. Fixes jquerygh-3003 Fixes jquerygh-3072
|
|
||
| // Strip and collapse whitespace according to HTML spec | ||
| // https://html.spec.whatwg.org/multipage/infrastructure.html#strip-and-collapse-whitespace | ||
| var rhtmlSpace = /[\x20\t\r\n\f]+/g, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you write a regular space ( ) instead of the hex code (\x20)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somehow should be different from [ \t\r\n\v\f] -> \s right? You guys already talked about this I believe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is somehow should be different from [ \t\r\n\v\f] -> \s right?
Right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you give a me a context?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you write a regular space () instead of the hex code (\x20)?
We could, but I like that this is more apparent/explicit. It can be hard to notice a at first glance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dmethvin No, / / doesn't match a tab.
EDIT: Ah, you mean it could be confused by a tab in the code, I see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\x20 for most though, i think, that symbol doesn't immediately associated with
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, in the source it could be a tab. Unlikely, but the \x20 makes it super clear.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooh, i see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found the context, LGTM
- Also add separate var per comment
existing tests are adequate.
Fixes gh-3003
Fixes gh-3072
If needed, a docs issue/PR was created at https://github.com/jquery/api.jquery.com