aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/element.rs')
-rw-r--r--components/script/dom/element.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs
index eecff289cdb..268b263fc41 100644
--- a/components/script/dom/element.rs
+++ b/components/script/dom/element.rs
@@ -540,6 +540,16 @@ impl Element {
}
true // whatwg/html#5239
}
+
+ // https://html.spec.whatwg.org/multipage/#the-directionality
+ pub fn directionality(&self) -> String {
+ self.downcast::<HTMLElement>()
+ .and_then(|html_element| html_element.directionality())
+ .unwrap_or_else(|| {
+ let node = self.upcast::<Node>();
+ node.parent_directionality()
+ })
+ }
}
#[allow(unsafe_code)]