From 0a87b59a04c2d1d68e282feaa4cd7881ac30988d Mon Sep 17 00:00:00 2001 From: Richard Stutfield Date: Fri, 10 Dec 2010 12:27:14 +0000 Subject: [PATCH 1/9] Navigation: delay removal of duplicateCachedPage --- js/jquery.mobile.navigation.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/js/jquery.mobile.navigation.js b/js/jquery.mobile.navigation.js index 17d6a537..2196ad2b 100644 --- a/js/jquery.mobile.navigation.js +++ b/js/jquery.mobile.navigation.js @@ -212,10 +212,7 @@ } removeActiveLinkClass(); - //if there's a duplicateCachedPage, remove it from the DOM now that it's hidden - if( duplicateCachedPage != null ){ - duplicateCachedPage.remove(); - } + //jump to top or prev scroll, if set $.mobile.silentScroll( to.data( 'lastScroll' ) ); @@ -225,6 +222,11 @@ if( to.data("page")._trigger("show", null, {prevPage: from}) !== false ){ $.mobile.activePage = to; } + + //if there's a duplicateCachedPage, remove it from the DOM now that it's hidden + if (duplicateCachedPage != null) { + duplicateCachedPage.remove(); + } }; if(transition && (transition !== 'none')){ From db1f51aeb2dcece42e461a19995fe2f5bd4ae8ce Mon Sep 17 00:00:00 2001 From: Louy Alakkad Date: Sat, 8 Jan 2011 21:24:10 +0800 Subject: [PATCH 2/9] Button label isn't obvious when data-theme="c" and button is :visited. [#777] --- themes/default/jquery.mobile.button.css | 1 - 1 file changed, 1 deletion(-) diff --git a/themes/default/jquery.mobile.button.css b/themes/default/jquery.mobile.button.css index b2e9a851..0b10abba 100644 --- a/themes/default/jquery.mobile.button.css +++ b/themes/default/jquery.mobile.button.css @@ -5,7 +5,6 @@ */ .ui-btn { display: block; text-align: center; cursor:pointer; position: relative; margin: .5em 5px; padding: 0; } .ui-btn:focus, .ui-btn a:focus { outline: none; } -.ui-btn:visited { color: #fff; } .ui-header .ui-btn, .ui-footer .ui-btn, .ui-bar .ui-btn { display: inline-block; font-size: 13px; margin: 0; } .ui-btn-inline { display: inline-block; } .ui-btn-inner { padding: .6em 25px; display: block; height: 100%; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; position: relative; } From 32056c687355e2521e34cd0bc02ea9e55405057f Mon Sep 17 00:00:00 2001 From: bclinkinbeard Date: Sun, 2 Jan 2011 13:18:00 +0800 Subject: [PATCH 3/9] Added type attribute to script tags and fixed footer comment --- docs/pages/docs-pages.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/pages/docs-pages.html b/docs/pages/docs-pages.html index 724fd24b..72710fe0 100755 --- a/docs/pages/docs-pages.html +++ b/docs/pages/docs-pages.html @@ -31,8 +31,8 @@ <head> <title>Page Title</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" /> - <script src="http://code.jquery.com/jquery-1.4.3.min.js"></script> - <script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script> + <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script> + <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script> </head> <body> @@ -73,8 +73,8 @@ <head> <title>Page Title</title> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" /> - <script src="http://code.jquery.com/jquery-1.4.3.min.js"></script> - <script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script> + <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.3.min.js"></script> + <script type="text/javascript" src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script> </head> <body> @@ -90,7 +90,7 @@ <div data-role="footer"> <h4>Page Footer</h4> - </div><!-- /header --> + </div><!-- /footer --> </div><!-- /page --> </body> From b71cc32d78c3c7313a22b1eab41b8620bd116656 Mon Sep 17 00:00:00 2001 From: ehynds Date: Tue, 28 Dec 2010 22:06:51 +0800 Subject: [PATCH 4/9] "this" in this context is already a jquery object --- js/jquery.mobile.fieldContain.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/jquery.mobile.fieldContain.js b/js/jquery.mobile.fieldContain.js index b31a2bff..dec7e662 100644 --- a/js/jquery.mobile.fieldContain.js +++ b/js/jquery.mobile.fieldContain.js @@ -6,6 +6,6 @@ */ (function($, undefined ) { $.fn.fieldcontain = function(options){ - return $(this).addClass('ui-field-contain ui-body ui-br'); + return this.addClass('ui-field-contain ui-body ui-br'); }; })(jQuery); \ No newline at end of file From 95819c8c605c3d19b6496f6d93d00497692f4f7d Mon Sep 17 00:00:00 2001 From: ehynds Date: Tue, 28 Dec 2010 23:15:30 +0800 Subject: [PATCH 5/9] same fix in a few other places --- js/jquery.mobile.controlGroup.js | 2 +- js/jquery.mobile.fixHeaderFooter.js | 15 +++++++++------ js/jquery.mobile.grid.js | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/js/jquery.mobile.controlGroup.js b/js/jquery.mobile.controlGroup.js index 49365d70..6a819c94 100644 --- a/js/jquery.mobile.controlGroup.js +++ b/js/jquery.mobile.controlGroup.js @@ -7,7 +7,7 @@ (function($, undefined ) { $.fn.controlgroup = function(options){ - return $(this).each(function(){ + return this.each(function(){ var o = $.extend({ direction: $( this ).data( "type" ) || "vertical", shadow: false diff --git a/js/jquery.mobile.fixHeaderFooter.js b/js/jquery.mobile.fixHeaderFooter.js index a4cd034a..0028e101 100644 --- a/js/jquery.mobile.fixHeaderFooter.js +++ b/js/jquery.mobile.fixHeaderFooter.js @@ -6,13 +6,16 @@ */ (function($, undefined ) { $.fn.fixHeaderFooter = function(options){ - if( !$.support.scrollTop ){ return $(this); } - return $(this).each(function(){ - if( $(this).data('fullscreen') ){ $(this).addClass('ui-page-fullscreen'); } - $(this).find('.ui-header[data-position="fixed"]').addClass('ui-header-fixed ui-fixed-inline fade'); //should be slidedown - $(this).find('.ui-footer[data-position="fixed"]').addClass('ui-footer-fixed ui-fixed-inline fade'); //should be slideup + if( !$.support.scrollTop ){ return this; } + + return this.each(function(){ + var $this = $(this); + + if( $this.data('fullscreen') ){ $this.addClass('ui-page-fullscreen'); } + $this.find('.ui-header[data-position="fixed"]').addClass('ui-header-fixed ui-fixed-inline fade'); //should be slidedown + $this.find('.ui-footer[data-position="fixed"]').addClass('ui-footer-fixed ui-fixed-inline fade'); //should be slideup }); -}; +}; //single controller for all showing,hiding,toggling $.fixedToolbars = (function(){ diff --git a/js/jquery.mobile.grid.js b/js/jquery.mobile.grid.js index 8fee7090..a76b2d51 100644 --- a/js/jquery.mobile.grid.js +++ b/js/jquery.mobile.grid.js @@ -6,7 +6,7 @@ */ (function($, undefined ) { $.fn.grid = function(options){ - return $(this).each(function(){ + return this.each(function(){ var o = $.extend({ grid: null },options); From 1a21b0581ccd6350a222e67ae5850e4a823d1058 Mon Sep 17 00:00:00 2001 From: "D. Elmo Peele" Date: Wed, 12 Jan 2011 06:57:08 +0800 Subject: [PATCH 6/9] Avoid triggering a 'tap' event if the event target on touchStop differs from the original touchStart target. --- js/jquery.mobile.event.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/jquery.mobile.event.js b/js/jquery.mobile.event.js index 8475ac73..c1bdc90d 100644 --- a/js/jquery.mobile.event.js +++ b/js/jquery.mobile.event.js @@ -70,6 +70,7 @@ $.event.special.tap = { var moved = false, touching = true, + origTarget = event.target, origPos = [ event.pageX, event.pageY ], originalType, timer; @@ -97,7 +98,10 @@ $.event.special.tap = { clearTimeout( timer ); touching = false; - if ( !moved ) { + /* ONLY trigger a 'tap' event if the start target is + * the same as the stop target. + */ + if ( !moved && (origTarget == event.target)) { originalType = event.type; event.type = "tap"; $.event.handle.call( thisObject, event ); From 5b238ea1ce6c5164eafc63a95f5fdd3f47c706be Mon Sep 17 00:00:00 2001 From: Jesse Streb Date: Thu, 9 Dec 2010 10:13:30 +0800 Subject: [PATCH 7/9] https://github.com/jquery/jquery-mobile/issues#issue/578 Updated to use the selector that Scott suggested in order to make checkboxes not dissappear. One issue I noticed is that the page still transitions to the 'new' page even though it is really the same page. I have a fix for this that will post in a separate drop. --- js/jquery.mobile.forms.checkboxradio.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/jquery.mobile.forms.checkboxradio.js b/js/jquery.mobile.forms.checkboxradio.js index 47ebea9d..e6529716 100644 --- a/js/jquery.mobile.forms.checkboxradio.js +++ b/js/jquery.mobile.forms.checkboxradio.js @@ -11,7 +11,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, { }, _create: function(){ var input = this.element, - label = $("label[for='" + input.attr( "id" ) + "']"), + label = $(input).closest("form,fieldset,[data-role='page']").find("label[for='" + input.attr( "id" ) + "']"), inputtype = input.attr( "type" ), checkedicon = "ui-icon-" + inputtype + "-on", uncheckedicon = "ui-icon-" + inputtype + "-off"; @@ -76,7 +76,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, { refresh: function( ){ var input = this.element, - label = $("label[for='" + input.attr( "id" ) + "']"), + label = $(input).closest("form,fieldset,[data-role='page']").find("label[for='" + input.attr( "id" ) + "']"), inputtype = input.attr( "type" ), icon = label.find( ".ui-icon" ), checkedicon = "ui-icon-" + inputtype + "-on", From 924c2c3e9b321063bd2da5a3fe36d4382d0ccfce Mon Sep 17 00:00:00 2001 From: Jesse Streb Date: Mon, 13 Dec 2010 05:00:56 +0800 Subject: [PATCH 8/9] updated select to no longer wrap the input element as it is already jQuery object. Thanks ehynds. --- js/jquery.mobile.forms.checkboxradio.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/jquery.mobile.forms.checkboxradio.js b/js/jquery.mobile.forms.checkboxradio.js index e6529716..269481c7 100644 --- a/js/jquery.mobile.forms.checkboxradio.js +++ b/js/jquery.mobile.forms.checkboxradio.js @@ -11,7 +11,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, { }, _create: function(){ var input = this.element, - label = $(input).closest("form,fieldset,[data-role='page']").find("label[for='" + input.attr( "id" ) + "']"), + label = input.closest("form,fieldset,[data-role='page']").find("label[for='" + input.attr( "id" ) + "']"), inputtype = input.attr( "type" ), checkedicon = "ui-icon-" + inputtype + "-on", uncheckedicon = "ui-icon-" + inputtype + "-off"; @@ -76,7 +76,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, { refresh: function( ){ var input = this.element, - label = $(input).closest("form,fieldset,[data-role='page']").find("label[for='" + input.attr( "id" ) + "']"), + label = input.closest("form,fieldset,[data-role='page']").find("label[for='" + input.attr( "id" ) + "']"), inputtype = input.attr( "type" ), icon = label.find( ".ui-icon" ), checkedicon = "ui-icon-" + inputtype + "-on", From 9e6a3df6b11de575b994e2b0a53a6cc48e721b20 Mon Sep 17 00:00:00 2001 From: ehynds Date: Wed, 12 Jan 2011 09:21:23 +0800 Subject: [PATCH 9/9] make sure the options cache is updated after a refresh, and that the click handler reads from this cache. --- js/jquery.mobile.forms.select.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/jquery.mobile.forms.select.js b/js/jquery.mobile.forms.select.js index 3e311edc..9af76ca9 100644 --- a/js/jquery.mobile.forms.select.js +++ b/js/jquery.mobile.forms.select.js @@ -123,6 +123,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, { //expose to other methods $.extend(self, { select: select, + options: options, selectID: selectID, label: label, buttonId:buttonId, @@ -173,7 +174,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, { // index of option tag to be selected var newIndex = list.find( "li:not(.ui-li-divider)" ).index( this ), - option = options.eq( newIndex )[0]; + option = self.options.eq( newIndex )[0]; // toggle selected status on the tag for multi selects option.selected = isMultiple ? !option.selected : true; @@ -291,7 +292,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, { var self = this, select = this.element, isMultiple = this.isMultiple, - options = select.find("option"), + options = this.options = select.find("option"), selected = options.filter(":selected"), // return an array of all selected index's