Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

do not inject angular.element #132

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions contextMenu.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function($, angular) {
(function(angular) {

// eslint-disable-next-line angular/file-name, angular/no-service-method
angular.module('ui.bootstrap.contextMenu', [])
Expand Down Expand Up @@ -55,7 +55,7 @@
}
} else {

var $a = $('<a>');
var $a = angular.element('<a>');
var $anchorStyle = {};

if (leftOriented) {
Expand Down Expand Up @@ -97,7 +97,7 @@
$boldStyle.float = 'right';
}

var $bold = $('<strong style="font-family:monospace;font-weight:bold;float:right;">' + $arrow + '</strong>');
var $bold = angular.element('<strong style="font-family:monospace;font-weight:bold;float:right;">' + $arrow + '</strong>');
$bold.css($boldStyle);
$a.css('cursor', 'default');
$a.append($bold);
Expand Down Expand Up @@ -211,7 +211,7 @@
$scope.$apply(function () {

var cleanupFunction = function () {
$(event.currentTarget).removeClass('context');
angular.element(event.currentTarget).removeClass('context');
removeAllContextMenus();
};
var clickFunction = angular.isFunction(item.click)
Expand Down Expand Up @@ -325,7 +325,7 @@

// Only add the <li> if the item is displayed
if (displayed) {
var $li = $('<li>');
var $li = angular.element('<li>');
var itemParams = angular.extend({}, params);
itemParams.item = item;
itemParams.$li = $li;
Expand Down Expand Up @@ -451,7 +451,7 @@
// Destructuring
var customClass = params.customClass;

var $ul = $('<ul>');
var $ul = angular.element('<ul>');
$ul.addClass('dropdown-menu');
$ul.attr({ 'role': 'menu' });
$ul.css({
Expand Down Expand Up @@ -493,7 +493,7 @@

function removeOnOutsideClickEvent(e) {

var $curr = $(e.target);
var $curr = angular.element(e.target);
var shouldRemove = true;

while($curr.length) {
Expand All @@ -512,7 +512,7 @@
function removeAllContextMenus(e) {
$document.find('body').off('mousedown', removeOnOutsideClickEvent);
$document.off('scroll', removeOnScrollEvent);
$(_clickedElement).removeClass('context');
angular.element(_clickedElement).removeClass('context');
removeContextMenus();
$rootScope.$broadcast('');
}
Expand Down Expand Up @@ -584,9 +584,9 @@
$document.on('scroll', removeOnScrollEvent);

_clickedElement = event.currentTarget;
$(_clickedElement).addClass('context');
angular.element(_clickedElement).addClass('context');

$scope.$apply(function () {
$scope.$applyAsync(function () {
var options = $scope.$eval(attrs.contextMenu);
var customClass = attrs.contextMenuClass;
var modelValue = $scope.$eval(attrs.model);
Expand Down Expand Up @@ -620,4 +620,4 @@
};
}]);
// eslint-disable-next-line angular/window-service
})(window.angular.element, window.angular);
})(window.angular);