Fixed issue #11651 (Do not fire a blur event when calling .focus() on a focused element)

This commit is contained in:
Davide Giovannini 2016-06-07 20:36:29 +02:00
parent f56848a0e8
commit 35aa24eb4c
2 changed files with 22 additions and 17 deletions

View file

@ -251,6 +251,9 @@ impl HTMLElementMethods for HTMLElement {
fn Focus(&self) {
// TODO: Mark the element as locked for focus and run the focusing steps.
// https://html.spec.whatwg.org/multipage/#focusing-steps
if self.upcast::<Element>().focus_state() {
return;
}
let document = document_from_node(self);
document.begin_focus_transaction();
document.request_focus(self.upcast());