aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/element.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2020-02-24 21:18:10 -0500
committerGitHub <noreply@github.com>2020-02-24 21:18:10 -0500
commit145c89a2d49b7a0c2842e99dff65da4d8164bf7d (patch)
tree77953fcbca71db4cec36c60594796df871d93239 /components/script/dom/element.rs
parente3a5f36fb21d8a93c248016bdd59b8878713a8a3 (diff)
parent50b495684ed37042fbc0b895f1e6d0a732b9d378 (diff)
downloadservo-145c89a2d49b7a0c2842e99dff65da4d8164bf7d.tar.gz
servo-145c89a2d49b7a0c2842e99dff65da4d8164bf7d.zip
Auto merge of #25499 - NeverHappened:implement-form-dirname, r=jdm
Implement dirname support for form element Added support for dirname in input on form submit Added Dir getter / setter for HTMLElement NOT YET Added get directionality according to https://html.spec.whatwg.org/multipage/dom.html#the-directionality - [X] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #25379 (GitHub issue number if applicable)
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)]