Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit f5535f8

Browse files
Splaktarjelbourn
authored andcommitted
fix(tooltip): move document.contains polyfill for IE11 into $mdUtil (#11749)
when `$mdGestureProvider.disableAll()` was called - the polyfill wasn't being registered - this cause hovering over a tooltip to throw now we always register it when $mdUtil loads Fixes #11745
1 parent 313e5e6 commit f5535f8

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/core/services/compiler/compiler.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,6 @@ function MdCompilerProvider($compileProvider) {
506506
* @returns {{element: !JQLite, restore: !function}}
507507
*/
508508
MdCompilerService.prototype._fetchContentElement = function(options) {
509-
510509
var contentEl = options.contentElement;
511510
var restoreFn = null;
512511

src/core/services/gesture/gesture.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -577,12 +577,6 @@ function attachToDocument($mdGesture, $$MdGestureHandler) {
577577
return;
578578
}
579579

580-
// Polyfill document.contains for IE11.
581-
// TODO: move to util
582-
document.contains || (document.contains = function (node) {
583-
return document.body.contains(node);
584-
});
585-
586580
if (!isInitialized && $mdGesture.isHijackingClicks) {
587581
/*
588582
* If hijack clicks is true, we preventDefault any click that wasn't

src/core/util/util.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,18 @@ angular
1919
/**
2020
* @ngInject
2121
*/
22-
function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $interpolate, $log, $rootElement, $window, $$rAF) {
22+
function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $interpolate, $log,
23+
$rootElement, $window, $$rAF) {
2324
// Setup some core variables for the processTemplate method
2425
var startSymbol = $interpolate.startSymbol(),
2526
endSymbol = $interpolate.endSymbol(),
2627
usesStandardSymbols = ((startSymbol === '{{') && (endSymbol === '}}'));
2728

29+
// Polyfill document.contains for IE11.
30+
document.contains || (document.contains = function (node) {
31+
return document.body.contains(node);
32+
});
33+
2834
/**
2935
* Checks if the target element has the requested style by key
3036
* @param {DOMElement|JQLite} target Target element
@@ -37,14 +43,15 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
3743

3844
if (target && target.length) {
3945
var computedStyles = $window.getComputedStyle(target[0]);
40-
hasValue = angular.isDefined(computedStyles[key]) && (expectedVal ? computedStyles[key] == expectedVal : true);
46+
hasValue = angular.isDefined(computedStyles[key]) &&
47+
(expectedVal ? computedStyles[key] == expectedVal : true);
4148
}
4249

4350
return hasValue;
4451
};
4552

4653
function validateCssValue(value) {
47-
return !value ? '0' :
54+
return !value ? '0' :
4855
hasPx(value) || hasPercent(value) ? value : value + 'px';
4956
}
5057

@@ -54,7 +61,6 @@ function UtilFactory($document, $timeout, $compile, $rootScope, $$mdAnimate, $in
5461

5562
function hasPercent(value) {
5663
return String(value).indexOf('%') > -1;
57-
5864
}
5965

6066
var $mdUtil = {

0 commit comments

Comments
 (0)