Skip to content

Commit 8d31f6a

Browse files
committed
fix(RTL): Unfixed .css() call post-jquery
Removing jQuery broke any .css() call that's reading inherited styles. Updated the normalize/denormalizeScrollLeft calls in gridUtil to use getStyles(). Fixes #1620
1 parent 006976b commit 8d31f6a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/js/core/services/ui-grid-util.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@
33
var module = angular.module('ui.grid');
44

55
function getStyles (elem) {
6-
return elem.ownerDocument.defaultView.getComputedStyle(elem, null);
6+
var e = elem;
7+
if (typeof(e.length) !== 'undefined' && e.length) {
8+
e = elem[0];
9+
}
10+
11+
return e.ownerDocument.defaultView.getComputedStyle(e, null);
712
}
813

914
var rnumnonpx = new RegExp( "^(" + (/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source + ")(?!px)[a-z%]+$", "i" ),
@@ -792,8 +797,8 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
792797
var browser = s.detectBrowser();
793798

794799
var scrollLeft = element.scrollLeft;
795-
796-
var dir = angular.element(element).css('direction');
800+
801+
var dir = s.getStyles(element)['direction'];
797802

798803
// IE stays normal in RTL
799804
if (browser === 'ie') {
@@ -842,7 +847,7 @@ module.service('gridUtil', ['$log', '$window', '$document', '$http', '$templateC
842847

843848
var browser = s.detectBrowser();
844849

845-
var dir = angular.element(element).css('direction');
850+
var dir = s.getStyles(element)['direction'];
846851

847852
// IE stays normal in RTL
848853
if (browser === 'ie') {

0 commit comments

Comments
 (0)