Skip to content

Commit c759bd9

Browse files
author
Gelu Timoficiuc
committed
Avoid binding mouseevents on the window object
As it is not supported in IE8
1 parent a122c17 commit c759bd9

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

dist/angular-context-menu.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,16 @@ angular.module('ng-context-menu', [])
129129

130130
.directive('hasContextMenu', [
131131
'$injector',
132-
'$window',
132+
'$document',
133133
'$parse',
134-
function($injector, $window, $parse) {
134+
function($injector, $document, $parse) {
135135
return {
136136
restrict: 'A',
137137
link: function(scope, element, attrs) {
138138
var openTarget,
139139
contextMenu = $injector.get(attrs.target),
140140
locals = {},
141-
win = angular.element($window),
141+
doc = angular.element($document),
142142
menuElement,
143143
triggerOnEvent = attrs.triggerOnEvent || 'contextmenu';
144144

@@ -189,7 +189,7 @@ angular.module('ng-context-menu', [])
189189
});
190190
});
191191

192-
win.bind('keyup', function(event) {
192+
doc.bind('keyup', function(event) {
193193
if (contextMenu.active() && event.keyCode === 27) {
194194
scope.$apply(function() {
195195
close();
@@ -208,8 +208,8 @@ angular.module('ng-context-menu', [])
208208

209209
// Firefox treats a right-click as a click and a contextmenu event while other browsers
210210
// just treat it as a contextmenu event
211-
win.bind('click', handleWindowClickEvent);
212-
win.bind(triggerOnEvent, handleWindowClickEvent);
211+
doc.bind('click', handleWindowClickEvent);
212+
doc.bind(triggerOnEvent, handleWindowClickEvent);
213213
}
214214
};
215215
}]);

dist/angular-context-menu.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/angular-context-menu.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,16 @@ angular.module('ng-context-menu', [])
129129

130130
.directive('hasContextMenu', [
131131
'$injector',
132-
'$window',
132+
'$document',
133133
'$parse',
134-
function($injector, $window, $parse) {
134+
function($injector, $document, $parse) {
135135
return {
136136
restrict: 'A',
137137
link: function(scope, element, attrs) {
138138
var openTarget,
139139
contextMenu = $injector.get(attrs.target),
140140
locals = {},
141-
win = angular.element($window),
141+
doc = angular.element($document),
142142
menuElement,
143143
triggerOnEvent = attrs.triggerOnEvent || 'contextmenu';
144144

@@ -189,7 +189,7 @@ angular.module('ng-context-menu', [])
189189
});
190190
});
191191

192-
win.bind('keyup', function(event) {
192+
doc.bind('keyup', function(event) {
193193
if (contextMenu.active() && event.keyCode === 27) {
194194
scope.$apply(function() {
195195
close();
@@ -208,8 +208,8 @@ angular.module('ng-context-menu', [])
208208

209209
// Firefox treats a right-click as a click and a contextmenu event while other browsers
210210
// just treat it as a contextmenu event
211-
win.bind('click', handleWindowClickEvent);
212-
win.bind(triggerOnEvent, handleWindowClickEvent);
211+
doc.bind('click', handleWindowClickEvent);
212+
doc.bind(triggerOnEvent, handleWindowClickEvent);
213213
}
214214
};
215215
}]);

0 commit comments

Comments
 (0)