jquery_mobile_rails 1.4.1 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * jQuery Mobile 1.4.1
3
- * Git HEAD hash: 18c1e32bfc4e0e92756dedc105d799131607f5bb <> Date: Wed Feb 12 2014 22:15:20 UTC
2
+ * jQuery Mobile 1.4.2
3
+ * Git HEAD hash: 9d9a42a27d0c693e8b5569c3a10d771916af5045 <> Date: Fri Feb 28 2014 17:32:01 UTC
4
4
  * http://jquerymobile.com
5
5
  *
6
6
  * Copyright 2010, 2014 jQuery Foundation, Inc. and other contributors
@@ -30,7 +30,7 @@
30
30
  $.extend( $.mobile, {
31
31
 
32
32
  // Version of the jQuery Mobile Framework
33
- version: "1.4.1",
33
+ version: "1.4.2",
34
34
 
35
35
  // Deprecated and no longer used in 1.4 remove in 1.5
36
36
  // Define the url parameter used for referencing widget-generated sub-pages.
@@ -520,6 +520,36 @@ $.ui.plugin = {
520
520
 
521
521
  (function( $, window, undefined ) {
522
522
 
523
+ // Subtract the height of external toolbars from the page height, if the page does not have
524
+ // internal toolbars of the same type
525
+ var compensateToolbars = function( page, desiredHeight ) {
526
+ var pageParent = page.parent(),
527
+ toolbarsAffectingHeight = [],
528
+ externalHeaders = pageParent.children( ":jqmData(role='header')" ),
529
+ internalHeaders = page.children( ":jqmData(role='header')" ),
530
+ externalFooters = pageParent.children( ":jqmData(role='footer')" ),
531
+ internalFooters = page.children( ":jqmData(role='footer')" );
532
+
533
+ // If we have no internal headers, but we do have external headers, then their height
534
+ // reduces the page height
535
+ if ( internalHeaders.length === 0 && externalHeaders.length > 0 ) {
536
+ toolbarsAffectingHeight = toolbarsAffectingHeight.concat( externalHeaders.toArray() );
537
+ }
538
+
539
+ // If we have no internal footers, but we do have external footers, then their height
540
+ // reduces the page height
541
+ if ( internalFooters.length === 0 && externalFooters.length > 0 ) {
542
+ toolbarsAffectingHeight = toolbarsAffectingHeight.concat( externalFooters.toArray() );
543
+ }
544
+
545
+ $.each( toolbarsAffectingHeight, function( index, value ) {
546
+ desiredHeight -= $( value ).outerHeight();
547
+ });
548
+
549
+ // Height must be at least zero
550
+ return Math.max( 0, desiredHeight );
551
+ };
552
+
523
553
  $.extend( $.mobile, {
524
554
  // define the window and the document objects
525
555
  window: $( window ),
@@ -650,7 +680,8 @@ $.ui.plugin = {
650
680
  pageHeight = page.height(),
651
681
  pageOuterHeight = page.outerHeight( true );
652
682
 
653
- height = ( typeof height === "number" ) ? height : $.mobile.getScreenHeight();
683
+ height = compensateToolbars( page,
684
+ ( typeof height === "number" ) ? height : $.mobile.getScreenHeight() );
654
685
 
655
686
  page.css( "min-height", height - ( pageOuterHeight - pageHeight ) );
656
687
  },
@@ -3155,7 +3186,6 @@ if ( !$.support.boxShadow ) {
3155
3186
 
3156
3187
  // All lower case if not a vendor prop
3157
3188
  if ( props[ test ][ "prefix" ] === "" ) {
3158
- props[ test ][ "duration" ] = props[ test ][ "duration" ].toLowerCase();
3159
3189
  props[ test ][ "event" ] = props[ test ][ "event" ].toLowerCase();
3160
3190
  }
3161
3191
  });
@@ -3191,8 +3221,8 @@ if ( !$.support.boxShadow ) {
3191
3221
  }
3192
3222
 
3193
3223
  // If we could not read a duration use the default
3194
- if ( duration === 0 || duration === undefined ) {
3195
- duration = $.fn.animationComplete.default;
3224
+ if ( duration === 0 || duration === undefined || isNaN( duration ) ) {
3225
+ duration = $.fn.animationComplete.defaultDuration;
3196
3226
  }
3197
3227
  }
3198
3228
 
@@ -3219,7 +3249,7 @@ if ( !$.support.boxShadow ) {
3219
3249
  };
3220
3250
 
3221
3251
  // Allow default callback to be configured on mobileInit
3222
- $.fn.animationComplete.default = 1000;
3252
+ $.fn.animationComplete.defaultDuration = 1000;
3223
3253
  })( jQuery );
3224
3254
 
3225
3255
  // This plugin is an experiment for abstracting away the touch and mouse
@@ -4478,11 +4508,6 @@ $.widget( "mobile.page", {
4478
4508
  _create: function() {
4479
4509
  this.setLastScrollEnabled = true;
4480
4510
 
4481
- // TODO consider moving the navigation handler OUT of widget into
4482
- // some other object as glue between the navigate event and the
4483
- // content widget load and change methods
4484
- this._on( this.window, { navigate: "_filterNavigateEvents" });
4485
-
4486
4511
  this._on( this.window, {
4487
4512
  // disable an scroll setting when a hashchange has been fired,
4488
4513
  // this only works because the recording of the scroll position
@@ -4495,6 +4520,11 @@ $.widget( "mobile.page", {
4495
4520
  scrollstop: "_delayedRecordScroll"
4496
4521
  });
4497
4522
 
4523
+ // TODO consider moving the navigation handler OUT of widget into
4524
+ // some other object as glue between the navigate event and the
4525
+ // content widget load and change methods
4526
+ this._on( this.window, { navigate: "_filterNavigateEvents" });
4527
+
4498
4528
  // TODO move from page* events to content* events
4499
4529
  this._on({ pagechange: "_afterContentChange" });
4500
4530
 
@@ -5634,6 +5664,9 @@ $.widget( "mobile.page", {
5634
5664
 
5635
5665
  // resolved on domready
5636
5666
  var domreadyDeferred = $.Deferred(),
5667
+
5668
+ // resolved and nulled on window.load()
5669
+ loadDeferred = $.Deferred(),
5637
5670
  documentUrl = $.mobile.path.documentUrl,
5638
5671
 
5639
5672
  // used to track last vclicked element to make sure its value is added to form data
@@ -6035,13 +6068,29 @@ $.widget( "mobile.page", {
6035
6068
  $.mobile.pageContainer.pagecontainer();
6036
6069
 
6037
6070
  //set page min-heights to be device specific
6038
- $.mobile.document.bind( "pageshow", $.mobile.resetActivePageHeight );
6071
+ $.mobile.document.bind( "pageshow", function() {
6072
+
6073
+ // We need to wait for window.load to make sure that styles have already been rendered,
6074
+ // otherwise heights of external toolbars will have the wrong value
6075
+ if ( loadDeferred ) {
6076
+ loadDeferred.done( $.mobile.resetActivePageHeight );
6077
+ } else {
6078
+ $.mobile.resetActivePageHeight();
6079
+ }
6080
+ });
6039
6081
  $.mobile.window.bind( "throttledresize", $.mobile.resetActivePageHeight );
6040
6082
 
6041
6083
  };//navreadyDeferred done callback
6042
6084
 
6043
6085
  $( function() { domreadyDeferred.resolve(); } );
6044
6086
 
6087
+ $.mobile.window.load( function() {
6088
+
6089
+ // Resolve and null the deferred
6090
+ loadDeferred.resolve();
6091
+ loadDeferred = null;
6092
+ });
6093
+
6045
6094
  $.when( domreadyDeferred, $.mobile.navreadyDeferred ).done( function() { $.mobile._registerInternalEvents(); } );
6046
6095
  })( jQuery );
6047
6096
 
@@ -6174,12 +6223,19 @@ $.widget( "mobile.page", {
6174
6223
  // better transitions with fewer bugs. Ie, it's not guaranteed that the
6175
6224
  // object will be created and transition will be run immediately after as
6176
6225
  // it is today. So we wait until transition is invoked to gather the following
6177
- var reverseClass = this.reverse ? " reverse" : "",
6226
+ var none,
6227
+ reverseClass = this.reverse ? " reverse" : "",
6178
6228
  screenHeight = $.mobile.getScreenHeight(),
6179
- maxTransitionOverride = $.mobile.maxTransitionWidth !== false && $.mobile.window.width() > $.mobile.maxTransitionWidth,
6180
- none = !$.support.cssTransitions || !$.support.cssAnimations || maxTransitionOverride || !this.name || this.name === "none" || Math.max( $.mobile.window.scrollTop(), this.toScroll ) > $.mobile.getMaxScrollForTransition();
6229
+ maxTransitionOverride = $.mobile.maxTransitionWidth !== false &&
6230
+ $.mobile.window.width() > $.mobile.maxTransitionWidth;
6181
6231
 
6182
6232
  this.toScroll = $.mobile.navigate.history.getActive().lastScroll || $.mobile.defaultHomeScroll;
6233
+
6234
+ none = !$.support.cssTransitions || !$.support.cssAnimations ||
6235
+ maxTransitionOverride || !this.name || this.name === "none" ||
6236
+ Math.max( $.mobile.window.scrollTop(), this.toScroll ) >
6237
+ $.mobile.getMaxScrollForTransition();
6238
+
6183
6239
  this.toggleViewportClass();
6184
6240
 
6185
6241
  if ( this.$from && !none ) {
@@ -6840,7 +6896,7 @@ $.widget( "mobile.collapsible", {
6840
6896
  },
6841
6897
 
6842
6898
  _applyOptions: function( options ) {
6843
- var isCollapsed, newTheme, oldTheme, hasCorners,
6899
+ var isCollapsed, newTheme, oldTheme, hasCorners, hasIcon,
6844
6900
  elem = this.element,
6845
6901
  currentOpts = this._renderedOptions,
6846
6902
  ui = this._ui,
@@ -6857,38 +6913,61 @@ $.widget( "mobile.collapsible", {
6857
6913
 
6858
6914
  isCollapsed = elem.hasClass( "ui-collapsible-collapsed" );
6859
6915
 
6860
- // Only options referring to the current state need to be applied right away
6861
- // It is enough to store options covering the alternate in this.options.
6916
+ // We only need to apply the cue text for the current state right away.
6917
+ // The cue text for the alternate state will be stored in the options
6918
+ // and applied the next time the collapsible's state is toggled
6862
6919
  if ( isCollapsed ) {
6863
6920
  if ( opts.expandCueText !== undefined ) {
6864
6921
  status.text( opts.expandCueText );
6865
6922
  }
6866
- if ( opts.collapsedIcon !== undefined ) {
6867
- if ( currentOpts.collapsedIcon ) {
6868
- anchor.removeClass( "ui-icon-" + currentOpts.collapsedIcon );
6869
- }
6870
- if ( opts.collapsedIcon ) {
6871
- anchor.addClass( "ui-icon-" + opts.collapsedIcon );
6872
- }
6873
- }
6874
6923
  } else {
6875
6924
  if ( opts.collapseCueText !== undefined ) {
6876
6925
  status.text( opts.collapseCueText );
6877
6926
  }
6878
- if ( opts.expandedIcon !== undefined ) {
6879
- if ( currentOpts.expandedIcon ) {
6880
- anchor.removeClass( "ui-icon-" + currentOpts.expandedIcon );
6881
- }
6882
- if ( opts.expandedIcon ) {
6883
- anchor.addClass( "ui-icon-" + opts.expandedIcon );
6884
- }
6885
- }
6886
6927
  }
6887
6928
 
6888
- if ( opts.iconpos !== undefined ) {
6889
- anchor
6890
- .removeClass( iconposClass( currentOpts.iconpos ) )
6891
- .addClass( iconposClass( opts.iconpos ) );
6929
+ // Update icon
6930
+
6931
+ // Is it supposed to have an icon?
6932
+ hasIcon =
6933
+
6934
+ // If the collapsedIcon is being set, consult that
6935
+ ( opts.collapsedIcon !== undefined ? opts.collapsedIcon !== false :
6936
+
6937
+ // Otherwise consult the existing option value
6938
+ currentOpts.collapsedIcon !== false );
6939
+
6940
+
6941
+ // If any icon-related options have changed, make sure the new icon
6942
+ // state is reflected by first removing all icon-related classes
6943
+ // reflecting the current state and then adding all icon-related
6944
+ // classes for the new state
6945
+ if ( !( opts.iconpos === undefined &&
6946
+ opts.collapsedIcon === undefined &&
6947
+ opts.expandedIcon === undefined ) ) {
6948
+
6949
+ // Remove all current icon-related classes
6950
+ anchor.removeClass( [ iconposClass( currentOpts.iconpos ) ]
6951
+ .concat( ( currentOpts.expandedIcon ?
6952
+ [ "ui-icon-" + currentOpts.expandedIcon ] : [] ) )
6953
+ .concat( ( currentOpts.collapsedIcon ?
6954
+ [ "ui-icon-" + currentOpts.collapsedIcon ] : [] ) )
6955
+ .join( " " ) );
6956
+
6957
+ // Add new classes if an icon is supposed to be present
6958
+ if ( hasIcon ) {
6959
+ anchor.addClass(
6960
+ [ iconposClass( opts.iconpos !== undefined ?
6961
+ opts.iconpos : currentOpts.iconpos ) ]
6962
+ .concat( isCollapsed ?
6963
+ [ "ui-icon-" + ( opts.collapsedIcon !== undefined ?
6964
+ opts.collapsedIcon :
6965
+ currentOpts.collapsedIcon ) ] :
6966
+ [ "ui-icon-" + ( opts.expandedIcon !== undefined ?
6967
+ opts.expandedIcon :
6968
+ currentOpts.expandedIcon ) ] )
6969
+ .join( " " ) );
6970
+ }
6892
6971
  }
6893
6972
 
6894
6973
  if ( opts.theme !== undefined ) {
@@ -7596,6 +7675,8 @@ $.mobile.behaviors.formReset = {
7596
7675
 
7597
7676
  (function( $, undefined ) {
7598
7677
 
7678
+ var escapeId = $.mobile.path.hashToSelector;
7679
+
7599
7680
  $.widget( "mobile.checkboxradio", $.extend( {
7600
7681
 
7601
7682
  initSelector: "input:not( :jqmData(role='flipswitch' ) )[type='checkbox'],input[type='radio']:not( :jqmData(role='flipswitch' ))",
@@ -7622,7 +7703,7 @@ $.widget( "mobile.checkboxradio", $.extend( {
7622
7703
  input
7623
7704
  .closest( "form, fieldset, :jqmData(role='page'), :jqmData(role='dialog')" )
7624
7705
  .find( "label" )
7625
- .filter( "[for='" + $.mobile.path.hashToSelector( input[0].id ) + "']" )
7706
+ .filter( "[for='" + escapeId( input[0].id ) + "']" )
7626
7707
  .first(),
7627
7708
  inputtype = input[0].type,
7628
7709
  checkedClass = "ui-" + inputtype + "-on",
@@ -7708,17 +7789,9 @@ $.widget( "mobile.checkboxradio", $.extend( {
7708
7789
  },
7709
7790
 
7710
7791
  _handleInputVClick: function() {
7711
- var $this = this.element;
7712
-
7713
7792
  // Adds checked attribute to checked input when keyboard is used
7714
- if ( $this.is( ":checked" ) ) {
7715
-
7716
- $this.prop( "checked", true);
7717
- this._getInputSet().not( $this ).prop( "checked", false );
7718
- } else {
7719
- $this.prop( "checked", false );
7720
- }
7721
-
7793
+ this.element.prop( "checked", this.element.is( ":checked" ) );
7794
+ this._getInputSet().not( this.element ).prop( "checked", false );
7722
7795
  this._updateAll();
7723
7796
  },
7724
7797
 
@@ -7762,14 +7835,51 @@ $.widget( "mobile.checkboxradio", $.extend( {
7762
7835
  });
7763
7836
  },
7764
7837
 
7765
- //returns either a set of radios with the same name attribute, or a single checkbox
7838
+ // Returns those radio buttons that are supposed to be in the same group as
7839
+ // this radio button. In the case of a checkbox or a radio lacking a name
7840
+ // attribute, it returns this.element.
7766
7841
  _getInputSet: function() {
7767
- if ( this.inputtype === "checkbox" ) {
7768
- return this.element;
7769
- }
7842
+ var selector, formId,
7843
+ radio = this.element[ 0 ],
7844
+ name = radio.name,
7845
+ form = radio.form,
7846
+ doc = this.element.parents().last().get( 0 ),
7770
7847
 
7771
- return this.element.closest( "form, :jqmData(role='page'), :jqmData(role='dialog')" )
7772
- .find( "input[name='" + this.element[ 0 ].name + "'][type='" + this.inputtype + "']" );
7848
+ // A radio is always a member of its own group
7849
+ radios = this.element;
7850
+
7851
+ // Only start running selectors if this is an attached radio button with a name
7852
+ if ( name && this.inputtype === "radio" && doc ) {
7853
+ selector = "input[type='radio'][name='" + escapeId( name ) + "']";
7854
+
7855
+ // If we're inside a form
7856
+ if ( form ) {
7857
+ formId = form.id;
7858
+
7859
+ // If the form has an ID, collect radios scattered throught the document which
7860
+ // nevertheless are part of the form by way of the value of their form attribute
7861
+ if ( formId ) {
7862
+ radios = $( selector + "[form='" + escapeId( formId ) + "']", doc );
7863
+ }
7864
+
7865
+ // Also add to those the radios in the form itself
7866
+ radios = $( form ).find( selector ).filter( function() {
7867
+
7868
+ // Some radios inside the form may belong to some other form by virtue of
7869
+ // having a form attribute defined on them, so we must filter them out here
7870
+ return ( this.form === form );
7871
+ }).add( radios );
7872
+
7873
+ // If we're outside a form
7874
+ } else {
7875
+
7876
+ // Collect all those radios which are also outside of a form and match our name
7877
+ radios = $( selector, doc ).filter( function() {
7878
+ return !this.form;
7879
+ });
7880
+ }
7881
+ }
7882
+ return radios;
7773
7883
  },
7774
7884
 
7775
7885
  _updateAll: function() {
@@ -8005,13 +8115,19 @@ $.widget( "mobile.button", {
8005
8115
  },
8006
8116
 
8007
8117
  refresh: function( create ) {
8118
+ var originalElement,
8119
+ isDisabled = this.element.prop( "disabled" );
8120
+
8008
8121
  if ( this.options.icon && this.options.iconpos === "notext" && this.element.attr( "title" ) ) {
8009
8122
  this.element.attr( "title", this.element.val() );
8010
8123
  }
8011
8124
  if ( !create ) {
8012
- var originalElement = this.element.detach();
8125
+ originalElement = this.element.detach();
8013
8126
  $( this.wrapper ).text( this.element.val() ).append( originalElement );
8014
8127
  }
8128
+ if ( this.options.disabled !== isDisabled ) {
8129
+ this._setOptions({ disabled: isDisabled });
8130
+ }
8015
8131
  }
8016
8132
  });
8017
8133
 
@@ -9555,7 +9671,7 @@ $.widget( "mobile.flipswitch", $.extend({
9555
9671
  "keyup": "_timeout",
9556
9672
  "change": "_timeout",
9557
9673
  "input": "_timeout",
9558
- "paste": "_timeout",
9674
+ "paste": "_timeout"
9559
9675
  });
9560
9676
 
9561
9677
  // Attach to the various you-have-become-visible notifications that the
@@ -11945,8 +12061,7 @@ $.widget( "mobile.controlgroup", $.extend( {
11945
12061
  role: role,
11946
12062
  page: page,
11947
12063
  leftbtn: leftbtn,
11948
- rightbtn: rightbtn,
11949
- backBtn: null
12064
+ rightbtn: rightbtn
11950
12065
  });
11951
12066
  this.element.attr( "role", role === "header" ? "banner" : "contentinfo" ).addClass( "ui-" + role );
11952
12067
  this.refresh();
@@ -12020,18 +12135,15 @@ $.widget( "mobile.controlgroup", $.extend( {
12020
12135
 
12021
12136
  },
12022
12137
  _addBackButton: function() {
12023
- var theme,
12024
- options = this.options;
12025
-
12026
- if ( !this.backBtn ) {
12138
+ var options = this.options,
12027
12139
  theme = options.backBtnTheme || options.theme;
12028
- this.backBtn = $( "<a role='button' href='javascript:void(0);' " +
12029
- "class='ui-btn ui-corner-all ui-shadow ui-btn-left " +
12030
- ( theme ? "ui-btn-" + theme + " " : "" ) +
12031
- "ui-toolbar-back-btn ui-icon-carat-l ui-btn-icon-left' " +
12032
- "data-" + $.mobile.ns + "rel='back'>" + options.backBtnText + "</a>" )
12033
- .prependTo( this.element );
12034
- }
12140
+
12141
+ $( "<a role='button' href='javascript:void(0);' " +
12142
+ "class='ui-btn ui-corner-all ui-shadow ui-btn-left " +
12143
+ ( theme ? "ui-btn-" + theme + " " : "" ) +
12144
+ "ui-toolbar-back-btn ui-icon-carat-l ui-btn-icon-left' " +
12145
+ "data-" + $.mobile.ns + "rel='back'>" + options.backBtnText + "</a>" )
12146
+ .prependTo( this.element );
12035
12147
  },
12036
12148
  _addHeadingClasses: function() {
12037
12149
  this.element.children( "h1, h2, h3, h4, h5, h6" )
@@ -12085,7 +12197,6 @@ $.widget( "mobile.controlgroup", $.extend( {
12085
12197
  this._addTransitionClass();
12086
12198
  this._bindPageEvents();
12087
12199
  this._bindToggleHandlers();
12088
- this._setOptions( this.options );
12089
12200
  },
12090
12201
 
12091
12202
  _setOptions: function( o ) {
@@ -12680,7 +12791,6 @@ $.widget( "mobile.panel", {
12680
12791
  positionFixed: false
12681
12792
  },
12682
12793
 
12683
- _panelID: null,
12684
12794
  _closeLink: null,
12685
12795
  _parentPage: null,
12686
12796
  _page: null,
@@ -12691,19 +12801,20 @@ $.widget( "mobile.panel", {
12691
12801
 
12692
12802
  _create: function() {
12693
12803
  var el = this.element,
12694
- parentPage = el.closest( ":jqmData(role='page')" );
12804
+ parentPage = el.closest( ".ui-page, :jqmData(role='page')" );
12695
12805
 
12696
12806
  // expose some private props to other methods
12697
12807
  $.extend( this, {
12698
- _panelID: el.attr( "id" ),
12699
12808
  _closeLink: el.find( ":jqmData(rel='close')" ),
12700
12809
  _parentPage: ( parentPage.length > 0 ) ? parentPage : false,
12810
+ _openedPage: null,
12701
12811
  _page: this._getPage,
12702
12812
  _panelInner: this._getPanelInner(),
12703
- _wrapper: this._getWrapper,
12704
12813
  _fixedToolbars: this._getFixedToolbars
12705
12814
  });
12706
-
12815
+ if ( this.options.display !== "overlay" ){
12816
+ this._getWrapper();
12817
+ }
12707
12818
  this._addPanelClasses();
12708
12819
 
12709
12820
  // if animating, add the class to do so
@@ -12737,7 +12848,7 @@ $.widget( "mobile.panel", {
12737
12848
  var self = this,
12738
12849
  target = self._parentPage ? self._parentPage.parent() : self.element.parent();
12739
12850
 
12740
- self._modal = $( "<div class='" + self.options.classes.modal + "' data-panelid='" + self._panelID + "'></div>" )
12851
+ self._modal = $( "<div class='" + self.options.classes.modal + "'></div>" )
12741
12852
  .on( "mousedown", function() {
12742
12853
  self.close();
12743
12854
  })
@@ -12745,21 +12856,20 @@ $.widget( "mobile.panel", {
12745
12856
  },
12746
12857
 
12747
12858
  _getPage: function() {
12748
- var page = this._parentPage ? this._parentPage : $( "." + $.mobile.activePageClass );
12859
+ var page = this._openedPage || this._parentPage || $( "." + $.mobile.activePageClass );
12749
12860
 
12750
12861
  return page;
12751
12862
  },
12752
12863
 
12753
12864
  _getWrapper: function() {
12754
12865
  var wrapper = this._page().find( "." + this.options.classes.pageWrapper );
12755
-
12756
12866
  if ( wrapper.length === 0 ) {
12757
12867
  wrapper = this._page().children( ".ui-header:not(.ui-header-fixed), .ui-content:not(.ui-popup), .ui-footer:not(.ui-footer-fixed)" )
12758
12868
  .wrapAll( "<div class='" + this.options.classes.pageWrapper + "'></div>" )
12759
12869
  .parent();
12760
12870
  }
12761
12871
 
12762
- return wrapper;
12872
+ this._wrapper = wrapper;
12763
12873
  },
12764
12874
 
12765
12875
  _getFixedToolbars: function() {
@@ -12815,7 +12925,7 @@ $.widget( "mobile.panel", {
12815
12925
  });
12816
12926
  },
12817
12927
 
12818
- _positionPanel: function() {
12928
+ _positionPanel: function( scrollToTop ) {
12819
12929
  var self = this,
12820
12930
  panelInnerHeight = self._panelInner.outerHeight(),
12821
12931
  expand = panelInnerHeight > $.mobile.getScreenHeight();
@@ -12825,7 +12935,9 @@ $.widget( "mobile.panel", {
12825
12935
  self._unfixPanel();
12826
12936
  $.mobile.resetActivePageHeight( panelInnerHeight );
12827
12937
  }
12828
- window.scrollTo( 0, $.mobile.defaultHomeScroll );
12938
+ if ( scrollToTop ) {
12939
+ this.window[ 0 ].scrollTo( 0, $.mobile.defaultHomeScroll );
12940
+ }
12829
12941
  } else {
12830
12942
  self._fixPanel();
12831
12943
  }
@@ -12869,9 +12981,13 @@ $.widget( "mobile.panel", {
12869
12981
  },
12870
12982
 
12871
12983
  _handleClick: function( e ) {
12872
- if ( e.currentTarget.href.split( "#" )[ 1 ] === this._panelID && this._panelID !== undefined ) {
12984
+ var link,
12985
+ panelId = this.element.attr( "id" );
12986
+
12987
+ if ( e.currentTarget.href.split( "#" )[ 1 ] === panelId && panelId !== undefined ) {
12988
+
12873
12989
  e.preventDefault();
12874
- var link = $( e.target );
12990
+ link = $( e.target );
12875
12991
  if ( link.hasClass( "ui-btn" ) ) {
12876
12992
  link.addClass( $.mobile.activeBtnClass );
12877
12993
  this.element.one( "panelopen panelclose", function() {
@@ -12917,7 +13033,11 @@ $.widget( "mobile.panel", {
12917
13033
  self.close();
12918
13034
  }
12919
13035
  });
12920
-
13036
+ if ( !this._parentPage && this.options.display !== "overlay" ) {
13037
+ this._on( this.document, {
13038
+ "pageshow": "_getWrapper"
13039
+ });
13040
+ }
12921
13041
  // Clean up open panels after page hide
12922
13042
  if ( self._parentPage ) {
12923
13043
  this.document.on( "pagehide", ":jqmData(role='page')", function() {
@@ -12949,7 +13069,7 @@ $.widget( "mobile.panel", {
12949
13069
  self._page().jqmData( "panel", "open" );
12950
13070
 
12951
13071
  if ( $.support.cssTransform3d && !!o.animate && o.display !== "overlay" ) {
12952
- self._wrapper().addClass( o.classes.animate );
13072
+ self._wrapper.addClass( o.classes.animate );
12953
13073
  self._fixedToolbars().addClass( o.classes.animate );
12954
13074
  }
12955
13075
 
@@ -12968,13 +13088,13 @@ $.widget( "mobile.panel", {
12968
13088
  .removeClass( o.classes.panelClosed )
12969
13089
  .addClass( o.classes.panelOpen );
12970
13090
 
12971
- self._positionPanel();
13091
+ self._positionPanel( true );
12972
13092
 
12973
13093
  self._pageContentOpenClasses = self._getPosDisplayClasses( o.classes.pageContentPrefix );
12974
13094
 
12975
13095
  if ( o.display !== "overlay" ) {
12976
13096
  self._page().parent().addClass( o.classes.pageContainer );
12977
- self._wrapper().addClass( self._pageContentOpenClasses );
13097
+ self._wrapper.addClass( self._pageContentOpenClasses );
12978
13098
  self._fixedToolbars().addClass( self._pageContentOpenClasses );
12979
13099
  }
12980
13100
 
@@ -12988,13 +13108,15 @@ $.widget( "mobile.panel", {
12988
13108
  complete = function() {
12989
13109
 
12990
13110
  if ( o.display !== "overlay" ) {
12991
- self._wrapper().addClass( o.classes.pageContentPrefix + "-open" );
13111
+ self._wrapper.addClass( o.classes.pageContentPrefix + "-open" );
12992
13112
  self._fixedToolbars().addClass( o.classes.pageContentPrefix + "-open" );
12993
13113
  }
12994
13114
 
12995
13115
  self._bindFixListener();
12996
13116
 
12997
13117
  self._trigger( "open" );
13118
+
13119
+ self._openedPage = self._page();
12998
13120
  };
12999
13121
 
13000
13122
  self._trigger( "beforeopen" );
@@ -13021,7 +13143,7 @@ $.widget( "mobile.panel", {
13021
13143
  self.element.removeClass( o.classes.panelOpen );
13022
13144
 
13023
13145
  if ( o.display !== "overlay" ) {
13024
- self._wrapper().removeClass( self._pageContentOpenClasses );
13146
+ self._wrapper.removeClass( self._pageContentOpenClasses );
13025
13147
  self._fixedToolbars().removeClass( self._pageContentOpenClasses );
13026
13148
  }
13027
13149
 
@@ -13044,12 +13166,12 @@ $.widget( "mobile.panel", {
13044
13166
 
13045
13167
  if ( o.display !== "overlay" ) {
13046
13168
  self._page().parent().removeClass( o.classes.pageContainer );
13047
- self._wrapper().removeClass( o.classes.pageContentPrefix + "-open" );
13169
+ self._wrapper.removeClass( o.classes.pageContentPrefix + "-open" );
13048
13170
  self._fixedToolbars().removeClass( o.classes.pageContentPrefix + "-open" );
13049
13171
  }
13050
13172
 
13051
13173
  if ( $.support.cssTransform3d && !!o.animate && o.display !== "overlay" ) {
13052
- self._wrapper().removeClass( o.classes.animate );
13174
+ self._wrapper.removeClass( o.classes.animate );
13053
13175
  self._fixedToolbars().removeClass( o.classes.animate );
13054
13176
  }
13055
13177
 
@@ -13060,6 +13182,8 @@ $.widget( "mobile.panel", {
13060
13182
  self._page().jqmRemoveData( "panel" );
13061
13183
 
13062
13184
  self._trigger( "close" );
13185
+
13186
+ self._openedPage = null;
13063
13187
  };
13064
13188
 
13065
13189
  self._trigger( "beforeclose" );
@@ -13084,7 +13208,7 @@ $.widget( "mobile.panel", {
13084
13208
  // remove the wrapper if not in use by another panel
13085
13209
  otherPanels = $( "body > :mobile-panel" ).add( $.mobile.activePage.find( ":mobile-panel" ) );
13086
13210
  if ( otherPanels.not( ".ui-panel-display-overlay" ).not( this.element ).length === 0 ) {
13087
- this._wrapper().children().unwrap();
13211
+ this._wrapper.children().unwrap();
13088
13212
  }
13089
13213
 
13090
13214
  if ( this._open ) {
@@ -13380,7 +13504,8 @@ $.widget( "mobile.table", $.mobile.table, {
13380
13504
 
13381
13505
  if ( !create && this.options.mode === "columntoggle" ) {
13382
13506
  // columns not being replaced must be cleared from input toggle-locks
13383
- this._unlockCells( this.allHeaders );
13507
+ this._unlockCells( this.element.find( ".ui-table-cell-hidden, " +
13508
+ ".ui-table-cell-visible" ) );
13384
13509
 
13385
13510
  // update columntoggles and cells
13386
13511
  this._addToggles( this._menu, create );