Skip to content

Commit

Permalink
fix(RTL): Unfixed .css() call post-jquery
Browse files Browse the repository at this point in the history
Removing jQuery broke any .css() call that's reading inherited styles.
Updated the normalize/denormalizeScrollLeft calls in gridUtil to use
getStyles().

Fixes #1620
  • Loading branch information
c0bra committed Sep 30, 2014
1 parent 006976b commit 8d31f6a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/js/core/services/ui-grid-util.js
Expand Up @@ -3,7 +3,12 @@
var module = angular.module('ui.grid');

function getStyles (elem) {
return elem.ownerDocument.defaultView.getComputedStyle(elem, null);
var e = elem;
if (typeof(e.length) !== 'undefined' && e.length) {
e = elem[0];
}

return e.ownerDocument.defaultView.getComputedStyle(e, null);
}

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

var scrollLeft = element.scrollLeft;

var dir = angular.element(element).css('direction');
var dir = s.getStyles(element)['direction'];

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

var browser = s.detectBrowser();

var dir = angular.element(element).css('direction');
var dir = s.getStyles(element)['direction'];

// IE stays normal in RTL
if (browser === 'ie') {
Expand Down

0 comments on commit 8d31f6a

Please sign in to comment.