Skip to content

Commit af3a89b

Browse files
arschmitzjaspermdegroot
authored andcommitted
Pagecontainer: Update events and deprecations for 1.4.3
Closes gh-297
1 parent 4928f3c commit af3a89b

8 files changed

+136
-35
lines changed

entries/pagebeforechange.xml

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0"?>
2-
<entry name="pagebeforechange" type="event" return="">
2+
<entry name="pagebeforechange" new-event-name="pagecontainerbeforechange" type="event" return="" deprecated="1.4.3">
33
<title>pagebeforechange</title>
44
<desc>Triggered twice during the page change cyle: First prior to any page loading or transition and next after page loading completes successfully, but before the browser history has been modified by the navigation process.</desc>
55
<longdesc>
66
<p>When received with <code>data.toPage</code> set to a string, the event indicates that navigation is about to commence. The value stored in <code>data.toPage</code> is the URL of the page that will be loaded.</p>
77
<p>When received with <code>data.toPage</code> set to a jQuery object, the event indicates that the destination page has been loaded and navigation will continue.</p>
88
<p>During the handling of this event the browser's history has not yet changed.</p>
99
<p>In addition to the <code>event</code> parameter, handlers of this event will receive a second parameter, <code>data</code>. The second parameter is an object containing the following properties:</p>
10-
<ul>
10+
<ul>
1111
<li><code>toPage</code> (object or string)
1212
<ul>
1313
<li>This property represents the page the caller wishes to make active. It can be either a jQuery collection object containing the page DOM element, or an absolute/relative url to an internal or external page. The value exactly matches the 1st arg to the changePage() call that triggered the event.</li>
@@ -19,7 +19,8 @@
1919
</ul>
2020
</li>
2121
</ul>
22-
<p>It should be noted that callbacks can modify both the <code>toPage</code> and <code>options</code> properties to alter the behavior of the current <code>changePage()</code> call. So for example, the <code>toPage</code> can be mapped to a different url from within a callback to do a sort of redirect.</p>
22+
<p>It should be noted that callbacks can modify both the <code>toPage</code> and <code>options</code> properties to alter the behavior of the current <code>changePage()</code> call. So for example, the <code>toPage</code> can be mapped to a different url from within a callback to do a sort of redirect.</p>
23+
<xi:include href="../includes/pageevent-deprecation-1-6.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
2324
</longdesc>
2425
<added>1.0</added>
2526
<signature>

entries/pagebeforecreate.xml

+1-13
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,7 @@
33
<title>pagebeforecreate</title>
44
<desc>Triggered on the page being initialized, before most plugin auto-initialization occurs.</desc>
55
<longdesc>
6-
<pre><code><![CDATA[
7-
$( "#aboutPage" ).on( "pagebeforecreate", function( event ) {
8-
alert( "This page was just inserted into the dom!" );
9-
});
10-
]]></code></pre>
11-
12-
<p>Note that by binding to pagebeforecreate, you can manipulate markup before jQuery Mobile's default widgets are auto-initialized. For example, say you want to add data attributes via JavaScript instead of in the HTML source, this is the event you'd use.</p>
13-
14-
<pre><code><![CDATA[
15-
$( "#aboutPage" ).on( "pagebeforecreate", function( event ) {
16-
// manipulate this page before its widgets are auto-initialized
17-
});
18-
]]></code></pre>
6+
<p><strong>Note:</strong>This event is part of the <code><a href="/page/">page</a></code> widget as of jQuery Mobile 1.4.0. Please consult the documentation for the page widget's <a href="/page/#event-create">implementation</a>.</p>
197
</longdesc>
208
<added>1.0</added>
219
<signature>

entries/pagebeforehide.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
2-
<entry name="pagebeforehide" new-event-name="pagecontainerbeforehide" type="event" return="">
2+
<entry name="pagebeforehide" new-event-name="pagecontainerbeforehide" type="event" return="" deprecated="1.4.0">
33
<title>pagebeforehide</title>
44
<desc>Triggered on the "fromPage" we are transitioning away from, before the actual transition animation is kicked off.</desc>
55
<longdesc>

entries/pagechange.xml

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
<?xml version="1.0"?>
2-
<entry name="pagechange" type="event" return="">
2+
<entry name="pagechange" new-event-name="pagecontainerchange" type="event" return="" deprecated="1.4.3">
33
<title>pagechange</title>
44
<desc>This event is triggered after the <code>changePage()</code> request has finished loading the page into the DOM and all page transition animations have completed. </desc>
55
<longdesc>
66
<p>Note that any pageshow or pagehide events will have fired *BEFORE* this event is triggered. Callbacks for this particular event will be passed a data object as the 2nd arg. The properties for this object are as follows: </p>
7-
<ul>
8-
<li><code>toPage</code> (object or string)
9-
<ul>
10-
<li>This property represents the page the caller wishes to make active. It can be either a jQuery collection object containing the page DOM element, or an absolute/relative url to an internal or external page. The value exactly matches the 1st arg to the changePage() call that triggered the event.</li>
11-
</ul>
12-
</li>
13-
<li><code>options</code> (object)
14-
<ul>
15-
<li>This object contains the configuration options to be used for the current <code>changePage()</code> call.</li>
16-
</ul>
17-
</li>
18-
</ul>
19-
7+
<ul>
8+
<li><code>toPage</code> (object or string)
9+
<ul>
10+
<li>This property represents the page the caller wishes to make active. It can be either a jQuery collection object containing the page DOM element, or an absolute/relative url to an internal or external page. The value exactly matches the 1st arg to the changePage() call that triggered the event.</li>
11+
</ul>
12+
</li>
13+
<li><code>options</code> (object)
14+
<ul>
15+
<li>This object contains the configuration options to be used for the current <code>changePage()</code> call.</li>
16+
</ul>
17+
</li>
18+
</ul>
19+
<xi:include href="../includes/pageevent-deprecation-1-6.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
2020
</longdesc>
2121
<added>1.0</added>
2222
<signature>

entries/pagecontainer.xml

+108-1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,25 @@
8686
</options>
8787

8888
<events>
89+
<event name="beforechange">
90+
<desc>Triggered during the page change cyle prior to any page loading or transition.</desc>
91+
<argument name="event" type="Event" />
92+
<argument name="ui" type="Object">
93+
<property name="toPage">
94+
<desc>This property represents the page the caller wishes to make active. It can be either a jQuery collection object containing the page DOM element, or an absolute/relative url to an internal or external page. The value exactly matches the 1st arg to the changePage() call that triggered the event.</desc>
95+
<type name="jQuery"/>
96+
<type name="String"/>
97+
</property>
98+
<property name="prevPage">
99+
<desc>A jQuery collection object that contains the from page DOM element.</desc>
100+
<type name="jQuery"/>
101+
</property>
102+
<property name="options">
103+
<desc>The configuration options to be used for the current <code>change()</code> call</desc>
104+
<type name="jQuery"/>
105+
</property>
106+
</argument>
107+
</event>
89108
<event name="beforehide">
90109
<desc>Triggered before the actual transition animation is kicked off.</desc>
91110
<argument name="event" type="Event" />
@@ -94,6 +113,14 @@
94113
<desc>A jQuery collection object that contains the destination page DOM element.</desc>
95114
<type name="jQuery"/>
96115
</property>
116+
<property name="toPage">
117+
<desc>A jQuery collection object that contains the destination page DOM element.</desc>
118+
<type name="jQuery"/>
119+
</property>
120+
<property name="prevPage">
121+
<desc>A jQuery collection object that contains the from page DOM element.</desc>
122+
<type name="jQuery"/>
123+
</property>
97124
</argument>
98125
</event>
99126
<event name="beforeload">
@@ -114,6 +141,14 @@
114141
<desc>The filtered version of absUrl to be used when identifying the page and updating the browser location when the page is made active.</desc>
115142
<type name="String"/>
116143
</property>
144+
<property name="toPage">
145+
<desc>A string containing the url being loaded</desc>
146+
<type name="String"/>
147+
</property>
148+
<property name="prevPage">
149+
<desc>A jQuery collection object that contains the from page DOM element.</desc>
150+
<type name="jQuery"/>
151+
</property>
117152
<property name="deferred">
118153
<desc>Deferred to be resolved or rejected upon completion of content load. Callbacks that call <code>preventDefault()</code> on the event <strong>MUST</strong> call <code>resolve()</code> or <code>reject()</code> on this object so that <code>change()</code> requests resume processing. Deferred object observers expect the deferred object to be resolved like this:
119154
<pre><code><![CDATA[
@@ -167,6 +202,10 @@ $( document ).on( "pagecontainerbeforeload", function( event, data ) {
167202
<desc>A jQuery collection object that contains the source page DOM element.</desc>
168203
<type name="jQuery"/>
169204
</property>
205+
<property name="toPage">
206+
<desc>A jQuery collection object that contains the destination page DOM element.</desc>
207+
<type name="jQuery"/>
208+
</property>
170209
</argument>
171210
</event>
172211
<event name="beforetransition">
@@ -186,9 +225,27 @@ $( document ).on( "pagecontainerbeforeload", function( event, data ) {
186225
<type name="String" />
187226
</property>
188227
<property name="toPage">
189-
<desc>This property represents the page to which the caller wishes to transition. It is a jQuery collection object containing the page DOM element.</desc>
228+
<desc>A jQuery collection object that contains the destination page DOM element.</desc>
190229
<type name="jQuery" />
191230
</property>
231+
<property name="prevPage">
232+
<desc>A jQuery collection object that contains the from page DOM element.</desc>
233+
<type name="jQuery"/>
234+
</property>
235+
</argument>
236+
</event>
237+
<event name="change">
238+
<desc>This event is triggered after the change request has finished loading the page into the DOM and all page transition animations have completed.</desc>
239+
<argument name="event" type="Event" />
240+
<argument name="ui" type="Object">
241+
<property name="prevPage">
242+
<desc>A jQuery collection object that contains the source page DOM element.</desc>
243+
<type name="jQuery"/>
244+
</property>
245+
<property name="toPage">
246+
<desc>A jQuery collection object that contains the destination page DOM element.</desc>
247+
<type name="jQuery"/>
248+
</property>
192249
</argument>
193250
</event>
194251
<event name="changefailed">
@@ -204,6 +261,10 @@ $( document ).on( "pagecontainerbeforeload", function( event, data ) {
204261
<desc>The configuration options to be used for the current <code>change()</code> call.</desc>
205262
<type name="Object" />
206263
</property>
264+
<property name="prevPage">
265+
<desc>A jQuery collection object that contains the from page DOM element.</desc>
266+
<type name="jQuery"/>
267+
</property>
207268
</argument>
208269
</event>
209270
<xi:include href="../includes/widget-event-create.xml" xmlns:xi="http://www.w3.org/2003/XInclude" />
@@ -224,6 +285,14 @@ $( ":mobile-pagecontainer" ).on( "pagecontainerhide", function( event, ui ) {
224285
<desc>A jQuery collection object that contains the page DOM element to which we just transitioned.</desc>
225286
<type name="jQuery" />
226287
</property>
288+
<property name="toPage">
289+
<desc>A jQuery collection object that contains the destination page DOM element.</desc>
290+
<type name="jQuery"/>
291+
</property>
292+
<property name="prevPage">
293+
<desc>A jQuery collection object that contains the from page DOM element.</desc>
294+
<type name="jQuery"/>
295+
</property>
227296
</argument>
228297
</event>
229298
<event name="load">
@@ -254,6 +323,14 @@ $( ":mobile-pagecontainer" ).on( "pagecontainerhide", function( event, ui ) {
254323
<desc>According to the jQuery Core <a href="//api.jquery.com/jQuery.ajax/">documentation</a>, this will be a string describing the status. This is what gets passed as the 2nd argument to the framework's <code>$.ajax()</code> error callback. It may also be <code>null</code>.</desc>
255324
<type name="String" />
256325
</property>
326+
<property name="toPage">
327+
<desc>A jQuery collection object that contains the destination page DOM element.</desc>
328+
<type name="jQuery"/>
329+
</property>
330+
<property name="prevPage">
331+
<desc>A jQuery collection object that contains the from page DOM element in a detached state.</desc>
332+
<type name="jQuery"/>
333+
</property>
257334
</argument>
258335
</event>
259336
<event name="loadfailed">
@@ -274,6 +351,14 @@ $( ":mobile-pagecontainer" ).on( "pagecontainerhide", function( event, ui ) {
274351
<desc>The filtered version of absUrl to be used when identifying the page and updating the browser location when the page is made active.</desc>
275352
<type name="String"/>
276353
</property>
354+
<property name="toPage">
355+
<desc>A string containing the url the was attempted to be loaded.</desc>
356+
<type name="String"/>
357+
</property>
358+
<property name="prevPage">
359+
<desc>A jQuery collection object that contains the from page DOM element.</desc>
360+
<type name="jQuery"/>
361+
</property>
277362
<property name="deferred">
278363
<desc>Callbacks that call <code>preventDefault()</code> on the event, <strong>MUST</strong> call <code>resolve()</code> or <code>reject()</code> on this object so that <code>change()</code> requests resume processing. Deferred object observers expect the deferred object to be resolved like this:
279364
<pre><code><![CDATA[
@@ -332,6 +417,20 @@ $( document ).on( "pageloadfailed", function( event, data ) {
332417
</property>
333418
</argument>
334419
</event>
420+
<event name="remove">
421+
<desc>Triggered just before the framework attempts to remove an external page from the DOM.</desc>
422+
<argument name="event" type="Event" />
423+
<argument name="ui" type="Object">
424+
<property name="toPage">
425+
<desc>A jQuery collection object that contains the destination page DOM element.</desc>
426+
<type name="jQuery"/>
427+
</property>
428+
<property name="prevPage">
429+
<desc>The page about to be removed</desc>
430+
<type name="jQuery"/>
431+
</property>
432+
</argument>
433+
</event>
335434
<event name="show">
336435
<desc>Triggered after the transition animation has completed.<strong>Note:</strong> Unlike the deprecated <code>pageshow</code> event, this event is not triggered on the "toPage" but the <placeholder name="name"/> widget's element.
337436
<p>You can access the <code>prevPage</code> properties via the second argument of a bound callback function. For example: </p>
@@ -344,6 +443,10 @@ $( ":mobile-pagecontainer" ).on( "pagecontainershow", function( event, ui ) {
344443
</desc>
345444
<argument name="event" type="Event"/>
346445
<argument name="ui" type="Object">
446+
<property name="toPage">
447+
<desc>A jQuery collection object that contains the destination page DOM element.</desc>
448+
<type name="jQuery"/>
449+
</property>
347450
<property name="prevPage">
348451
<desc>A jQuery collection object that contains the page DOM element that we just transitioned away from. Note that this collection is empty when the first page is transitioned in during application startup.</desc>
349452
<type name="jQuery"/>
@@ -370,6 +473,10 @@ $( ":mobile-pagecontainer" ).on( "pagecontainershow", function( event, ui ) {
370473
<desc>This property represents the page to which the caller has transitioned. It is a jQuery collection object containing the page DOM element.</desc>
371474
<type name="jQuery" />
372475
</property>
476+
<property name="prevPage">
477+
<desc>A jQuery collection object that contains the from page DOM element.</desc>
478+
<type name="jQuery"/>
479+
</property>
373480
</argument>
374481
</event>
375482
</events>

entries/pageremove.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0"?>
2-
<entry name="pageremove" type="event" return="">
2+
<entry name="pageremove" new-event-name="pagecontainerremove" type="event" return="" deprecated="1.4.3">
33
<title>pageremove</title>
44
<desc>Triggered just before the framework attempts to remove an external page from the DOM.</desc>
55
<longdesc>
66
<p>By default, the framework removes any non active dynamically loaded external pages from the DOM as soon as the user navigates away to a different page. The <code>pageremove</code> event is dispatched just before the framework attempts to remove the page from the DOM.</p>
77
<p>This event is triggered just before the framework attempts to remove an external page from the DOM. Event callbacks can call preventDefault on the event object to prevent the page from being removed. </p>
8-
8+
<xi:include href="../includes/pageevent-deprecation-1-6.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
99
</longdesc>
1010
<added>1.0</added>
1111
<signature>
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0"?>
2+
<div class="warning">
3+
<strong>Note:</strong> The triggering of this event is deprecated as of jQuery Mobile 1.4.3. It will no longer be triggered in 1.6.0.
4+
<p>The replacement for <code><placeholder name="name"/></code> is the <code><a href="/pagecontainer/">pagecontainer</a></code> widget's <code><placeholder name="new-event-name"/></code> event. In jQuery Mobile >= 1.4.3, the two events are identical except for their name and the fact that <code><placeholder name="new-event-name"/></code> is triggered on the pagecontainer, whereas <code><placeholder name="name"/></code> is triggered on the page.</p>
5+
</div>

includes/pageevent-deprecation.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0"?>
22
<div class="warning">
3-
<strong>Note:</strong> The triggering of this event is deprecated as of jQuery Mobile 1.4.0. It will no longer be triggered in 1.5.0.
3+
<strong>Note:</strong> The triggering of this event is deprecated as of jQuery Mobile 1.4.0. It will no longer be triggered in 1.6.0.
44
<p>The replacement for <code><placeholder name="name"/></code> is the <code><a href="/pagecontainer/">pagecontainer</a></code> widget's <code><placeholder name="new-event-name"/></code> event. In jQuery Mobile 1.4.0, the two events are identical except for their name and the fact that <code><placeholder name="new-event-name"/></code> is triggered on the pagecontainer, whereas <code><placeholder name="name"/></code> is triggered on the page.</p>
55
</div>

0 commit comments

Comments
 (0)