Skip to content

Commit 92e8289

Browse files
committed
refactor(jqLite): change leftover element.bind/unbind to element.on/off
1 parent 219648f commit 92e8289

File tree

9 files changed

+20
-20
lines changed

9 files changed

+20
-20
lines changed

docs/app/assets/js/angular-bootstrap/bootstrap-prettify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ directive.ngEmbedApp = ['$templateCache', '$browser', '$rootScope', '$location',
215215
}
216216
});
217217

218-
element.bind('$destroy', function() {
218+
element.on('$destroy', function() {
219219
deregisterEmbedRootScope();
220220
embedRootScope.$destroy();
221221
});

docs/app/assets/js/angular-bootstrap/bootstrap.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -274,13 +274,13 @@ var popoverElement = function() {
274274
this.contentElement = angular.element(inner.childNodes[1]);
275275

276276
//stop the click on the tooltip
277-
this.element.bind('click', function(event) {
277+
this.element.on('click', function(event) {
278278
event.preventDefault();
279279
event.stopPropagation();
280280
});
281281

282282
var self = this;
283-
angular.element(document.body).bind('click',function(event) {
283+
angular.element(document.body).on('click',function(event) {
284284
if(self.visible()) self.hide();
285285
});
286286
},
@@ -359,7 +359,7 @@ directive.popover = ['popoverElement', function(popover) {
359359
restrict: 'A',
360360
priority : 500,
361361
link: function(scope, element, attrs) {
362-
element.bind('click',function(event) {
362+
element.on('click',function(event) {
363363
event.preventDefault();
364364
event.stopPropagation();
365365
if(popover.isSituatedAt(element) && popover.visible()) {
@@ -396,7 +396,7 @@ directive.foldout = ['$http', '$animate','$window', function($http, $animate, $w
396396
if(/\/build\//.test($window.location.href)) {
397397
url = '/build/docs' + url;
398398
}
399-
element.bind('click',function() {
399+
element.on('click',function() {
400400
scope.$apply(function() {
401401
if(!container) {
402402
if(loading) return;

docs/app/assets/js/angular-bootstrap/dropdown-toggle.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ angular.module('ui.bootstrap.dropdown', [])
3535

3636
this.open = function( dropdownScope ) {
3737
if ( !openScope ) {
38-
$document.bind('click', closeDropdown);
39-
$document.bind('keydown', escapeKeyBind);
38+
$document.on('click', closeDropdown);
39+
$document.on('keydown', escapeKeyBind);
4040
}
4141

4242
if ( openScope && openScope !== dropdownScope ) {
@@ -49,8 +49,8 @@ angular.module('ui.bootstrap.dropdown', [])
4949
this.close = function( dropdownScope ) {
5050
if ( openScope === dropdownScope ) {
5151
openScope = null;
52-
$document.unbind('click', closeDropdown);
53-
$document.unbind('keydown', escapeKeyBind);
52+
$document.off('click', closeDropdown);
53+
$document.off('keydown', escapeKeyBind);
5454
}
5555
};
5656

@@ -124,7 +124,7 @@ angular.module('ui.bootstrap.dropdown', [])
124124
return;
125125
}
126126

127-
element.bind('click', function(event) {
127+
element.on('click', function(event) {
128128
event.preventDefault();
129129
event.stopPropagation();
130130

docs/app/src/search.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ angular.module('search', [])
131131
return function(scope, element, attrs) {
132132
var ESCAPE_KEY_KEYCODE = 27,
133133
FORWARD_SLASH_KEYCODE = 191;
134-
angular.element($document[0].body).bind('keydown', function(event) {
134+
angular.element($document[0].body).on('keydown', function(event) {
135135
var input = element[0];
136136
if(event.keyCode == FORWARD_SLASH_KEYCODE && document.activeElement != input) {
137137
event.stopPropagation();
@@ -140,7 +140,7 @@ angular.module('search', [])
140140
}
141141
});
142142

143-
element.bind('keydown', function(event) {
143+
element.on('keydown', function(event) {
144144
if(event.keyCode == ESCAPE_KEY_KEYCODE) {
145145
event.stopPropagation();
146146
event.preventDefault();

docs/content/guide/animations.ngdoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ making calls to it when needed.
271271
```js
272272
myModule.directive('my-directive', ['$animate', function($animate) {
273273
return function(element, scope, attrs) {
274-
element.bind('click', function() {
274+
element.on('click', function() {
275275
if(element.hasClass('clicked')) {
276276
$animate.removeClass(element, 'clicked');
277277
} else {

docs/content/guide/compiler.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ Here is a directive which makes any element draggable. Notice the `draggable` at
105105
}
106106

107107
function mouseup() {
108-
$document.unbind('mousemove', mousemove);
109-
$document.unbind('mouseup', mouseup);
108+
$document.off('mousemove', mousemove);
109+
$document.off('mouseup', mouseup);
110110
}
111111
};
112112
});

docs/content/guide/directive.ngdoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -798,8 +798,8 @@ element?
798798
}
799799

800800
function mouseup() {
801-
$document.unbind('mousemove', mousemove);
802-
$document.unbind('mouseup', mouseup);
801+
$document.off('mousemove', mousemove);
802+
$document.off('mouseup', mouseup);
803803
}
804804
};
805805
}]);

src/ng/interval.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function $IntervalProvider() {
107107
*
108108
* // listen on DOM destroy (removal) event, and cancel the next UI update
109109
* // to prevent updating time ofter the DOM element was removed.
110-
* element.bind('$destroy', function() {
110+
* element.on('$destroy', function() {
111111
* $interval.cancel(stopTime);
112112
* });
113113
* }

test/jQueryPatchSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ if (window.jQuery) {
7171
spy1 = jasmine.createSpy('span1.$destroy');
7272
spy2 = jasmine.createSpy('span2.$destroy');
7373
doc = $('<div><span class=first>abc</span><span class=second>xyz</span></div>');
74-
doc.find('span.first').bind('$destroy', spy1);
75-
doc.find('span.second').bind('$destroy', spy2);
74+
doc.find('span.first').on('$destroy', spy1);
75+
doc.find('span.second').on('$destroy', spy2);
7676
});
7777

7878
afterEach(function() {

0 commit comments

Comments
 (0)