From 38758d754b3e23106042c40d891216513fa7a385 Mon Sep 17 00:00:00 2001
From: Igor Vaynberg <igor.vaynberg@gmail.com>
Date: Tue, 19 Feb 2013 14:11:38 -0800
Subject: [PATCH] fix ajax url() context. fixes #895

---
 select2.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/select2.js b/select2.js
index 12edbf7f..0b20d1e2 100644
--- a/select2.js
+++ b/select2.js
@@ -355,14 +355,14 @@ the specific language governing permissions and limitations under the Apache Lic
                     type = options.type || 'GET', // set type of request (GET or POST)
                     params = {};
 
-                data = data ? data.call(self.opts.element, query.term, query.page, query.context) : null;
-                url = (typeof url === 'function') ? url.call(self.opts.element, query.term, query.page, query.context) : url;
+                data = data ? data.call(self, query.term, query.page, query.context) : null;
+                url = (typeof url === 'function') ? url.call(self, query.term, query.page, query.context) : url;
 
                 if( null !== handler) { handler.abort(); }
 
                 if (options.params) {
                     if ($.isFunction(options.params)) {
-                        $.extend(params, options.params.call(self.opts.element));
+                        $.extend(params, options.params.call(self));
                     } else {
                         $.extend(params, options.params);
                     }
@@ -383,7 +383,7 @@ the specific language governing permissions and limitations under the Apache Lic
                         query.callback(results);
                     }
                 });
-                handler = transport.call(self.opts.element, params);
+                handler = transport.call(self, params);
             }, quietMillis);
         };
     }