From 78e44f908f915d9e682ca752f1d629b4c6a976fa Mon Sep 17 00:00:00 2001 From: Alexey Sobolev Date: Fri, 10 May 2019 10:40:06 +0300 Subject: [PATCH] fix(core): support jQlite --- packages/core/src/js/directives/ui-grid.js | 2 +- packages/core/src/js/services/ui-grid-util.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/core/src/js/directives/ui-grid.js b/packages/core/src/js/directives/ui-grid.js index 137eaaa3df..ab72e1db1e 100644 --- a/packages/core/src/js/directives/ui-grid.js +++ b/packages/core/src/js/directives/ui-grid.js @@ -338,7 +338,7 @@ function uiGridDirective($window, gridUtil, uiGridConstants) { // Resize the grid on window resize events function gridResize() { - if (!$elm.is(':visible')) { + if (!gridUtil.isVisible($elm)) { return; } grid.gridWidth = $scope.gridWidth = gridUtil.elementWidth($elm); diff --git a/packages/core/src/js/services/ui-grid-util.js b/packages/core/src/js/services/ui-grid-util.js index e053d509d2..a747ce0348 100644 --- a/packages/core/src/js/services/ui-grid-util.js +++ b/packages/core/src/js/services/ui-grid-util.js @@ -457,6 +457,10 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC }, + isVisible: function (elem) { + return !!( elem[0].offsetWidth || elem[0].offsetHeight || elem[0].getClientRects().length ) + }, + // Thanks to http://stackoverflow.com/a/13382873/888165 getScrollbarWidth: function() { var outer = document.createElement("div");