diff options
| author | Misko Hevery | 2011-08-24 21:28:55 -0700 |
|---|---|---|
| committer | Igor Minar | 2011-10-11 10:53:06 -0700 |
| commit | 1942861472a4cd8d2d72f2ed54ee2b63be5d68b8 (patch) | |
| tree | ef71c388e21704fd241367dfdfdf6d0181e480a8 /src | |
| parent | b96e978178a6acbf048aa6db466ed845e1395445 (diff) | |
| download | angular.js-1942861472a4cd8d2d72f2ed54ee2b63be5d68b8.tar.bz2 | |
refactor(hover): delete hover service
Diffstat (limited to 'src')
| -rw-r--r-- | src/AngularPublic.js | 1 | ||||
| -rw-r--r-- | src/Browser.js | 36 | ||||
| -rw-r--r-- | src/angular-mocks.js | 3 | ||||
| -rw-r--r-- | src/service/hover.js | 58 |
4 files changed, 0 insertions, 98 deletions
diff --git a/src/AngularPublic.js b/src/AngularPublic.js index 8683b379..fc8a90fd 100644 --- a/src/AngularPublic.js +++ b/src/AngularPublic.js @@ -6,7 +6,6 @@ angularService('$browser', function($log, $sniffer) { if (!browserSingleton) { browserSingleton = new Browser(window, jqLite(window.document), jqLite(window.document.body), XHR, $log, $sniffer); - browserSingleton.bind(); } return browserSingleton; }, {$inject: ['$log', '$sniffer']}); diff --git a/src/Browser.js b/src/Browser.js index 62e5b116..ed12441a 100644 --- a/src/Browser.js +++ b/src/Browser.js @@ -415,42 +415,6 @@ function Browser(window, document, body, XHR, $log, $sniffer) { ////////////////////////////////////////////////////////////// // Misc API ////////////////////////////////////////////////////////////// - var hoverListener = noop; - - /** - * @workInProgress - * @ngdoc method - * @name angular.service.$browser#hover - * @methodOf angular.service.$browser - * - * @description - * Set hover listener. - * - * @param {function(Object, boolean)} listener Function that will be called when a hover event - * occurs. - */ - self.hover = function(listener) { hoverListener = listener; }; - - /** - * @workInProgress - * @ngdoc method - * @name angular.service.$browser#bind - * @methodOf angular.service.$browser - * - * @description - * Register hover function to real browser - */ - self.bind = function() { - document.bind("mouseover", function(event){ - hoverListener(jqLite(msie ? event.srcElement : event.target), true); - return true; - }); - document.bind("mouseleave mouseout click dblclick keypress keyup", function(event){ - hoverListener(jqLite(event.target), false); - return true; - }); - }; - /** * @workInProgress diff --git a/src/angular-mocks.js b/src/angular-mocks.js index a39fd7bf..731c2c29 100644 --- a/src/angular-mocks.js +++ b/src/angular-mocks.js @@ -328,9 +328,6 @@ MockBrowser.prototype = { return pollFn; }, - hover: function(onHover) { - }, - url: function(url, replace) { if (url) { this.$$url = url; diff --git a/src/service/hover.js b/src/service/hover.js deleted file mode 100644 index f8470370..00000000 --- a/src/service/hover.js +++ /dev/null @@ -1,58 +0,0 @@ -'use strict'; - -/** - * @workInProgress - * @ngdoc service - * @name angular.service.$hover - * @requires $browser - * @requires $document - * - * @description - * - * @example - */ -angularServiceInject("$hover", function(browser, document) { - var tooltip, self = this, error, width = 300, arrowWidth = 10, body = jqLite(document[0].body); - browser.hover(function(element, show){ - if (show && (error = element.attr(NG_EXCEPTION) || element.attr(NG_VALIDATION_ERROR))) { - if (!tooltip) { - tooltip = { - callout: jqLite('<div id="ng-callout"></div>'), - arrow: jqLite('<div></div>'), - title: jqLite('<div class="ng-title"></div>'), - content: jqLite('<div class="ng-content"></div>') - }; - tooltip.callout.append(tooltip.arrow); - tooltip.callout.append(tooltip.title); - tooltip.callout.append(tooltip.content); - body.append(tooltip.callout); - } - var docRect = body[0].getBoundingClientRect(), - elementRect = element[0].getBoundingClientRect(), - leftSpace = docRect.right - elementRect.right - arrowWidth; - tooltip.title.text(element.hasClass("ng-exception") ? "EXCEPTION:" : "Validation error..."); - tooltip.content.text(error); - if (leftSpace < width) { - tooltip.arrow.addClass('ng-arrow-right'); - tooltip.arrow.css({left: (width + 1)+'px'}); - tooltip.callout.css({ - position: 'fixed', - left: (elementRect.left - arrowWidth - width - 4) + "px", - top: (elementRect.top - 3) + "px", - width: width + "px" - }); - } else { - tooltip.arrow.addClass('ng-arrow-left'); - tooltip.callout.css({ - position: 'fixed', - left: (elementRect.right + arrowWidth) + "px", - top: (elementRect.top - 3) + "px", - width: width + "px" - }); - } - } else if (tooltip) { - tooltip.callout.remove(); - tooltip = null; - } - }); -}, ['$browser', '$document'], true); |
