Skip to content

getText respects unbreakable whitespace on IE#91

Closed
cyril-sf wants to merge 2 commits intojquery:masterfrom
cyril-sf:11212
Closed

getText respects unbreakable whitespace on IE#91
cyril-sf wants to merge 2 commits intojquery:masterfrom
cyril-sf:11212

Conversation

@cyril-sf
Copy link

This is a regression from jQuery 1.6.4.

@timmywil
Copy link
Member

Carriage returns should continue to be removed to make text consistent across browsers. How does removing carriage returns affect non-breaking spaces? Does it match in IE?

@cyril-sf
Copy link
Author

Actually, I made a mistake, I'm going to fix it. It's not removing carriage returns that fixes the issue, but using nodeValue instead of innerText.

This will look like this

} else if ( typeof elem.innerText === 'string' ) {
// Replace IE's carriage returns
return getText(elem).replace( rReturn, '' );
}

I didn't break any tests, so I didn't realize that my fix removed some useful code.

@timmywil
Copy link
Member

I see. Are you running the Sizzle tests only? iirc, it may have been a test in jQuery. If it's not actually needed, we can remove it, but I'd like to make sure.

@cyril-sf
Copy link
Author

Only the Sizzle tests. I'll check with the jQuery tests and update my commit.

@cyril-sf
Copy link
Author

I ran jQuery tests after having commented the code that removes carriage returns. Nothing broke..

I'm going to keep it anyway to make sure that nothing breaks.

This is a regression from jQuery 1.6.4.
@cyril-sf
Copy link
Author

I have cleaned the branch and kept the code to remove the carriage returns as discussed even though it may not be tested.

@cyril-sf
Copy link
Author

I didn't push the right code in the branch initially, there's one more commit to fix a bug in my changes.

@cyril-sf
Copy link
Author

You can reproduce the bug on IE using this link http://jsfiddle.net/PREjM/5/

@timmywil
Copy link
Member

innerText is no longer used.

@timmywil timmywil closed this Apr 23, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants