From a60407877d4b4c27570e2066c01828cde40e6fb4 Mon Sep 17 00:00:00 2001 From: yotamberk Date: Thu, 27 Oct 2016 12:26:13 +0300 Subject: [PATCH] check parent DOM elements for direction attribute (#2237) * Fix PR comment * Remove extra line --- lib/timeline/Timeline.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/timeline/Timeline.js b/lib/timeline/Timeline.js index 97eafd24..aeae38c6 100644 --- a/lib/timeline/Timeline.js +++ b/lib/timeline/Timeline.js @@ -63,7 +63,12 @@ function Timeline (container, items, groups, options) { this._create(container); 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 { this.options.rtl = options.rtl; }