Skip to content
This repository was archived by the owner on Oct 8, 2021. It is now read-only.

Commit 4782044

Browse files
committed
Forms: hide the native clear button on IE 10 when JQM clear button is visible on text inputs. Fixes #5756 - Textinput in IE10 has a default clear icon
1 parent 130968f commit 4782044

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

css/structure/jquery.mobile.forms.textinput.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ input::-moz-placeholder, textarea::-moz-placeholder { color: #aaa; }
2626
/* Resolves issue #5131: Width of textinput depends on its type, for Android 4.1 */
2727
input[type=number]::-webkit-outer-spin-button { margin: 0; }
2828

29+
/* Resolves issue #5756: Textinput in IE10 has a default clear icon */
30+
input[data-clear-btn=true]::-ms-clear { display: none; }
31+
2932
@media all and (min-width: 28em){
3033
.ui-field-contain label.ui-input-text { vertical-align: top; display: inline-block; width: 20%; margin: 0 2% 0 0 }
3134
.ui-field-contain input.ui-input-text,

tests/unit/textinput/textinput_core.js

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,26 @@
8989
test( "data-clear-btn does not add clear button to textarea", function() {
9090
ok( ! $( "#textarea-clear-btn" ).next().is( "a.ui-input-clear" ), "data-clear-btn does not add clear button to textarea" );
9191
});
92-
92+
93+
test( "data-clear-btn does not add native clear button to input button (IE10)", function() {
94+
// Get an input element, initial height, and reserve d for height difference
95+
var e = $( "input[data-clear-btn='true']" ),
96+
h = e.height(), d;
97+
98+
e.addClass("msClear");
99+
e.val("some text").focus();e.val("some text").focus();
100+
// Avoid syntax errors
101+
try {
102+
document.styleSheets[0].addRule(".msClear::-ms-clear", "height: 100px");
103+
} catch (o) {
104+
ok( true, "browser does not have the native feature for a test");
105+
return true;
106+
}
107+
108+
// If the pseudo-element exists, our height should be much larger
109+
d = e.height() > h;
110+
111+
ok( !d, "native clear button is still visible" + d );
112+
});
113+
93114
})(jQuery);

0 commit comments

Comments
 (0)