From 3c4f38ac9dd3c15d14a8cca300f445c109d8d20a Mon Sep 17 00:00:00 2001 From: AdamWagner Date: Wed, 19 Jun 2013 11:53:09 -0700 Subject: [PATCH 1/2] Attach djax to all internal links with .dJAX_internal. Includes links loaded via ajax. --- jquery.djax.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/jquery.djax.js b/jquery.djax.js index 6529c15..8bb7a2b 100644 --- a/jquery.djax.js +++ b/jquery.djax.js @@ -218,9 +218,16 @@ // Only add a class to internal links $(this).find('a').filter(function () { - return this.hostname === location.hostname; - }).addClass('dJAX_internal').on('click', function (event) { - return self.attachClick(this, event); + return this.hostname === location.hostname; + }).addClass('dJAX_internal') + + + // attachClick to links with '.dJAX_internal'. Includes links loaded via ajax. + $(this).on('click', '.dJAX_internal', function (event) { + if (this.hostname !== location.hostname) + return; + event.preventDefault(); + return self.attachClick(this, event); }); // On new page load From d7274596ffdc6f995759580492593d183bab5f25 Mon Sep 17 00:00:00 2001 From: AdamWagner Date: Wed, 19 Jun 2013 11:56:48 -0700 Subject: [PATCH 2/2] Add missing semicolon --- jquery.djax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.djax.js b/jquery.djax.js index 8bb7a2b..43962b4 100644 --- a/jquery.djax.js +++ b/jquery.djax.js @@ -219,7 +219,7 @@ // Only add a class to internal links $(this).find('a').filter(function () { return this.hostname === location.hostname; - }).addClass('dJAX_internal') + }).addClass('dJAX_internal'); // attachClick to links with '.dJAX_internal'. Includes links loaded via ajax.