Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Merged
merged 1 commit into from

3 participants

@eromba

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

The attached commit enables input degradation for dialog pages and updates the degradeInputs unit tests to check dialogs, too.

@eromba eromba 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.
a8c0485
@johnbender

@eromba

Legit issue and patch. I sincerely appreciate the addition to the test suite too. I'll take a look at this tomorrow.

@odedbd

Might want to add this -
#3120

very similar, in a different place in the code.

@johnbender johnbender merged commit a8c0485 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 21, 2011
  1. @eromba

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

    eromba authored
    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.
This page is out of date. Refresh to see the latest.
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>
Something went wrong with that request. Please try again.