mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
webdriver: Implement element clear (#38208)
Initial Implementation of [Element Clear](https://w3c.github.io/webdriver/#element-clear). Testing: `tests/wpt/tests/webdriver/tests/classic/element_clear/` --------- Signed-off-by: PotatoCP <Kenzie.Raditya.Tirtarahardja@huawei.com> Signed-off-by: Kenzie Raditya Tirtarahardja <kenzieradityatirtarahardja18@gmail.com> Co-authored-by: Euclid Ye <yezhizhenjiakang@gmail.com> Co-authored-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
1fb782bc38
commit
4b12ae73fe
11 changed files with 175 additions and 367 deletions
|
@ -204,7 +204,7 @@ impl HTMLTextAreaElement {
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#concept-fe-mutable
|
||||
fn is_mutable(&self) -> bool {
|
||||
pub(crate) fn is_mutable(&self) -> bool {
|
||||
// https://html.spec.whatwg.org/multipage/#the-textarea-element%3Aconcept-fe-mutable
|
||||
// https://html.spec.whatwg.org/multipage/#the-readonly-attribute:concept-fe-mutable
|
||||
!(self.upcast::<Element>().disabled_state() || self.ReadOnly())
|
||||
|
@ -450,6 +450,13 @@ impl HTMLTextAreaElementMethods<crate::DomTypeHolder> for HTMLTextAreaElement {
|
|||
}
|
||||
|
||||
impl HTMLTextAreaElement {
|
||||
/// <https://w3c.github.io/webdriver/#ref-for-dfn-clear-algorithm-4>
|
||||
/// Used by WebDriver to clear the textarea element.
|
||||
pub(crate) fn clear(&self) {
|
||||
self.value_dirty.set(false);
|
||||
self.textinput.borrow_mut().set_content(DOMString::from(""));
|
||||
}
|
||||
|
||||
pub(crate) fn reset(&self) {
|
||||
// https://html.spec.whatwg.org/multipage/#the-textarea-element:concept-form-reset-control
|
||||
let mut textinput = self.textinput.borrow_mut();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue