[extensions-web] js: s/bind/on/g



commit 61213509bd6559a068ad2de70af6d3f4bddbde6c
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Apr 2 09:42:22 2012 -0400

    js: s/bind/on/g

 sweettooth/static/js/extensions.js |    8 ++++----
 sweettooth/static/js/main.js       |    4 ++--
 sweettooth/static/js/modal.js      |    4 ++--
 sweettooth/static/js/paginator.js  |    2 +-
 sweettooth/static/js/uploader.js   |    4 ++--
 5 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index 8315101..0567a69 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -117,7 +117,7 @@ function($, messages, dbusProxy, extensionUtils, templates) {
         }
 
         // When the user flips the switch...
-        $switch.bind('changed', function(e, newValue) {
+        $switch.on('changed', function(e, newValue) {
             var oldState = $elem.data('state');
             if (newValue) {
                 if (oldState == ExtensionState.UNINSTALLED) {
@@ -139,7 +139,7 @@ function($, messages, dbusProxy, extensionUtils, templates) {
         });
 
         // When the extension changes state...
-        $elem.bind('state-changed', function(e, newState) {
+        $elem.on('state-changed', function(e, newState) {
             $elem.data('state', newState);
 
             $elem.toggleClass('configurable', meta.hasPrefs && newState !== ExtensionState.OUT_OF_DATE);
@@ -219,7 +219,7 @@ function($, messages, dbusProxy, extensionUtils, templates) {
 
                                     if (wantUndo) {
                                         var $message = messages.addInfo(templates.extensions.uninstall(extension));
-                                        $message.delegate('a', 'click', reinstall);
+                                        $message.on('click', 'a', reinstall);
                                         $elem.data('undo-uninstall-message', $message);
                                     }
                                 }
@@ -287,7 +287,7 @@ function($, messages, dbusProxy, extensionUtils, templates) {
             var $extension = $(this);
             var uuid = $extension.data('uuid');
 
-            $extension.bind('out-of-date', function() {
+            $extension.on('out-of-date', function() {
                 var svm = $extension.data('svm');
                 var nhvOperation = extensionUtils.findNextHighestVersion(svm, dbusProxy.ShellVersion);
                 if (nhvOperation.operation === 'upgrade' &&
diff --git a/sweettooth/static/js/main.js b/sweettooth/static/js/main.js
index 4c7d7ce..ce842fd 100644
--- a/sweettooth/static/js/main.js
+++ b/sweettooth/static/js/main.js
@@ -122,7 +122,7 @@ function($, messages, modal) {
 
         var $extensionsList = $('#extensions-list').
             paginatorify().
-            bind('page-loaded', function() {
+            on('page-loaded', function() {
                 $('li.extension').grayOutIfOutOfDate();
 
                 // If we're searching, don't add FSUI for now.
@@ -134,7 +134,7 @@ function($, messages, modal) {
             });
 
         var term = null;
-        $('#search_input').bind('keyup', function() {
+        $('#search_input').on('keyup', function() {
             var newTerm = $.trim($(this).val());
 
             if (newTerm != term) {
diff --git a/sweettooth/static/js/modal.js b/sweettooth/static/js/modal.js
index aef6b5c..b611b3c 100644
--- a/sweettooth/static/js/modal.js
+++ b/sweettooth/static/js/modal.js
@@ -13,7 +13,7 @@ define(['jquery'], function($) {
     }
 
     exports.activateModal = function(elem, closeFunction) {
-        $(document.body).click(function(e) {
+        $(document.body).on('click', function(e) {
             // If the user clicked inside the modal popup, don't
             // close it.
             if ($(elem).has(e.target).length) {
@@ -21,7 +21,7 @@ define(['jquery'], function($) {
             }
 
             if (closeFunction()) {
-                $(document.body).unbind(e);
+                $(document.body).off(e);
                 document.body.removeEventListener('click', captureHandler, true);
                 return false;
             }
diff --git a/sweettooth/static/js/paginator.js b/sweettooth/static/js/paginator.js
index 34ef863..4cd0281 100644
--- a/sweettooth/static/js/paginator.js
+++ b/sweettooth/static/js/paginator.js
@@ -77,7 +77,7 @@ define(['jquery', 'hashParamUtils', 'paginatorUtils', 'dbus!_', 'templates', 'jq
 
         $(window).hashchange(loadPage);
 
-        this.bind('load-page', loadPage);
+        this.on('load-page', loadPage);
 
         return this;
     };
diff --git a/sweettooth/static/js/uploader.js b/sweettooth/static/js/uploader.js
index 7228c31..0d2a33b 100644
--- a/sweettooth/static/js/uploader.js
+++ b/sweettooth/static/js/uploader.js
@@ -68,7 +68,7 @@ define(['jquery'], function($) {
         var $drop = $('<span>', { 'class': 'drop' }).hide().appendTo($elem);
 
         var inClick = false;
-        $elem.bind({
+        $elem.on({
             click: function() {
                 // Prevent the handler from running twice from bubbling.
                 if (inClick)
@@ -102,7 +102,7 @@ define(['jquery'], function($) {
             drop: upload
         });
 
-        $input.bind('change', upload);
+        $input.on('change', upload);
 
         $elem.data('uploader', true);
     };



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]