Skip to content
Browse files

Remove usage of innerText and removal of carriage retruns in getText.…

… Fixes jQuery bug #11153.
  • Loading branch information...
1 parent fe2f618 commit feebbd7e053bff426444c7b348c776c99c7490ee @timmywil committed Mar 30, 2012
Showing with 4 additions and 7 deletions.
  1. +4 −7 sizzle.js
View
11 sizzle.js
@@ -13,7 +13,6 @@ var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[
hasDuplicate = false,
baseHasDuplicate = true,
rBackslash = /\\/g,
- rReturn = /\r\n/g,
rNonWord = /\W/;
// Here we check if the JavaScript engine is using some sort of
@@ -339,15 +338,13 @@ var getText = Sizzle.getText = function( elem ) {
if ( nodeType ) {
if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
- // Use textContent || innerText for elements
- if ( typeof elem.textContent === 'string' ) {
+ // Use textContent for elements
+ // innerText usage removed for consistency of new lines (see #11153)
+ if ( typeof elem.textContent === "string" ) {
return elem.textContent;
- } else if ( typeof elem.innerText === 'string' ) {
- // Replace IE's carriage returns
- return elem.innerText.replace( rReturn, '' );
} else {
// Traverse it's children
- for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
+ for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
ret += getText( elem );
}
}

0 comments on commit feebbd7

Please sign in to comment.
Something went wrong with that request. Please try again.