mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
script(webdriver): Send keys set caret at the end of content of text input (#38250)
Remote end step of [element send keys](https://w3c.github.io/webdriver/#element-send-keys) > Step 8.2. Set the text insertion caret using [set selection range](https://w3c.github.io/webdriver/#dfn-set-selection-range) using current text length for both the start and end parameters. Also check if the element is already an active element before focusing (Step 7.7). Testing: `./tests/wpt/tests/webdriver/tests/classic/element_send_keys/form_controls.py` --------- 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>
This commit is contained in:
parent
ab78a76da6
commit
165ede59cd
3 changed files with 47 additions and 23 deletions
|
@ -1733,8 +1733,17 @@ impl Element {
|
|||
|
||||
/// <https://dom.spec.whatwg.org/#document-element>
|
||||
pub(crate) fn is_document_element(&self) -> bool {
|
||||
if let Some(ref document_element) = self.owner_document().GetDocumentElement() {
|
||||
**document_element == *self
|
||||
if let Some(document_element) = self.owner_document().GetDocumentElement() {
|
||||
*document_element == *self
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#dom-document-activeelement>
|
||||
pub(crate) fn is_active_element(&self) -> bool {
|
||||
if let Some(active_element) = self.owner_document().GetActiveElement() {
|
||||
*active_element == *self
|
||||
} else {
|
||||
false
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue