Commit graph

318 commits

Author SHA1 Message Date
John Bender
f0db137ed9 render prefetched pages according to their data-rel attr fixes #2335 2011-10-11 16:19:18 -07:00
Kin Blas
c297f9675b Fix for issue #2644 - Navigating to root "/" does not generate clean URL if root page has id="*"
- Fixed a bug in the hashchange handler for the pushstate/replacestate plugin that was incorrectly resolving hashchanges for ids against the current location.href, which could be a different document. We now resolve id hashes against the document URL.

- Modified changePage() so that it sets the settings.dataUrl option to the documentUrl, when navigating to the first-page of the application document. This prevents any id on the first-page from being added to the location hash. This means that URLs that used to be produced like this:

	http://site.com/apps/#first-page-id

will now display as:

		http://site.com/apps/

Developers that wish to get the old behavior back can register a pagebeforechange handler and do something like this:

	$( document ).bind( "pagebeforechange", function( e, data ) {
		var toPage = data.toPage;
		if ( typeof toPage === "object" && !data.options.dataUrl && toPage[ 0 ] === $.mobile.firstPage[ 0 ] && toPage[ 0 ].id ) {
			data.options.dataUrl = "#" + toPage[ 0 ].id;
		}
	});

The handler above will make sure that any page changes to the first-page will always display as:

	http://site.com/apps/#first-page-id
2011-10-10 11:04:04 -07:00
John Bender
71b0eb0552 move $.fn.text invocation to $.fn.getEncodedTest where the content is being re-added to the dom for xss safety Fixes #2550 2011-10-04 18:25:54 -07:00
Kin Blas
8a25599b82 Merge branch 'master' of https://github.com/jquery/jquery-mobile 2011-09-30 12:43:30 -07:00
Kin Blas
98eda9a0f4 Fixes #2582 - Refreshing a page with #&ui-state=dialog causes page duplication
- Modified loadPage() to call isFirstPage() with fileUrl instead of absUrl. Since fileUrl is the same as absUrl, but with the dialogHashKey stripped off, it will allow us to match against the url for the first-page.
2011-09-30 12:38:16 -07:00
Kin Blas
5a76ae7ed2 Merge branch 'master' of https://github.com/jquery/jquery-mobile 2011-09-30 09:19:15 -07:00
Kin Blas
bafc18723b Fixes #2574 - namespace pollution on 'search' variable (1.0rc1)
- There was a typo in the var declaration in makeUrlAbsolute(). Changed the ';' in the middle of the declaration to ','.
2011-09-30 09:17:05 -07:00
Kin Blas
47812171f1 Fixes #2570 - Refreshing a page with #&ui-state=dialog causes syntax error
- This was a regression from my fix to loadPage() for detecting un-enhanced pages by @id as a fallback. In this particular case dataUrl was being used to create an id selector, and of course if the dataUrl is an empty string we end up using "#" as the selector. The fix is to simply check for a non-empty dataUrl.
2011-09-29 15:16:21 -07:00
Kin Blas
972500bbbc Re-merge pull request #1550 from MaxThrax/master.
- Not sure what happened when I originally merged this back on 05/02/2011, but here it is again!
2011-09-28 22:08:30 -07:00
Kin Blas
34fb7b2dc1 Fixes #2537 - Add new pageremove event
- Modified the pagehide callback in $.mobile._bindPageRemove() so that it fires off a "pageremove" event. Callbacks can prevent the removal of the page by simply calling preventDefault() on the pagremove event object that is passed to their callback.
2011-09-28 11:37:46 -07:00
Kin Blas
6cd1e1b141 Fix for issue 2529 - Transition to the same page
- Added a new allowSamePageTransition option to the changePage() method default settings.

By default, we prevent changePage() requests when the fromPage and toPage are the same element, but folks that generate content manually/dynamically and reuse pages want to be able to transition to the same page. To allow
this, they will need to change the default value of allowSamePageTransition to true, *OR*, pass it in as an option when they manually call changePage().

It should be noted that our default transition animations assume that the formPage and toPage are different elements, so they may behave unexpectedly. It is up to the developer that turns on the allowSamePageTransitiona option
to either turn off transition animations, or make sure that an appropriate animation transition is used.

	// To toggle the default behavior for all changePage() calls,
	// set the default value of allowSamePageTransition to whatever
	// you want it to be. The default is false.

	$.mobile.changePage.defaults.allowSamePageTransition = true;

	// To specify the behavior when manually calling changePage(),
	// pass it as an option. If not specified, the default value
	// specified by $.mobile.changepage.defaults.allowSamePageTransition
	// is used.

	$.mobile.changePage( "#reused-page", { allowSamePageTransition: true } );
2011-09-26 10:23:47 -07:00
scottjehl
23e79fb1db better fix for the ios5 height issue with the bottom of the page. 2011-09-24 00:55:50 -04:00
scottjehl
52e1022697 adjusted the fallback heights. addresses the ios5 fixed footer alignment described in issue #2415 2011-09-24 00:33:44 -04:00
John Bender
f029230e3a handle all dialog closing cases 2011-09-23 16:32:56 -07:00
John Bender
e741bc2da6 force close logic of custom select to run when close is clicked, centralize the binding for pagehide.remove 2011-09-23 16:32:56 -07:00
John Bender
b837a49b32 add dependent tracking functions for jquery mobile objects 2011-09-23 16:32:56 -07:00
Scott Jehl
adc1ecc2e6 Merge pull request #2519 from Wilto/master
Various and Sundry Fixes
2011-09-23 15:20:19 -07:00
Mat Marquis
dec502d2c8 Prevents “undefined is null or not an object†error in IE, where .scrollTop() was being called before the body was ready. 2011-09-23 18:05:12 -04:00
Kin Blas
4f066b7e07 Fix for issue 2503 - User can't specify own error handling logic
- Added the following notifications to $.mobile.loadPage():

	- pagebeforeload
		- Triggered just before loadPage() attempts to dynamically load an external page.
		- Developers can prevent the default loading behavior by calling preventDefault() on the event. If preventDefault() is called, it is up to the developer to call resolve()/reject() on the deferred object passed within the data object (2nd arg to the event callback).

	- pageload
		- Triggered after an external page has been loaded and inserted into the document.

	- pageloadfailed
		- Triggered when the load of an external page fails.
		- Developers can prevent the default behavior (error dialog display) by calling preventDefault() on the event. If preventDefault() is called, it is up to the developer to call resolve()/reject() on the deferred object (2nd arg to the event callback).
2011-09-23 14:12:40 -07:00
scottjehl
be5136198e when a form is submitting via post to a url that already has a page represented in the DOM, replace the current page with the response page of the same url (post params are not passed via q string, so the URLs are identical). 2011-09-23 09:28:43 -04:00
John Bender
e5e269394e remove empty else in nav 2011-09-22 14:40:59 -07:00
John Bender
2086529728 remove extra local var storage 2011-09-22 08:53:53 -07:00
John Bender
f1d63f4f75 simplify calls to bind by wrapping this as a jquery object 2011-09-22 08:52:45 -07:00
John Bender
9182306ccf refactor for clarity and simplicity 2011-09-22 08:52:45 -07:00
John Bender
27b228803a change scroll recording to handle different scroll elements between page changes 2011-09-22 08:52:45 -07:00
John Bender
2f12ff249a refactor setLastScroll to speed it up a tad 2011-09-22 08:52:09 -07:00
John Bender
3e143c8f66 rename getLastScroll and its variables 2011-09-22 08:52:09 -07:00
John Bender
c363864382 use scrolltop to store scroll position
scrolltop as a solution isn't that great but some browsers scroll to the top
of the page to where the element bearing the id matching the hash is located
*before* the hashchange event is fired meaning we don't have an opportunity
in the changepage event lifecycle to record the scrolling properly
2011-09-22 08:52:09 -07:00
Kin Blas
80b0e99798 Fix for issue 1243 - Can't link to dynamically created data-role="page"
- Modified loadPage() so that if the data-url lookup for a given page fails, that it look for the page via id (if it is an embedded page URL). This allows us to find dynamically injected pages that are un-enhanced and missing their data-url attributes.
2011-09-21 15:46:15 -07:00
Kin Blas
9b0bf5252d Removed deprecated "beforechangepage", "changepage", and "changepagefailed" event references in preparation for jQM 1.0 release.
Updated the unit tests to use "pagechange" event instead of "changepage".
2011-09-20 16:59:30 -07:00
Kin Blas
e7a33dbb45 Removed deprecated navigation related properties:
$.mobile.updateHash
	$.mobile.urlstack

in preparation for jQM 1.0.
2011-09-20 16:15:44 -07:00
Kin Blas
14bafc510d Removed support for the alpha signature of $.mobile.changePage() in preparation for jQM 1.0. Folks now how to use the signature that requires the toPage (url or element) as the first arg, and options object as the 2nd. 2011-09-20 15:40:52 -07:00
Kin Blas
0fbea8f8e6 Fix for issue 2451:
ÎéÎíDialog not working if $.mobile.ajaxEnabled = falseÎéÎí
https://github.com/jquery/jquery-mobile/issues/2451

related/dup bug 2202:

ÎéÎíDialog loads in new page with ajaxEnabled = falseÎéÎí
https://github.com/jquery/jquery-mobile/issues/2202

- Modified the default click handler to check if the href is for an embedded page before bailing when ajaxEnabled = false. This allows us to navigate to internal/embedded pages/dialogs on the click versus waiting for the accidental hashchange that was the result of the browser's default handling of hash fragments.
2011-09-19 11:32:13 -07:00
Kin Blas
320c12126f Merge branch 'master' of https://github.com/jquery/jquery-mobile 2011-09-15 17:00:27 -07:00
Kin Blas
78234976e7 Fix for issue 2050 - URL handling and PlayBook Webworks app
- Modified the url parser regexp so that we can  find the double slash that precedes the authority. This is necessary so we can reconstruct resource urls used on some devices like Rim's Playbook that use urls like:

location:/dir1/dir2/file.html

- Modified makeAbsoluteUrl() so that it uses the new doubleSlash property in the object returned from parseUrl() instead of assuming that it is ok to use a double slash.
2011-09-15 16:56:54 -07:00
John Bender
416b666ca8 prevent clicks on anything but the left mouse button, also adds the which value to the events when its undefined in the vmouse plugin 2011-09-15 10:16:40 -07:00
Kin Blas
56a22727ab Merge branch 'master' of https://github.com/jquery/jquery-mobile 2011-09-13 00:23:33 -07:00
Kin Blas
1a92be0240 Fix for issue 2406 - Navigation from one page back to multi-page template
- Make sure that our hashchange resolves non-path hashes against the documentBase. This prevents the resulting changePath() call from incorrectly resolving against the URL for the current active (external) page.

- Fixed a problem in the push-state code. A hashchange event is *NOT* fired when navigating back (window.history.back()) from an external page to an internal page. This makes sense when you think about it since hashchange is only ever fired when the hash of the current document url changes, not when the document url itself changes. The fix was to make sure that the pushstate hashchange callback always sets a state object, even on embedded page URLs. This allows the hashchange callback to be triggered from within onPopState().
2011-09-13 00:23:03 -07:00
John Bender
c426aefd76 add data attribute tag for pages loaded via ajax Fixes #2432 2011-09-12 14:06:47 -07:00
John Bender
fbd113bad4 whitespace in listview and core nav 2011-09-12 13:58:24 -07:00
scottjehl
b645781f4d implemented native overflow scrolling based on support for -[prefix]-overflow-scrolling: touch. True fixed headers and footers come supported as well. 2011-09-08 12:38:50 -04:00
scottjehl
bc036b91b0 Clock tap is busted, so this logic is here but commented-out 2011-09-08 12:38:50 -04:00
scottjehl
fda71670b4 reset scrollTop to 0, not defaultHomeScroll 2011-09-08 12:38:50 -04:00
scottjehl
1a524756f3 added a pre-transition class to set pages to display: block early and allow for their scrollTop and focus to be set before they are shown. 2011-09-08 12:38:50 -04:00
Kin Blas
78041bc7c9 Added path.isFirstPageUrl() which is now called from loadPage() when trying to determine if the URL being loaded refers to a page that is already in the DOM. This will prevent us from duplicating the first-page in the main application document.
Also checking in the first example of how to use the pagebeforechange notification to allow for dynamically updating and re-using a page that is already in the DOM.
2011-09-08 09:21:31 -07:00
Kin Blas
04623c21cf Merge branch 'master' into changepage-prevent 2011-09-07 18:07:21 -07:00
Kin Blas
6aa8c8f3b0 - Added "fromPage" option to changePage(). This used to be in there before the navigation re-work, I just added it back in.
- Added "dataUrl" option to changePage(). This allows a caller to specify a page element to change to, but specify an alternate URL for location display purposes. This is useful for dynamic applications that re-use and over-write existing page content to avoid overwhelming the DOM.

- Renamed the "beforechangepage" and "changepage" events to "pagebeforechange" and "pagechange" respectively. This was done to match the page widget naming of its notifications. Left the triggers for the old events in place but with DEPRECATED comments.

- Renamed the properties of the data object passed to the page events.
2011-09-07 18:03:38 -07:00
scottjehl
d68d5064bc finished last-scroll remembering implementation across pages in the history stack (regardless of whether they've been removed from the DOM since last appearance). 2011-09-07 08:15:00 -04:00
Kin Blas
701b381cc4 Couple of modifications to changePage():
- Moved the setting of isPageTransitioning *AFTER* the beforechangepage notification.

- Modified the trigger("beforechangepage") call to pass the args to changePage() as an object since trigger only expects one data arg.
2011-09-06 16:56:20 -07:00
scottjehl
0d98b8fad6 changed setting of lastScroll 2011-09-06 14:29:19 -04:00