diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-11-12 03:02:43 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-11-12 03:02:43 +0000 |
commit | bf4d7279e90578d0b363d26a856d309fb24ffbaf (patch) | |
tree | 33645d48a650160595f997599f56c2d81df0ec90 | |
parent | f4c438b7f0b2dece8def954adf96ce234874f99e (diff) | |
download | brdo-bf4d7279e90578d0b363d26a856d309fb24ffbaf.tar.gz brdo-bf4d7279e90578d0b363d26a856d309fb24ffbaf.tar.bz2 |
- Patch #565808 by cha0s, thegreat, Dave Reid, Alexander N, andrewlevine, carlos8f: nojs/ajax replacement.
-rw-r--r-- | misc/ajax.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/misc/ajax.js b/misc/ajax.js index 73848602f..bee4e4282 100644 --- a/misc/ajax.js +++ b/misc/ajax.js @@ -115,7 +115,16 @@ Drupal.ajax = function (base, element, element_settings) { // Replacing 'nojs' with 'ajax' in the URL allows for an easy method to let // the server detect when it needs to degrade gracefully. - this.url = element_settings.url.replace(/\/nojs(\/|$)/g, '/ajax$1'); + // There are five scenarios to check for: + // 1. /nojs/ + // 2. /nojs$ - The end of a URL string. + // 3. /nojs? - Followed by a query (with clean URLs enabled). + // E.g.: path/nojs?destination=foobar + // 4. /nojs& - Followed by a query (without clean URLs enabled). + // E.g.: ?q=path/nojs&destination=foobar + // 5. /nojs# - Followed by a fragment. + // E.g.: path/nojs#myfragment + this.url = element_settings.url.replace(/\/nojs(\/|$|\?|&|#)/g, '/ajax$1'); this.wrapper = '#' + element_settings.wrapper; // If there isn't a form, jQuery.ajax() will be used instead, allowing us to |