Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions sizzle.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,12 @@ var getText = Sizzle.getText = function( elem ) {

if ( nodeType ) {
if ( nodeType === 1 || nodeType === 9 ) {
// Use textContent || innerText for elements
// Use textContent for elements
if ( typeof elem.textContent === 'string' ) {
return elem.textContent;
} else if ( typeof elem.innerText === 'string' ) {
// Replace IE's carriage returns
return elem.innerText.replace( rReturn, '' );
return getText( elem.childNodes ).replace( rReturn, '' );
} else {
// Traverse it's children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
Expand Down
1 change: 1 addition & 0 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ <h2 id="qunit-userAgent"></h2>
</div>
</div>
</dl>
<div id="whitespace" style="position:absolute;width:1px;height:1px;overflow:hidden;">Test &nbsp; This</div>
<div id="fx-test-group" style="position:absolute;width:1px;height:1px;overflow:hidden;">
<div id="fx-queue" name="test">
<div id="fadein" class='chain test' name='div'>fadeIn<div>fadeIn</div></div>
Expand Down
5 changes: 4 additions & 1 deletion test/unit/selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ test("pseudo - child", function() {
});

test("pseudo - misc", function() {
expect(19);
expect(20);

t( "Headers", ":header", ["qunit-header", "qunit-banner", "qunit-userAgent"] );
t( "Has Children - :has()", "p:has(a)", ["firstp","ap","en","sap"] );
Expand Down Expand Up @@ -436,6 +436,9 @@ test("pseudo - misc", function() {

document.body.removeChild( tmp );

var whitespace = document.getElementById("whitespace");
equal( Sizzle.getText( whitespace ), 'Test ' + String.fromCharCode(160) + ' This' );

var input = document.createElement("input");
input.type = "text";
input.id = "focus-input";
Expand Down