Browse Source

check parent DOM elements for direction attribute (#2237)

* Fix PR comment
* Remove extra line
codeClimate
yotamberk 8 years ago
committed by Alexander Wunschik
parent
commit
a60407877d
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      lib/timeline/Timeline.js

+ 6
- 1
lib/timeline/Timeline.js View File

@ -63,7 +63,12 @@ function Timeline (container, items, groups, options) {
this._create(container); this._create(container);
if (!options || (options && typeof options.rtl == "undefined")) { if (!options || (options && typeof options.rtl == "undefined")) {
this.options.rtl = window.getComputedStyle(this.dom.root, null).direction == "rtl";
var directionFromDom, domNode = this.dom.root;
while (!directionFromDom && domNode) {
directionFromDom = window.getComputedStyle(domNode, null).direction;
domNode = domNode.parentElement;
}
this.options.rtl = (directionFromDom && (directionFromDom.toLowerCase() == "rtl"));
} else { } else {
this.options.rtl = options.rtl; this.options.rtl = options.rtl;
} }

Loading…
Cancel
Save