Popup: reverse orientation bug has been fixed
[platform/framework/web/web-ui-fw.git] / libs / patch / 0029-JQM-performance-tuning.patch
1 From 77d1c8c71a7bc71b807e2fe1e0eca3b286bcb04b Mon Sep 17 00:00:00 2001
2 From: Minkyeong Kim <minkyeong.kim@samsung.com>
3 Date: Wed, 30 Jan 2013 19:11:23 +0900
4 Subject: [PATCH] JQM performance tuning
5
6 ---
7  .../js/events/orientationchange.js                 |    8 +++---
8  libs/js/jquery-mobile-1.2.0/js/events/touch.js     |    4 +-
9  .../js/jquery.mobile.buttonMarkup.js               |   23 ++++++++++---------
10  .../jquery-mobile-1.2.0/js/jquery.mobile.core.js   |    8 +++++-
11  .../js/jquery.mobile.degradeInputs.js              |    2 +-
12  .../js/jquery.mobile.fieldContain.js               |    2 +-
13  .../jquery-mobile-1.2.0/js/jquery.mobile.init.js   |   12 +++++-----
14  .../jquery-mobile-1.2.0/js/jquery.mobile.links.js  |    2 +-
15  .../jquery-mobile-1.2.0/js/jquery.mobile.media.js  |    2 +-
16  .../js/jquery.mobile.navigation.js                 |   14 ++++++------
17  .../js/jquery.mobile.navigation.pushstate.js       |    6 ++--
18  .../jquery-mobile-1.2.0/js/jquery.mobile.nojs.js   |    2 +-
19  .../js/jquery.mobile.transition.js                 |   10 ++++----
20  .../jquery-mobile-1.2.0/js/jquery.mobile.vmouse.js |    2 +-
21  .../js/jquery.mobile.zoom.iosorientationfix.js     |    2 +-
22  .../jquery-mobile-1.2.0/js/widgets/collapsible.js  |    2 +-
23  .../js/widgets/collapsibleSet.js                   |    2 +-
24  libs/js/jquery-mobile-1.2.0/js/widgets/dialog.js   |    2 +-
25  .../jquery-mobile-1.2.0/js/widgets/fixedToolbar.js |    8 +++---
26  .../jquery-mobile-1.2.0/js/widgets/forms/button.js |    4 +-
27  .../js/widgets/forms/checkboxradio.js              |    2 +-
28  .../js/widgets/forms/select.custom.js              |    4 +-
29  .../jquery-mobile-1.2.0/js/widgets/forms/select.js |    2 +-
30  .../jquery-mobile-1.2.0/js/widgets/forms/slider.js |    4 +-
31  .../js/widgets/forms/textinput.js                  |    6 ++--
32  .../js/widgets/listview.autodividers.js            |    2 +-
33  .../js/widgets/listview.filter.js                  |    2 +-
34  libs/js/jquery-mobile-1.2.0/js/widgets/listview.js |    2 +-
35  libs/js/jquery-mobile-1.2.0/js/widgets/loader.js   |    6 ++--
36  libs/js/jquery-mobile-1.2.0/js/widgets/navbar.js   |    2 +-
37  .../js/widgets/page.sections.js                    |   11 +++++----
38  libs/js/jquery-mobile-1.2.0/js/widgets/popup.js    |    8 +++---
39  32 files changed, 87 insertions(+), 81 deletions(-)
40
41 diff --git a/libs/js/jquery-mobile-1.2.0/js/events/orientationchange.js b/libs/js/jquery-mobile-1.2.0/js/events/orientationchange.js
42 index 95674f3..de903c8 100644
43 --- a/libs/js/jquery-mobile-1.2.0/js/events/orientationchange.js
44 +++ b/libs/js/jquery-mobile-1.2.0/js/events/orientationchange.js
45 @@ -7,7 +7,7 @@ define( [ "jquery", "../jquery.mobile.support.orientation", "./throttledresize"
46  //>>excludeEnd("jqmBuildExclude");
47  
48  (function( $, window ) {
49 -       var win = $( window ),
50 +       var win = $.mobile.$window,
51                 event_name = "orientationchange",
52                 special_event,
53                 get_orientation,
54 @@ -44,8 +44,8 @@ define( [ "jquery", "../jquery.mobile.support.orientation", "./throttledresize"
55                 // developer console. The actual threshold value is somewhat arbitrary, we just
56                 // need to make sure it is large enough to exclude the developer console case.
57  
58 -               var ww = window.innerWidth || $( window ).width(),
59 -                       wh = window.innerHeight || $( window ).height(),
60 +               var ww = window.innerWidth || $.mobile.$window.width(),
61 +                       wh = window.innerHeight || $.mobile.$window.height(),
62                         landscape_threshold = 50;
63  
64                 initial_orientation_is_landscape = ww > wh && ( ww - wh ) > landscape_threshold;
65 @@ -151,4 +151,4 @@ define( [ "jquery", "../jquery.mobile.support.orientation", "./throttledresize"
66  
67  //>>excludeStart("jqmBuildExclude", pragmas.jqmBuildExclude);
68  });
69 -//>>excludeEnd("jqmBuildExclude");
70 \ No newline at end of file
71 +//>>excludeEnd("jqmBuildExclude");
72 diff --git a/libs/js/jquery-mobile-1.2.0/js/events/touch.js b/libs/js/jquery-mobile-1.2.0/js/events/touch.js
73 index 6083faf..9e616cc 100644
74 --- a/libs/js/jquery-mobile-1.2.0/js/events/touch.js
75 +++ b/libs/js/jquery-mobile-1.2.0/js/events/touch.js
76 @@ -103,7 +103,7 @@ define( [ "jquery", "../jquery.mobile.vmouse", "../jquery.mobile.support.touch"
77  
78                                         $this.unbind( "vclick", clickHandler )
79                                                 .unbind( "vmouseup", clearTapTimer );
80 -                                       $( document ).unbind( "vmousecancel", clearTapHandlers );
81 +                                       $.mobile.$document.unbind( "vmousecancel", clearTapHandlers );
82                                 }
83  
84                                 function clickHandler( event ) {
85 @@ -118,7 +118,7 @@ define( [ "jquery", "../jquery.mobile.vmouse", "../jquery.mobile.support.touch"
86  
87                                 $this.bind( "vmouseup", clearTapTimer )
88                                         .bind( "vclick", clickHandler );
89 -                               $( document ).bind( "vmousecancel", clearTapHandlers );
90 +                               $.mobile.$document.bind( "vmousecancel", clearTapHandlers );
91  
92                                 timer = setTimeout( function() {
93                                         triggerCustomEvent( thisObject, "taphold", $.Event( "taphold", { target: origTarget } ) );
94 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.buttonMarkup.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.buttonMarkup.js
95 index cd95245..b0b1f19 100644
96 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.buttonMarkup.js
97 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.buttonMarkup.js
98 @@ -11,6 +11,7 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.vmouse" ], function
99  
100  $.fn.buttonMarkup = function( options ) {
101         var $workingSet = this,
102 +               prefix = "data-" + $.mobile.ns,
103                 mapToDataAttr = function( key, value ) {
104                         e.setAttribute( "data-" + $.mobile.ns + key, value );
105                         el.jqmData( key, value );
106 @@ -22,14 +23,14 @@ $.fn.buttonMarkup = function( options ) {
107                 var el = $workingSet.eq( i ),
108                         e = el[ 0 ],
109                         o = $.extend( {}, $.fn.buttonMarkup.defaults, {
110 -                               icon:       options.icon       !== undefined ? options.icon       : el.jqmData( "icon" ),
111 -                               iconpos:    options.iconpos    !== undefined ? options.iconpos    : el.jqmData( "iconpos" ),
112 -                               theme:      options.theme      !== undefined ? options.theme      : el.jqmData( "theme" ) || $.mobile.getInheritedTheme( el, $.fn.buttonMarkup.defaults["theme"] ),
113 -                               inline:     options.inline     !== undefined ? options.inline     : el.jqmData( "inline" ),
114 -                               shadow:     options.shadow     !== undefined ? options.shadow     : el.jqmData( "shadow" ),
115 -                               corners:    options.corners    !== undefined ? options.corners    : el.jqmData( "corners" ),
116 -                               iconshadow: options.iconshadow !== undefined ? options.iconshadow : el.jqmData( "iconshadow" ),
117 -                               mini:       options.mini       !== undefined ? options.mini       : el.jqmData( "mini" )
118 +                               icon:       options.icon       !== undefined ? options.icon       : ( e.getAttribute( prefix + "icon" ) || undefined ),
119 +                               iconpos:    options.iconpos    !== undefined ? options.iconpos    : ( e.getAttribute( prefix + "iconpos" ) || undefined ),
120 +                               theme:      options.theme      !== undefined ? options.theme      : e.getAttribute( prefix + "theme" ) || $.mobile.getInheritedTheme( el, $.fn.buttonMarkup.defaults["theme"] ),
121 +                               inline:     options.inline     !== undefined ? options.inline     : /^true$/i.test( e.getAttribute( prefix + "inline" ) ),
122 +                               shadow:     options.shadow     !== undefined ? options.shadow     : !/^false$/i.test( e.getAttribute( prefix + "shadow" ) ),
123 +                               corners:    options.corners    !== undefined ? options.corners    : !/^false$/i.test( e.getAttribute( prefix + "corners" ) ),
124 +                               iconshadow: options.iconshadow !== undefined ? options.iconshadow : !/^false$/i.test( e.getAttribute( prefix + "iconshadow" ) ),
125 +                               mini:       options.mini       !== undefined ? options.mini       : /^true$/i.test( e.getAttribute( prefix + "mini" ) )
126                         }, options ),
127  
128                         // Classes Defined
129 @@ -44,7 +45,7 @@ $.fn.buttonMarkup = function( options ) {
130  
131                 $.each( o, mapToDataAttr );
132  
133 -               if ( el.jqmData( "rel" ) === "popup" && el.attr( "href" ) ) {
134 +               if ( e.getAttribute( prefix + "rel" ) === "popup" && el.attr( "href" ) ) {
135                         e.setAttribute( "aria-haspopup", true );
136                         e.setAttribute( "aria-owns", e.getAttribute( "href" ) );
137                 }
138 @@ -249,7 +250,7 @@ function closestEnabledButton( element ) {
139  var attachEvents = function() {
140         var hoverDelay = $.mobile.buttonMarkup.hoverDelay, hov, foc;
141  
142 -       $( document ).bind( {
143 +       $.mobile.$document.bind( {
144                 "vmousedown vmousecancel vmouseup vmouseover vmouseout focus blur scrollstart touchend touchcancel": function( event ) {
145                         var theme,
146                                 $btn = $( closestEnabledButton( event.target ) ),
147 @@ -303,7 +304,7 @@ var attachEvents = function() {
148  
149  //links in bars, or those with  data-role become buttons
150  //auto self-init widgets
151 -$( document ).bind( "pagecreate create", function( e ) {
152 +$.mobile.$document.bind( "pagecreate create", function( e ) {
153  
154         $( ":jqmData(role='button'), .ui-bar > a, .ui-header > a, .ui-footer > a, .ui-bar > :jqmData(role='controlgroup') > a", e.target )
155                 .jqmEnhanceable()
156 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.core.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.core.js
157 index 4e8ebfe..873293c 100644
158 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.core.js
159 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.core.js
160 @@ -84,6 +84,10 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
161                         hoverDelay: 200
162                 },
163  
164 +               // define the window and the document objects
165 +               $window: $( window ),
166 +               $document: $( document ),
167 +
168                 // TODO might be useful upstream in jquery itself ?
169                 keyCode: {
170                         ALT: 18,
171 @@ -131,7 +135,7 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
172  
173                         setTimeout( function() {
174                                 window.scrollTo( 0, ypos );
175 -                               $( document ).trigger( "silentscroll", { x: 0, y: ypos });
176 +                               $.mobile.$document.trigger( "silentscroll", { x: 0, y: ypos });
177                         }, 20 );
178  
179                         setTimeout( function() {
180 @@ -237,7 +241,7 @@ define( [ "jquery", "text!../version.txt" ], function( $, __version__ ) {
181                 getScreenHeight: function() {
182                         // Native innerHeight returns more accurate value for this across platforms,
183                         // jQuery version is here as a normalized fallback for platforms like Symbian
184 -                       return window.innerHeight || $( window ).height();
185 +                       return window.innerHeight || $.mobile.$window.height();
186                 }
187         }, $.mobile );
188  
189 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.degradeInputs.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.degradeInputs.js
190 index 28abc52..6951e17 100644
191 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.degradeInputs.js
192 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.degradeInputs.js
193 @@ -26,7 +26,7 @@ $.mobile.page.prototype.options.degradeInputs = {
194  
195  
196  //auto self-init widgets
197 -$( document ).bind( "pagecreate create", function( e ) {
198 +$.mobile.$document.bind( "pagecreate create", function( e ) {
199  
200         var page = $.mobile.closestPageData( $( e.target ) ), options;
201  
202 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.fieldContain.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.fieldContain.js
203 index daf66e7..c7fd931 100644
204 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.fieldContain.js
205 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.fieldContain.js
206 @@ -19,7 +19,7 @@ $.fn.fieldcontain = function( options ) {
207  };
208  
209  //auto self-init widgets
210 -$( document ).bind( "pagecreate create", function( e ) {
211 +$.mobile.$document.bind( "pagecreate create", function( e ) {
212         $( ":jqmData(role='fieldcontain')", e.target ).jqmEnhanceable().fieldcontain();
213  });
214  
215 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.init.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.init.js
216 index 52f6434..d31ddf0 100644
217 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.init.js
218 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.init.js
219 @@ -10,7 +10,7 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
220  (function( $, window, undefined ) {
221         var     $html = $( "html" ),
222                         $head = $( "head" ),
223 -                       $window = $( window );
224 +                       $window = $.mobile.$window;
225  
226         //remove initial build class (only present on first pageshow)
227         function hideRenderingClass() {
228 @@ -70,7 +70,7 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
229                                 var $this = $( this );
230  
231                                 // unless the data url is already set set it to the pathname
232 -                               if ( !$this.jqmData( "url" ) ) {
233 +                               if ( !$this[0].getAttribute( "data-" + $.mobile.ns + "url" ) ) {
234                                         $this.attr( "data-" + $.mobile.ns + "url", $this.attr( "id" ) || location.pathname + location.search );
235                                 }
236                         });
237 @@ -79,7 +79,7 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
238                         $.mobile.firstPage = $pages.first();
239  
240                         // define page container
241 -                       $.mobile.pageContainer = $pages.first().parent().addClass( "ui-mobile-viewport" );
242 +                       $.mobile.pageContainer = $.mobile.firstPage.parent().addClass( "ui-mobile-viewport" );
243  
244                         // alert listeners that the pagecontainer has been determined for binding
245                         // to events triggered on it
246 @@ -127,13 +127,13 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
247                 // if defaultHomeScroll hasn't been set yet, see if scrollTop is 1
248                 // it should be 1 in most browsers, but android treats 1 as 0 (for hiding addr bar)
249                 // so if it's 1, use 0 from now on
250 -               $.mobile.defaultHomeScroll = ( !$.support.scrollTop || $( window ).scrollTop() === 1 ) ? 0 : 1;
251 +               $.mobile.defaultHomeScroll = ( !$.support.scrollTop || $.mobile.$window.scrollTop() === 1 ) ? 0 : 1;
252  
253  
254                 // TODO: Implement a proper registration mechanism with dependency handling in order to not have exceptions like the one below
255                 //auto self-init widgets for those widgets that have a soft dependency on others
256                 if ( $.fn.controlgroup ) {
257 -                       $( document ).bind( "pagecreate create", function( e ) {
258 +                       $.mobile.$document.bind( "pagecreate create", function( e ) {
259                                 $( ":jqmData(role='controlgroup')", e.target )
260                                         .jqmEnhanceable()
261                                         .controlgroup({ excludeInvisible: false });
262 @@ -154,7 +154,7 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.support", "./jquery
263                         // by adding the 'ui-disabled' class to them. Using a JavaScript workaround for those browser.
264                         // https://github.com/jquery/jquery-mobile/issues/3558
265  
266 -                       $( document ).delegate( ".ui-disabled", "vclick",
267 +                       $.mobile.$document.delegate( ".ui-disabled", "vclick",
268                                 function( e ) {
269                                         e.preventDefault();
270                                         e.stopImmediatePropagation();
271 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.links.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.links.js
272 index a3bfdba..4145d30 100644
273 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.links.js
274 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.links.js
275 @@ -8,7 +8,7 @@ define( [ "jquery" ], function( $ ) {
276  //>>excludeEnd("jqmBuildExclude");
277  (function( $, undefined ) {
278  
279 -$( document ).bind( "pagecreate create", function( e ) {
280 +$.mobile.$document.bind( "pagecreate create", function( e ) {
281  
282         //links within content areas, tests included with page
283         $( e.target )
284 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.media.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.media.js
285 index 73b6802..2068ca5 100644
286 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.media.js
287 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.media.js
288 @@ -8,7 +8,7 @@ define( [ "jquery", "./jquery.mobile.core" ], function( $ ) {
289  //>>excludeEnd("jqmBuildExclude");
290  (function( $, undefined ) {
291  
292 -var $window = $( window ),
293 +var $window = $.mobile.$window,
294         $html = $( "html" );
295  
296  /* $.mobile.media method: pass a CSS media type or query and get a bool return
297 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.navigation.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.navigation.js
298 index 9048789..203557a 100644
299 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.navigation.js
300 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.navigation.js
301 @@ -15,7 +15,7 @@ define( [
302  (function( $, undefined ) {
303  
304         //define vars for interal use
305 -       var $window = $( window ),
306 +       var $window = $.mobile.$window,
307                 $html = $( 'html' ),
308                 $head = $( 'head' ),
309  
310 @@ -1256,7 +1256,7 @@ define( [
311         $.mobile.navreadyDeferred = $.Deferred();
312         $.mobile.navreadyDeferred.done(function() {
313                 //bind to form submit events, handle with Ajax
314 -               $( document ).delegate( "form", "submit", function( event ) {
315 +               $.mobile.$document.delegate( "form", "submit", function( event ) {
316                         var $this = $( this );
317  
318                         if ( !$.mobile.ajaxEnabled ||
319 @@ -1309,7 +1309,7 @@ define( [
320                 });
321  
322                 //add active state on vclick
323 -               $( document ).bind( "vclick", function( event ) {
324 +               $.mobile.$document.bind( "vclick", function( event ) {
325                         // if this isn't a left click we don't care. Its important to note
326                         // that when the virtual event is generated it will create the which attr
327                         if ( event.which > 1 || !$.mobile.linkBindingEnabled ) {
328 @@ -1335,7 +1335,7 @@ define( [
329                 });
330  
331                 // click routing - direct to HTTP or Ajax, accordingly
332 -               $( document ).bind( "click", function( event ) {
333 +               $.mobile.$document.bind( "click", function( event ) {
334                         if ( !$.mobile.linkBindingEnabled ) {
335                                 return;
336                         }
337 @@ -1433,7 +1433,7 @@ define( [
338                 });
339  
340                 //prefetch pages when anchors with data-prefetch are encountered
341 -               $( document ).delegate( ".ui-page", "pageshow.prefetch", function() {
342 +               $.mobile.$document.delegate( ".ui-page", "pageshow.prefetch", function() {
343                         var urls = [];
344                         $( this ).find( "a:jqmData(prefetch)" ).each(function() {
345                                 var $link = $( this ),
346 @@ -1553,8 +1553,8 @@ define( [
347                 });
348  
349                 //set page min-heights to be device specific
350 -               $( document ).bind( "pageshow", resetActivePageHeight );
351 -               $( window ).bind( "throttledresize", resetActivePageHeight );
352 +               $.mobile.$document.bind( "pageshow", resetActivePageHeight );
353 +               $.mobile.$window.bind( "throttledresize", resetActivePageHeight );
354  
355         });//navreadyDeferred done callback
356  
357 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.navigation.pushstate.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.navigation.pushstate.js
358 index e0c73e4..10761d1 100644
359 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.navigation.pushstate.js
360 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.navigation.pushstate.js
361 @@ -11,14 +11,14 @@ define( [ "jquery", "./jquery.mobile.navigation", "depend!./jquery.hashchange[jq
362         // methods handed off as event handlers
363         var     pushStateHandler = {},
364                 self = pushStateHandler,
365 -               $win = $( window ),
366 +               $win = $.mobile.$window,
367                 url = $.mobile.path.parseLocation(),
368                 mobileinitDeferred = $.Deferred(),
369                 domreadyDeferred = $.Deferred();
370  
371 -       $( document ).ready( $.proxy( domreadyDeferred, "resolve" ) );
372 +       $.mobile.$document.ready( $.proxy( domreadyDeferred, "resolve" ) );
373  
374 -       $( document ).one( "mobileinit", $.proxy( mobileinitDeferred, "resolve" ) );
375 +       $.mobile.$document.one( "mobileinit", $.proxy( mobileinitDeferred, "resolve" ) );
376  
377         $.extend( pushStateHandler, {
378                 // TODO move to a path helper, this is rather common functionality
379 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.nojs.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.nojs.js
380 index 159d1fc..807a319 100644
381 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.nojs.js
382 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.nojs.js
383 @@ -7,7 +7,7 @@ define( [ "jquery" ], function( $ ) {
384  //>>excludeEnd("jqmBuildExclude");
385  (function( $, undefined ) {
386  
387 -$( document ).bind( "pagecreate create", function( e ) {
388 +$.mobile.$document.bind( "pagecreate create", function( e ) {
389         $( ":jqmData(role='nojs')", e.target ).addClass( "ui-nojs" );
390         
391  });
392 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.transition.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.transition.js
393 index cb7c9a7..f8edcee 100644
394 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.transition.js
395 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.transition.js
396 @@ -24,8 +24,8 @@ var createHandler = function( sequential ) {
397                         active  = $.mobile.urlHistory.getActive(),
398                         toScroll = active.lastScroll || $.mobile.defaultHomeScroll,
399                         screenHeight = $.mobile.getScreenHeight(),
400 -                       maxTransitionOverride = $.mobile.maxTransitionWidth !== false && $( window ).width() > $.mobile.maxTransitionWidth,
401 -                       none = !$.support.cssTransitions || maxTransitionOverride || !name || name === "none" || Math.max( $( window ).scrollTop(), toScroll ) > $.mobile.getMaxScrollForTransition(),
402 +                       maxTransitionOverride = $.mobile.maxTransitionWidth !== false && $.mobile.$window.width() > $.mobile.maxTransitionWidth,
403 +                       none = !$.support.cssTransitions || maxTransitionOverride || !name || name === "none" || Math.max( $.mobile.$window.scrollTop(), toScroll ) > $.mobile.getMaxScrollForTransition(),
404                         toPreClass = " ui-page-pre-in",
405                         toggleViewportClass = function() {
406                                 $.mobile.pageContainer.toggleClass( "ui-mobile-viewport-transitioning viewport-" + name );
407 @@ -35,7 +35,7 @@ var createHandler = function( sequential ) {
408                                 // Don't scoll window, when current scroll top(scrollTop()) is already at toScroll,
409                                 // or when current scroll top is 0 and toScroll is same to defaultHomeScroll
410                                 // (which means the top position of page). In these case, page scrolling is not needed.
411 -                               var st = $( window ).scrollTop();
412 +                               var st = $.mobile.$window.scrollTop();
413                                 if( st === toScroll || ( $.mobile.defaultHomeScroll === toScroll && st == 0 ) ) {
414                                         return;
415                                 }
416 @@ -68,7 +68,7 @@ var createHandler = function( sequential ) {
417                                 // Set the from page's height and start it transitioning out
418                                 // Note: setting an explicit height helps eliminate tiling in the transitions
419                                 $from
420 -                                       .height( screenHeight + $( window ).scrollTop() )
421 +                                       .height( screenHeight + $.mobile.$window.scrollTop() )
422                                         .addClass( name + " out" + reverseClass );
423                         },
424  
425 @@ -130,7 +130,7 @@ var createHandler = function( sequential ) {
426  
427                                 // In some browsers (iOS5), 3D transitions block the ability to scroll to the desired location during transition
428                                 // This ensures we jump to that spot after the fact, if we aren't there already.
429 -                               if ( $( window ).scrollTop() !== toScroll ) {
430 +                               if ( $.mobile.$window.scrollTop() !== toScroll ) {
431                                         scrollPage();
432                                 }
433  
434 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.vmouse.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.vmouse.js
435 index 25188d8..a98b73e 100644
436 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.vmouse.js
437 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.vmouse.js
438 @@ -38,7 +38,7 @@ var dataPropertyName = "virtualMouseBindings",
439         blockMouseTriggers = false,
440         blockTouchTriggers = false,
441         eventCaptureSupported = "addEventListener" in document,
442 -       $document = $( document ),
443 +       $document = $.mobile.$document,
444         nextTouchID = 1,
445         lastTouchID = 0, threshold;
446  
447 diff --git a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.zoom.iosorientationfix.js b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.zoom.iosorientationfix.js
448 index 71ddc8b..61917f7 100644
449 --- a/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.zoom.iosorientationfix.js
450 +++ b/libs/js/jquery-mobile-1.2.0/js/jquery.mobile.zoom.iosorientationfix.js
451 @@ -33,7 +33,7 @@ define( [ "jquery", "./jquery.mobile.core", "./jquery.mobile.zoom" ], function(
452      }
453    }
454  
455 -  $( window )
456 +  $.mobile.$window
457                 .bind( "orientationchange.iosorientationfix", zoom.enable )
458                 .bind( "devicemotion.iosorientationfix", checkTilt );
459  
460 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/collapsible.js b/libs/js/jquery-mobile-1.2.0/js/widgets/collapsible.js
461 index d56a24f..41492ca 100644
462 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/collapsible.js
463 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/collapsible.js
464 @@ -167,7 +167,7 @@ $.widget( "mobile.collapsible", $.mobile.widget, {
465  });
466  
467  //auto self-init widgets
468 -$( document ).bind( "pagecreate create", function( e ) {
469 +$.mobile.$document.bind( "pagecreate create", function( e ) {
470         $.mobile.collapsible.prototype.enhanceWithin( e.target );
471  });
472  
473 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/collapsibleSet.js b/libs/js/jquery-mobile-1.2.0/js/widgets/collapsibleSet.js
474 index ce66110..4c5a419 100644
475 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/collapsibleSet.js
476 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/collapsibleSet.js
477 @@ -108,7 +108,7 @@ $.widget( "mobile.collapsibleset", $.mobile.widget, {
478  });
479  
480  //auto self-init widgets
481 -$( document ).bind( "pagecreate create", function( e ) {
482 +$.mobile.$document.bind( "pagecreate create", function( e ) {
483         $.mobile.collapsibleset.prototype.enhanceWithin( e.target );
484  });
485  
486 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/dialog.js b/libs/js/jquery-mobile-1.2.0/js/widgets/dialog.js
487 index e04f557..d7a0795 100644
488 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/dialog.js
489 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/dialog.js
490 @@ -102,7 +102,7 @@ $.widget( "mobile.dialog", $.mobile.widget, {
491  });
492  
493  //auto self-init widgets
494 -$( document ).delegate( $.mobile.dialog.prototype.options.initSelector, "pagecreate", function() {
495 +$.mobile.$document.delegate( $.mobile.dialog.prototype.options.initSelector, "pagecreate", function() {
496         $.mobile.dialog.prototype.enhance( this );
497  });
498  
499 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/fixedToolbar.js b/libs/js/jquery-mobile-1.2.0/js/widgets/fixedToolbar.js
500 index 9e72b3d..ea9fe60 100644
501 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/fixedToolbar.js
502 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/fixedToolbar.js
503 @@ -133,7 +133,7 @@ define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jque
504                                         var thisPage = this;
505                                         self.updatePagePadding( thisPage );
506                                         if ( o.updatePagePadding ) {
507 -                                               $( window ).bind( "throttledresize." + self.widgetName, function() {
508 +                                               $.mobile.$window.bind( "throttledresize." + self.widgetName, function() {
509                                                         self.updatePagePadding( thisPage );
510                                                 });
511                                         }
512 @@ -143,7 +143,7 @@ define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jque
513                                                 $.mobile.zoom.enable( true );
514                                         }
515                                         if ( o.updatePagePadding ) {
516 -                                               $( window ).unbind( "throttledresize." + self.widgetName );
517 +                                               $.mobile.$window.unbind( "throttledresize." + self.widgetName );
518                                         }
519  
520                                         if ( o.trackPersistentToolbars ) {
521 @@ -179,7 +179,7 @@ define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jque
522                 },
523  
524                 _useTransition: function( notransition ) {
525 -                       var $win = $( window ),
526 +                       var $win = $.mobile.$window,
527                                 $el = this.element,
528                                 scroll = $win.scrollTop(),
529                                 elHeight = $el.height(),
530 @@ -262,7 +262,7 @@ define( [ "jquery", "../jquery.mobile.widget", "../jquery.mobile.core", "../jque
531         });
532  
533         //auto self-init widgets
534 -       $( document )
535 +       $.mobile.$document
536                 .bind( "pagecreate create", function( e ) {
537  
538                         // DEPRECATED in 1.1: support for data-fullscreen=true|false on the page element.
539 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/button.js b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/button.js
540 index 78f43a0..7b0141b 100644
541 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/button.js
542 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/button.js
543 @@ -95,7 +95,7 @@ $.widget( "mobile.button", $.mobile.widget, {
544                                                 }).insertBefore( $el );
545  
546                                                 // Bind to doc to remove after submit handling
547 -                                               $( document ).one( "submit", function() {
548 +                                               $.mobile.$document.one( "submit", function() {
549                                                         $buttonPlaceholder.remove();
550  
551                                                         // reset the local var so that the hidden input
552 @@ -146,7 +146,7 @@ $.widget( "mobile.button", $.mobile.widget, {
553  });
554  
555  //auto self-init widgets
556 -$( document ).bind( "pagecreate create", function( e ) {
557 +$.mobile.$document.bind( "pagecreate create", function( e ) {
558         $.mobile.button.prototype.enhanceWithin( e.target, true );
559  });
560  
561 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/checkboxradio.js b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/checkboxradio.js
562 index d28cdfb..a9f8f31 100644
563 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/checkboxradio.js
564 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/checkboxradio.js
565 @@ -211,7 +211,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
566  });
567  
568  //auto self-init widgets
569 -$( document ).bind( "pagecreate create", function( e ) {
570 +$.mobile.$document.bind( "pagecreate create", function( e ) {
571         $.mobile.checkboxradio.prototype.enhanceWithin( e.target, true );
572  });
573  
574 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/select.custom.js b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/select.custom.js
575 index 98d2fe6..85a024f 100644
576 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/select.custom.js
577 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/select.custom.js
578 @@ -332,7 +332,7 @@ define( [
579                                 }
580  
581                                 var self = this,
582 -                                       $window = $( window ),
583 +                                       $window = $.mobile.$window,
584                                         selfListParent = self.list.parent(),
585                                         menuHeight = selfListParent.outerHeight(),
586                                         menuWidth = selfListParent.outerWidth(),
587 @@ -510,7 +510,7 @@ define( [
588         };
589  
590         // issue #3894 - core doesn't trigger events on disabled delegates
591 -       $( document ).bind( "selectmenubeforecreate", function( event ) {
592 +       $.mobile.$document.bind( "selectmenubeforecreate", function( event ) {
593                 var selectmenuWidget = $( event.target ).data( "selectmenu" );
594  
595                 if ( !selectmenuWidget.options.nativeMenu &&
596 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/select.js b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/select.js
597 index 3c70fed..a8b0f9f 100644
598 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/select.js
599 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/select.js
600 @@ -252,7 +252,7 @@ $.widget( "mobile.selectmenu", $.mobile.widget, {
601  });
602  
603  //auto self-init widgets
604 -$( document ).bind( "pagecreate create", function( e ) {
605 +$.mobile.$document.bind( "pagecreate create", function( e ) {
606         $.mobile.selectmenu.prototype.enhanceWithin( e.target, true );
607  });
608  })( jQuery );
609 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/slider.js b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/slider.js
610 index 1bd4adf..c6d4c9b 100644
611 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/slider.js
612 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/slider.js
613 @@ -178,7 +178,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
614                         }
615                 }
616  
617 -               this._on( $( document ), { "vmousemove": this._preventDocumentDrag });
618 +               this._on( $.mobile.$document, { "vmousemove": this._preventDocumentDrag });
619  
620                 // it appears the clicking the up and down buttons in chrome on
621                 // range/number inputs doesn't trigger a change until the field is
622 @@ -468,7 +468,7 @@ $.widget( "mobile.slider", $.mobile.widget, {
623  });
624  
625  //auto self-init widgets
626 -$( document ).bind( "pagecreate create", function( e ) {
627 +$.mobile.$document.bind( "pagecreate create", function( e ) {
628         $.mobile.slider.prototype.enhanceWithin( e.target, true );
629  });
630  
631 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/textinput.js b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/textinput.js
632 index 05b1b03..075d35d 100644
633 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/textinput.js
634 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/textinput.js
635 @@ -93,13 +93,13 @@ $.widget( "mobile.textinput", $.mobile.widget, {
636  
637                         // binding to pagechange here ensures that for pages loaded via
638                         // ajax the height is recalculated without user input
639 -                       this._on( $(document), {"pagechange": "_keyup" });
640 +                       this._on( $.mobile.$document, {"pagechange": "_keyup" });
641  
642                         // Issue 509: the browser is not providing scrollHeight properly until the styles load
643                         if ( $.trim( input.val() ) ) {
644                                 // bind to the window load to make sure the height is calculated based on BOTH
645                                 // the DOM and CSS
646 -                               this._on( $(window), {"load": "_keyup"});
647 +                               this._on( $.mobile.$window, {"load": "_keyup"});
648                         }
649                 }
650                 if ( input.attr( "disabled" ) ) {
651 @@ -133,7 +133,7 @@ $.widget( "mobile.textinput", $.mobile.widget, {
652  });
653  
654  //auto self-init widgets
655 -$( document ).bind( "pagecreate create", function( e ) {
656 +$.mobile.$document.bind( "pagecreate create", function( e ) {
657         $.mobile.textinput.prototype.enhanceWithin( e.target, true );
658  });
659  
660 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/listview.autodividers.js b/libs/js/jquery-mobile-1.2.0/js/widgets/listview.autodividers.js
661 index 4d947b4..ae123a8 100644
662 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/listview.autodividers.js
663 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/listview.autodividers.js
664 @@ -21,7 +21,7 @@ $.mobile.listview.prototype.options.autodividersSelector = function( elt ) {
665         return text;
666  };
667  
668 -$( document ).delegate( "ul,ol", "listviewcreate", function() {
669 +$.mobile.$document.delegate( "ul,ol", "listviewcreate", function() {
670  
671         var list = $( this ),
672                         listview = list.data( "listview" );
673 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/listview.filter.js b/libs/js/jquery-mobile-1.2.0/js/widgets/listview.filter.js
674 index 0774615..0519b9a 100644
675 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/listview.filter.js
676 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/listview.filter.js
677 @@ -18,7 +18,7 @@ var defaultFilterCallback = function( text, searchValue, item ) {
678  
679  $.mobile.listview.prototype.options.filterCallback = defaultFilterCallback;
680  
681 -$( document ).delegate( ":jqmData(role='listview')", "listviewcreate", function() {
682 +$.mobile.$document.delegate( ":jqmData(role='listview')", "listviewcreate", function() {
683  
684         var list = $( this ),
685                 listview = list.data( "listview" );
686 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/listview.js b/libs/js/jquery-mobile-1.2.0/js/widgets/listview.js
687 index ef1e178..e46f842 100644
688 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/listview.js
689 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/listview.js
690 @@ -521,7 +521,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
691  });
692  
693  //auto self-init widgets
694 -$( document ).bind( "pagecreate create", function( e ) {
695 +$.mobile.$document.bind( "pagecreate create", function( e ) {
696         $.mobile.listview.prototype.enhanceWithin( e.target );
697  });
698  
699 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/loader.js b/libs/js/jquery-mobile-1.2.0/js/widgets/loader.js
700 index 6d2f2bc..b028698 100644
701 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/loader.js
702 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/loader.js
703 @@ -38,7 +38,7 @@ define( [ "jquery",   "../jquery.mobile.core", "../jquery.mobile.widget" ], functi
704         });
705  
706         // TODO move loader class down into the widget settings
707 -       var loaderClass = "ui-loader", $html = $( "html" ), $window = $( window );
708 +       var loaderClass = "ui-loader", $html = $( "html" ), $window = $.mobile.$window;
709  
710         $.widget( "mobile.loader", {
711                 // NOTE if the global config settings are defined they will override these
712 @@ -170,8 +170,8 @@ define( [ "jquery", "../jquery.mobile.core", "../jquery.mobile.widget" ], functi
713                                 this.element.removeClass( "ui-loader-fakefix" );
714                         }
715  
716 -                       $( window ).unbind( "scroll", $.proxy( this.fakeFixLoader, this) );
717 -                       $( window ).unbind( "scroll", $.proxy( this.checkLoaderPosition, this ) );
718 +                       $.mobile.$window.unbind( "scroll", $.proxy( this.fakeFixLoader, this) );
719 +                       $.mobile.$window.unbind( "scroll", $.proxy( this.checkLoaderPosition, this ) );
720                 }
721         });
722  
723 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/navbar.js b/libs/js/jquery-mobile-1.2.0/js/widgets/navbar.js
724 index 65f5869..29c5057 100644
725 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/navbar.js
726 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/navbar.js
727 @@ -52,7 +52,7 @@ $.widget( "mobile.navbar", $.mobile.widget, {
728  });
729  
730  //auto self-init widgets
731 -$( document ).bind( "pagecreate create", function( e ) {
732 +$.mobile.$document.bind( "pagecreate create", function( e ) {
733         $.mobile.navbar.prototype.enhanceWithin( e.target );
734  });
735  
736 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/page.sections.js b/libs/js/jquery-mobile-1.2.0/js/widgets/page.sections.js
737 index 90a298a..e00684c 100644
738 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/page.sections.js
739 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/page.sections.js
740 @@ -18,10 +18,11 @@ $.mobile.page.prototype.options.contentTheme = null;
741  //      which expects .ui-footer top be applied in its gigantic selector
742  // TODO remove the buttonMarkup giant selector and move it to the various modules
743  //      on which it depends
744 -$( document ).bind( "pagecreate", function( e ) {
745 +$.mobile.$document.bind( "pagecreate", function( e ) {
746         var $page = $( e.target ),
747                 o = $page.data( "page" ).options,
748 -               pageRole = $page.jqmData( "role" ),
749 +               prefix = "data-"+$.mobile.ns,
750 +               pageRole = $page[0].getAttribute( prefix + "role" ) || undefined,
751                 pageTheme = o.theme;
752  
753         $( ":jqmData(role='header'), :jqmData(role='footer'), :jqmData(role='content')", $page )
754 @@ -29,8 +30,8 @@ $( document ).bind( "pagecreate", function( e ) {
755                 .each(function() {
756  
757                 var $this = $( this ),
758 -                       role = $this.jqmData( "role" ),
759 -                       theme = $this.jqmData( "theme" ),
760 +                       role = $this[0].getAttribute( prefix + "role" ) || undefined,
761 +                       theme = $this[0].getAttribute( prefix + "theme" ) || undefined,
762                         contentTheme = theme || o.contentTheme || ( pageRole === "dialog" && pageTheme ),
763                         $headeranchors,
764                         leftbtn,
765 @@ -65,7 +66,7 @@ $( document ).bind( "pagecreate", function( e ) {
766                         // Auto-add back btn on pages beyond first view
767                         if ( o.addBackBtn &&
768                                 ( role === "footer" || role === "header" ) &&
769 -                               $page.jqmData( "url" ) !== $.mobile.path.stripHash( location.hash ) &&
770 +                               $page[0].getAttribute( prefix + "url" ) !== $.mobile.path.stripHash( location.hash ) &&
771                                 !leftbtn ) {
772  
773                                 if ( o.addBackBtn == "header" ) {
774 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/popup.js b/libs/js/jquery-mobile-1.2.0/js/widgets/popup.js
775 index b9a950e..13cb548 100644
776 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/popup.js
777 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/popup.js
778 @@ -28,7 +28,7 @@ define( [ "jquery",
779         }
780  
781         function windowCoords() {
782 -               var $win = $( window );
783 +               var $win = $.mobile.$window;
784  
785                 return {
786                         x: $win.scrollLeft(),
787 @@ -192,7 +192,7 @@ define( [ "jquery",
788                                 _orientationchangeInProgress: false,
789                                 _globalHandlers: [
790                                         {
791 -                                               src: $( window ),
792 +                                               src: $.mobile.$window,
793                                                 handler: {
794                                                         orientationchange: $.proxy( this, "_handleWindowOrientationchange" ),
795                                                         resize: $.proxy( this, "_handleWindowResize" ),
796 @@ -886,14 +886,14 @@ define( [ "jquery",
797         };
798  
799         // TODO move inside _create
800 -       $( document ).bind( "pagebeforechange", function( e, data ) {
801 +       $.mobile.$document.bind( "pagebeforechange", function( e, data ) {
802                 if ( data.options.role === "popup" ) {
803                         $.mobile.popup.handleLink( data.options.link );
804                         e.preventDefault();
805                 }
806         });
807  
808 -       $( document ).bind( "pagecreate create", function( e )  {
809 +       $.mobile.$document.bind( "pagecreate create", function( e )  {
810                 $.mobile.popup.prototype.enhanceWithin( e.target, true );
811         });
812  
813 -- 
814 1.7.5.4
815
816