Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Issue #3081: Range inputs on dialogs don't degrade

The degradeInputs plugin bails early for pages that do not have
data-role="page". This behavior prevented range inputs (for slider widgets)
from degrading properly when used in dialogs.

Updated degradeInputs unit tests to check dialogs, too.
  • Loading branch information...
commit a8c04855b4c18399a453a84cb4dd802e3a66cdce 1 parent a9d9ca3
@eromba eromba authored
View
2  js/jquery.mobile.degradeInputs.js
@@ -24,7 +24,7 @@ $.mobile.page.prototype.options.degradeInputs = {
//auto self-init widgets
$( document ).bind( "pagecreate create", function( e ){
- var page = $(e.target).closest(':jqmData(role="page")').data("page"), options;
+ var page = $(e.target).closest(':jqmData(role="page"),:jqmData(role="dialog")').data("page"), options;
if( !page ) {
return;
View
14 tests/unit/degradeInputs/degradeInputs.js
@@ -14,15 +14,23 @@
var degradeInputs = $.mobile.page.prototype.options.degradeInputs;
expect( degradeInputs.length );
-
+
+ // Initialize dialog page
+ $.mobile.changePage($('#dialog'));
+ $.mobile.changePage($('#page'));
+
$.each(degradeInputs, function( oldType, newType ) {
if (newType === false) {
newType = oldType;
}
- $('#test-container').html('<input type="' + oldType + '" />').trigger("create");
+ $('#page-test-container').html('<input type="' + oldType + '" />').trigger("create");
- same($('#test-container input').attr("type"), newType);
+ same($('#page-test-container input').attr("type"), newType);
+
+ $('#dialog-test-container').html('<input type="' + oldType + '" />').trigger("create");
+
+ same($('#dialog-test-container input').attr("type"), newType);
});
});
View
11 tests/unit/degradeInputs/index.html
@@ -25,11 +25,18 @@ <h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests">
</ol>
-<div id="foo" data-nstest-role="page">
+<div id="page" data-nstest-role="page">
<input id="not-to-be-degraded" type="range" data-nstest-role="nojs" />
- <div id="test-container">
+ <div id="page-test-container">
+ </div>
+
+</div>
+
+<div id="dialog" data-nstest-role="dialog">
+
+ <div id="dialog-test-container">
</div>
</div>
Please sign in to comment.
Something went wrong with that request. Please try again.