diff --git a/Makefile b/Makefile index 9494835e..0991fd3a 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,7 @@ JQUERY = $(shell grep Library js/jquery.js | sed s'/ \* jQuery JavaScript Librar # The directory to create the zipped files in and also serves as the filenames DIR = jquery.mobile-${VER} +nightly: DIR = jquery.mobile # The output folder for the finished files OUTPUT = compiled @@ -24,7 +25,6 @@ RMLATEST = echo "" NIGHTLY_OUTPUT = nightlies/${DATE} ifeq (${NIGHTLY_OUTPUT}, latest) RMLATEST = ssh jqadmin@code.origin.jquery.com 'rm -rf /var/www/html/code.jquery.com/mobile/latest' - DIR = jquery.mobile endif NIGHTLY_WEBPATH = http://code.jquery.com/mobile/${NIGHTLY_OUTPUT} @@ -136,12 +136,6 @@ zip: init js min css cssmin # Used by the jQuery team to make the nightly builds nightly: pull zip - # Create a log that lists the current version according to the code and the git information for the last commit - @@echo $$"\nGit Release Version: " >> ${OUTPUT}/log.txt - @@cat version.txt >> ${OUTPUT}/log.txt - @@echo $$"\nGit Information for this build:" >> ${OUTPUT}/log.txt - @@git log -1 --format=format:"SHA1: %H \nDate: %cd \nTitle: %s" >> ${OUTPUT}/log.txt - # Create the folder to hold the files for the demos @@mkdir -p ${VER} diff --git a/js/jquery.mobile.collapsible.js b/js/jquery.mobile.collapsible.js index 0b77ead9..a812d6c9 100644 --- a/js/jquery.mobile.collapsible.js +++ b/js/jquery.mobile.collapsible.js @@ -72,7 +72,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, { //events collapsibleContain .bind( "collapse", function( event ){ - if( !event.isDefaultPrevented() ){ + if( !event.isDefaultPrevented() && $( event.target ).closest( ".ui-collapsible-contain" ).is( collapsibleContain ) ){ event.preventDefault(); collapsibleHeading .addClass( "ui-collapsible-heading-collapsed" ) @@ -89,7 +89,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, { } } ) - .bind( "expand", function( event ){ + .bind( "expand", function( event ){ if( !event.isDefaultPrevented() ){ event.preventDefault(); collapsibleHeading @@ -114,14 +114,16 @@ $.widget( "mobile.collapsible", $.mobile.widget, { collapsibleParent .jqmData( "collapsiblebound", true ) .bind( "expand", function( event ){ - $( this ).find( ".ui-collapsible-contain" ) - .not( $( event.target ).closest( ".ui-collapsible-contain" ) ) - .not( "> .ui-collapsible-contain .ui-collapsible-contain" ) + + $( event.target ) + .closest( ".ui-collapsible-contain" ) + .siblings( ".ui-collapsible-contain" ) .trigger( "collapse" ); + } ); - var set = collapsibleParent.find( ":jqmData(role=collapsible )" ); + var set = collapsibleParent.find( ":jqmData(role=collapsible ):first" ); set.first() .find( "a:eq(0)" ) diff --git a/js/jquery.mobile.dialog.js b/js/jquery.mobile.dialog.js index 340311a0..922932d0 100644 --- a/js/jquery.mobile.dialog.js +++ b/js/jquery.mobile.dialog.js @@ -4,59 +4,51 @@ * Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. * Note: Code is in draft form and is subject to change */ -(function($, undefined ) { +( function( $, undefined ) { $.widget( "mobile.dialog", $.mobile.widget, { options: { closeBtnText: "Close" }, - _create: function(){ - var self = this, - $el = self.element; + _create: function() { + var $el = this.element; /* class the markup for dialog styling */ - this.element + $el //add ARIA role - .attr("role","dialog") - .addClass('ui-page ui-dialog ui-body-a') + .attr( "role", "dialog" ) + .addClass( "ui-page ui-dialog ui-body-a" ) .find( ":jqmData(role=header)" ) - .addClass('ui-corner-top ui-overlay-shadow') + .addClass( "ui-corner-top ui-overlay-shadow" ) .prepend( ""+ this.options.closeBtnText +"" ) .end() - .find('.ui-content:not([class*="ui-body-"])') - .addClass('ui-body-c') + .find( '.ui-content:not([class*="ui-body-"])' ) + .addClass( 'ui-body-c' ) .end() .find( ".ui-content,:jqmData(role='footer')" ) .last() - .addClass('ui-corner-bottom ui-overlay-shadow'); + .addClass( "ui-corner-bottom ui-overlay-shadow" ); /* bind events - clicks and submits should use the closing transition that the dialog opened with unless a data-transition is specified on the link/form - if the click was on the close button, or the link has a data-rel="back" it'll go back in history naturally */ - this.element - .bind( "vclick submit", function(e){ - var $targetel; - if( e.type == "vclick" ){ - $targetel = $(e.target).closest("a"); - } - else{ - $targetel = $(e.target).closest("form"); - } + $el + .bind( "vclick submit", function( e ) { + var $target = $( e.target ).closest( e.type === "vclick" ? "a" : "form" ); - if( $targetel.length && !$targetel.jqmData("transition") ){ + if( $target.length && ! $target.jqmData( "transition" ) ) { var active = $.mobile.urlHistory.getActive() || {}; - $targetel - .attr("data-" + $.mobile.ns + "transition", ( active.transition || $.mobile.defaultDialogTransition ) ) - .attr("data-" + $.mobile.ns + "direction", "reverse"); + $target + .attr( "data-" + $.mobile.ns + "transition", ( active.transition || $.mobile.defaultDialogTransition ) ) + .attr( "data-" + $.mobile.ns + "direction", "reverse" ); } }); - }, //close method goes back in history - close: function(){ + close: function() { window.history.back(); } }); -})( jQuery ); \ No newline at end of file +})( jQuery ); diff --git a/js/jquery.mobile.listview.js b/js/jquery.mobile.listview.js index 9fd9a660..cd7600fb 100644 --- a/js/jquery.mobile.listview.js +++ b/js/jquery.mobile.listview.js @@ -5,6 +5,10 @@ * http://jquery.org/license */ (function($, undefined ) { +//Keeps track of the number of lists per page UID +//This allows support for multiple nested list in the same page +//https://github.com/jquery/jquery-mobile/issues/1617 +var listCountPerPage = {}; $.widget( "mobile.listview", $.mobile.widget, { options: { @@ -189,23 +193,31 @@ $.widget( "mobile.listview", $.mobile.widget, { _idStringEscape: function( str ){ return str.replace(/[^a-zA-Z0-9]/g, '-'); }, - + _createSubPages: function() { var parentList = this.element, parentPage = parentList.closest( ".ui-page" ), - parentId = parentPage.jqmData( "url" ), + parentUrl = parentPage.jqmData( "url" ), + parentId = parentUrl || parentPage[ 0 ][ $.expando ], + parentListId = parentList.attr( "id" ), o = this.options, dns = "data-" + $.mobile.ns, self = this, persistentFooterID = parentPage.find( ":jqmData(role='footer')" ).jqmData( "id" ); + if ( typeof( listCountPerPage[ parentId ] ) === 'undefined' ) { + listCountPerPage[ parentId ] = -1; + } + parentListId = parentListId || ++listCountPerPage[ parentId ]; + $( parentList.find( "li>ul, li>ol" ).toArray().reverse() ).each(function( i ) { var list = $( this ), + listId = list.attr( "id" ) || parentListId + "-" + i, parent = list.parent(), nodeEls = $( list.prevAll().toArray().reverse() ), nodeEls = nodeEls.length ? nodeEls : $( "" + $.trim(parent.contents()[ 0 ].nodeValue) + "" ), title = nodeEls.first().text(),//url limits to first 30 chars of text - id = parentId + "&" + $.mobile.subPageUrlKey + "=" + self._idStringEscape(title + " " + i), + id = ( parentUrl || "" ) + "&" + $.mobile.subPageUrlKey + "=" + listId; theme = list.jqmData( "theme" ) || o.theme, countTheme = list.jqmData( "counttheme" ) || parentList.jqmData( "counttheme" ) || o.countTheme, newPage = list.detach() diff --git a/tests/unit/listview/index.html b/tests/unit/listview/index.html index 4a30a43b..3e1fc50b 100644 --- a/tests/unit/listview/index.html +++ b/tests/unit/listview/index.html @@ -80,22 +80,40 @@ diff --git a/tests/unit/listview/listview_core.js b/tests/unit/listview/listview_core.js index 15d09e09..dcc23a3d 100644 --- a/tests/unit/listview/listview_core.js +++ b/tests/unit/listview/listview_core.js @@ -63,8 +63,8 @@ function(){ ok($('#nested-list-test').hasClass('ui-page-active'), "makes nested list test page active"); - ok($(':jqmData(url="nested-list-test&ui-page=More-animals-0")').length == 1, "Adds first UL to the page"); - ok($(':jqmData(url="nested-list-test&ui-page=Groups-of-animals-1")').length == 1, "Adds second nested UL to the page"); + ok($(':jqmData(url="nested-list-test&ui-page=0-0")').length == 1, "Adds first UL to the page"); + ok($(':jqmData(url="nested-list-test&ui-page=0-1")').length == 1, "Adds second nested UL to the page"); start(); } ]); @@ -82,7 +82,7 @@ }, function(){ - var $new_page = $(':jqmData(url="nested-list-test&ui-page=More-animals-0")'); + var $new_page = $(':jqmData(url="nested-list-test&ui-page=0-0")'); ok($new_page.hasClass('ui-page-active'), 'Makes the nested page the active page.'); ok($('.ui-listview', $new_page).find(":contains('Rhumba of rattlesnakes')").length == 1, "The current page should have the proper text in the list."); @@ -95,7 +95,7 @@ asyncTest( "should go back to top level when the back button is clicked", function() { $.testHelper.pageSequence([ function(){ - $.testHelper.openPage("#nested-list-test&ui-page=More-animals-0"); + $.testHelper.openPage("#nested-list-test&ui-page=0-0"); }, function(){ @@ -113,7 +113,7 @@ ok($('#nested-list-test .linebreaknode').text() === "More animals", 'Text should be "More animals"'); }); - asyncTest( "Multiple nested lists on a page", function() { + asyncTest( "Multiple nested lists on a page with same labels", function() { $.testHelper.pageSequence([ function(){ // https://github.com/jquery/jquery-mobile/issues/1617 @@ -121,9 +121,12 @@ }, function(){ + // Click on the link of the third li element $('.ui-page-active li:eq(2) a:eq(0)').click(); - - equal($('.ui-page-active .ui-content .ui-listview li').text(), "Sub Item 10Sub Item 11Sub Item 12", 'Text should be "Sub Item 10Sub Item 11Sub Item 12"'); + }, + + function(){ + equal($('.ui-page-active .ui-content .ui-listview li').text(), "Item A-3-0Item A-3-1Item A-3-2", 'Text should be "Item A-3-0Item A-3-1Item A-3-2"'); start(); } ]); @@ -387,4 +390,4 @@ }, 1000); }); -})(jQuery); \ No newline at end of file +})(jQuery); diff --git a/tests/unit/navigation/form-tests/changepage-data.html b/tests/unit/navigation/form-tests/changepage-data.html new file mode 100644 index 00000000..2305c206 --- /dev/null +++ b/tests/unit/navigation/form-tests/changepage-data.html @@ -0,0 +1,8 @@ + + + + + +
+ + diff --git a/tests/unit/navigation/navigation_core.js b/tests/unit/navigation/navigation_core.js index d67aa12e..13238dd2 100644 --- a/tests/unit/navigation/navigation_core.js +++ b/tests/unit/navigation/navigation_core.js @@ -422,4 +422,41 @@ } ], 1000); }); + + asyncTest( "query data passed as string to changePage is appended to URL", function(){ + + $.testHelper.pageSequence([ + // open our test page + function(){ + $.mobile.changePage( "form-tests/changepage-data.html", { + data: "foo=1&bar=2" + } ); + }, + + function(){ + same(location.hash, "#form-tests/changepage-data.html?foo=1&bar=2"); + start(); + } + ]); + }); + + asyncTest( "query data passed as object to changePage is appended to URL", function(){ + + $.testHelper.pageSequence([ + // open our test page + function(){ + $.mobile.changePage( "form-tests/changepage-data.html", { + data: { + foo: 3, + bar: 4 + } + } ); + }, + + function(){ + same(location.hash, "#form-tests/changepage-data.html?foo=3&bar=4"); + start(); + } + ]); + }); })(jQuery); diff --git a/themes/default/jquery.mobile.core.css b/themes/default/jquery.mobile.core.css index 982b18dc..0d3bc064 100644 --- a/themes/default/jquery.mobile.core.css +++ b/themes/default/jquery.mobile.core.css @@ -14,14 +14,14 @@ .ui-mobile-viewport { margin: 0; overflow-x: hidden; -webkit-text-size-adjust: none; -ms-text-size-adjust:none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0); } /* "page" containers - full-screen views, one should always be in view post-pageload */ -.ui-mobile [data-role=page], .ui-mobile [data-role=dialog], .ui-page { top: 0; left: 0; width: 100%; min-height: 100%; height: auto !important; height: 100%; position: absolute; display: none; border: 0; } +.ui-mobile [data-role=page], .ui-mobile [data-role=dialog], .ui-page { top: 0; left: 0; width: 100%; min-height: 100%; position: absolute; display: none; border: 0; } .ui-mobile .ui-page-active { display: block; overflow: visible; } /*orientations from js are available */ .portrait, .portrait .ui-page, .landscape, -.landscape .ui-page { min-height: 100%; height: auto !important; height: 100%; } +.landscape .ui-page { min-height: 100%; } /* loading screen */ .ui-loading .ui-mobile-viewport { overflow: hidden !important; } diff --git a/themes/default/jquery.mobile.forms.select.css b/themes/default/jquery.mobile.forms.select.css index b2231b41..09fcac49 100644 --- a/themes/default/jquery.mobile.forms.select.css +++ b/themes/default/jquery.mobile.forms.select.css @@ -7,6 +7,7 @@ .ui-select select { position: absolute; left: -9999px; top: -9999px; } .ui-select .ui-btn { overflow: hidden; } .ui-select .ui-btn select { cursor: pointer; -webkit-appearance: button; left: 0; top:0; width: 100%; height: 100%; text-indent: -999em; opacity: 0.0001; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; filter: alpha(opacity=0); } +.ui-select .ui-btn option { text-indent: 0; } .ui-select .ui-btn select.ui-select-nativeonly { opacity: 1; text-indent: 0; } .ui-select .ui-btn-icon-right .ui-btn-inner { padding-right: 45px; }