From 2f9c4651d61462a24f0740e640e83613922c3bef Mon Sep 17 00:00:00 2001 From: willhoag Date: Tue, 7 Oct 2014 12:54:37 -0700 Subject: [PATCH] remove jquery dependency --- .gitignore | 1 + examples/index.html | 1 - karma.conf.js | 4 ++-- src/angular-tooltip.js | 17 ++++++++--------- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index fd3a1c2..35118cb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ bower_components node_modules .tmp +.DS_Store diff --git a/examples/index.html b/examples/index.html index a062c38..2b14a74 100644 --- a/examples/index.html +++ b/examples/index.html @@ -24,7 +24,6 @@ } - diff --git a/karma.conf.js b/karma.conf.js index 2b03fbf..31f5eef 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -17,7 +17,7 @@ module.exports = function(config) { // list of files / patterns to load in the browser files: [ - 'bower_components/jquery/jquery.js', + 'bower_components/jquery/dist/jquery.js', 'bower_components/angular/angular.js', 'bower_components/tether/tether.js', @@ -61,7 +61,7 @@ module.exports = function(config) { // - Safari (only Mac) // - PhantomJS // - IE (only Windows) - browsers: ['Firefox'], + browsers: ['PhantomJS'], // Continuous Integration mode diff --git a/src/angular-tooltip.js b/src/angular-tooltip.js index 25eea76..f820f34 100644 --- a/src/angular-tooltip.js +++ b/src/angular-tooltip.js @@ -25,7 +25,7 @@ options = extend({ templateUrl: defaultTemplateUrl }, options); options.tether = extend({}, defaultTetherOptions, options.tether || {}); - var template = options.template || ( $templateCache.get(options.templateUrl) ? $templateCache.get(options.templateUrl)[1] : undefined ), + var template = options.template || ( $templateCache.get(options.templateUrl) ? $templateCache.get(options.templateUrl) : undefined ), scope = options.scope || $rootScope.$new(), target = options.target, tether, elem; @@ -42,7 +42,7 @@ function attachTether() { tether = new Tether(extend({ element: elem, - target: target + target: target[0] }, options.tether)); } @@ -53,8 +53,6 @@ if (tether) { tether.destroy(); tether = undefined; - elem.remove(); - angular.element(elem).scope().$destroy(); } } @@ -78,7 +76,7 @@ */ function close() { delete result.elem; - $animate.leave(elem); + $animate.leave(angular.element(elem)); detachTether(); } @@ -119,10 +117,11 @@ /** * Toggle the tooltip. */ - elem.hover(function() { - scope.$apply(tooltip.open); - }, function() { - scope.$apply(tooltip.close); + elem.on('mouseover', function() { + scope.$apply(tooltip.open()); + }); + elem.on('mouseout', function() { + scope.$apply(tooltip.close()); }); } };