Permalink
Browse files

Removed the ajaxLinksEnabled and ajaxFormsEnabled settings. These wer…

…e deprecated in a4 and scheduled for removal. Automated link and form ajax handling can still be globally disabled via the ajaxEnabled option.
  • Loading branch information...
1 parent 368d3e5 commit 8929ac33b9f73d0a8cb5d3476682f8c3d2423830 scottjehl committed May 24, 2011
Showing with 2 additions and 20 deletions.
  1. +0 −6 docs/api/globalconfig.html
  2. +1 −1 docs/forms/forms-sample.html
  3. +0 −8 js/jquery.mobile.core.js
  4. +1 −5 js/jquery.mobile.navigation.js
@@ -95,12 +95,6 @@
<dt>ajaxEnabled (<em>boolean</em>, default: true):</dt>
<dd>jQuery Mobile will automatically handle link clicks and form submissions through Ajax, when possible. If false, url hash listening will be disabled as well, and urls will load as regular http requests.</dd>
- <dt>ajaxLinksEnabled (<strong>deprecated</strong> <em>boolean</em>, default: true):</dt>
- <dd>jQuery Mobile will automatically handle link clicks through Ajax, when possible.</dd>
-
- <dt>ajaxFormsEnabled (<strong>deprecated</strong> <em>boolean</em>, default: true):</dt>
- <dd>jQuery Mobile will automatically handle form submissions through Ajax, when possible.</dd>
-
<dt>hashListeningEnabled (<em>boolean</em>, default: true):</dt>
<dd>jQuery Mobile will automatically listen and handle changes to the location.hash. Disabling this will prevent jQuery Mobile from handling hash changes, which allows you to handle them yourself, or simply to use simple deep-links within a document that scroll to a particular ID.</dd>
@@ -27,7 +27,7 @@
<h2>Non-Ajax handling</h2>
- <p>To prevent form submissions from being automatically handled with Ajax, add the <code>data-ajax="false"</code> attribute to the form element. You can also turn of Ajax form handling completely via the <code>ajaxFormsEnabled</code> <a href="../api/globalconfig.html">global config option</a>.</p>
+ <p>To prevent form submissions from being automatically handled with Ajax, add the <code>data-ajax="false"</code> attribute to the form element. You can also turn of Ajax form handling completely via the <code>ajaxEnabled</code> <a href="../api/globalconfig.html">global config option</a>.</p>
<h2>Simple Ajax form example</h2>
<p>This page demonstrates automated ajax handling of form submissions. The form below is configured to send regular a <code>get</code> request to <code>forms-sample-response.php</code>. On submit, jQuery Mobile will make sure that the Url specified is able to be retrieved via Ajax, and handle it appropriately. Keep in mind that just like ordinary HTTP form submissions, jQuery Mobile allows <code>get</code> result pages to be bookmarked by updating the Url hash when the response returns successfully. Also like ordinary form submissions, <code>post</code> requests do not contain query parameters in the hash, so they are not bookmarkable.</p>
@@ -36,14 +36,6 @@
//automatically load and show pages based on location.hash
hashListeningEnabled: true,
- // TODO: deprecated - remove at 1.0
- //automatically handle link clicks through Ajax, when possible
- ajaxLinksEnabled: true,
-
- // TODO: deprecated - remove at 1.0
- //automatically handle form submissions through Ajax, when possible
- ajaxFormsEnabled: true,
-
//set default page transition - 'none' for no transitions
defaultPageTransition: "slide",
@@ -735,8 +735,6 @@
$( "form" ).live('submit', function( event ) {
var $this = $( this );
if( !$.mobile.ajaxEnabled ||
- //TODO: deprecated - remove at 1.0
- !$.mobile.ajaxFormsEnabled ||
$this.is( ":jqmData(ajax='false')" ) ) {
return;
}
@@ -853,9 +851,7 @@
$activeClickedLink = $link.closest( ".ui-btn" );
- if( isExternal || hasAjaxDisabled || hasTarget || !$.mobile.ajaxEnabled ||
- // TODO: deprecated - remove at 1.0
- !$.mobile.ajaxLinksEnabled ) {
+ if( isExternal || hasAjaxDisabled || hasTarget || !$.mobile.ajaxEnabled ) {
//remove active link class if external (then it won't be there if you come back)
window.setTimeout( function() { removeActiveLinkClass( true ); }, 200 );

6 comments on commit 8929ac3

@epsd
epsd commented on 8929ac3 May 25, 2011

Why was this necessary to remove? Was it hurting something? It seemed pretty harmless to allow setting ajax globally for links and separately for forms. I can certainly see times when one would want one enabled and not the other. So now, to accomplish this, I would need to somehow set data-ajax=false on all elements of one kind or the other. Seems silly when this was in place and working...

@scottjehl
Contributor

Well, we originally had separate options for this because the forms Ajax wasnt working in certain scenarios, and in those cases people wanted to disable them while keeping ajaxs links. Since then, we improved the form handling enough that it wasn't necessary to disable it as a workaround. At that point (this may have been alpha 2ish) we deprecated them in favor of one "ajax handling" setting.

We'd consider bringing them back if people are using them though! They've been marked for removal for a while and we'd yet to hear anyone complain. Obviously, 2 params complicate the logic compared to one (however small), so we pulled em.

Anyway, open to reconsidering...

@epsd
epsd commented on 8929ac3 May 25, 2011

I'm looking at it from the perspective of 'JQMing' existing web apps. In these cases, it just makes sense to use the ajax links, but use regular form submission for form handling (for a wide variety of reasons). In these cases, it just made it easy to turn off the ajax form handling (while keeping the nice ajax links). And, in most cases direct access to the forms wasn't available, so setting data-ajax=false on each is impossible. It could be set on each form element on a 'onpagecreate' event I guess, but then these (relatively) heavy apps gain even more overhead...

@GhostGambler

+1 for separation.

Meantime you can use the following snippet to achieve that forms are submitted the old-fashioned way:

$(document).bind("mobileinit", function () {
    $('div[data-role="page"]').live("pagecreate", function (ev) {
        $(this).find("form").attr("data-ajax", "false");
    });
});
@toddparker
Contributor

Anyone want to open an issue for this so we can prioritize?

@jblas
Contributor
jblas commented on 8929ac3 Aug 9, 2011

I opened 2250:

#2250

Please sign in to comment.