Skip to content

Commit 65f991e

Browse files
committed
Selector: Fix :text pseudo-class & skip MutationObserver tests in IE 9
1 parent b4b10f3 commit 65f991e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/selector.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1269,7 +1269,14 @@ Expr = jQuery.expr = {
12691269
},
12701270

12711271
text: function( elem ) {
1272-
return nodeName( elem, "input" ) && elem.type === "text";
1272+
var attr;
1273+
return nodeName( elem, "input" ) && elem.type === "text" &&
1274+
1275+
// Support: IE <10 only
1276+
// New HTML5 attribute values (e.g., "search") appear
1277+
// with elem.type === "text"
1278+
( ( attr = elem.getAttribute( "type" ) ) == null ||
1279+
attr.toLowerCase() === "text" );
12731280
},
12741281

12751282
// Position-in-collection

test/unit/selector.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1672,7 +1672,7 @@ QUnit.test( "context", function( assert ) {
16721672
// IE/Edge don't support the :scope pseudo-class so they will trigger MutationObservers.
16731673
// The test is skipped there.
16741674
QUnit[
1675-
( QUnit.isIE || /edge\//i.test( navigator.userAgent ) ) ?
1675+
( document.documentMode || /edge\//i.test( navigator.userAgent ) ) ?
16761676
"skip" :
16771677
"test"
16781678
]( "selectors maintaining context don't trigger mutation observers", function( assert ) {
@@ -1965,6 +1965,10 @@ QUnit.test( "jQuery.uniqueSort", function( assert ) {
19651965
}
19661966
};
19671967

1968+
// Trigger a dummy query to reset the document to the default one as in 3.x
1969+
// that matters for the sorting order.
1970+
jQuery( "#qunit-fixture" );
1971+
19681972
jQuery.each( tests, function( label, test ) {
19691973
var length = test.length || test.input.length;
19701974
// We duplicate `test.input` because otherwise it is modified by `uniqueSort`

0 commit comments

Comments
 (0)