aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/document.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-06-24 23:34:37 -0500
committerGitHub <noreply@github.com>2016-06-24 23:34:37 -0500
commit7d978e7b3d6b41b234f7c9b4051b746a1fbeddee (patch)
tree9dcc0efaf46c2a8f301d871019a51d71c32e66cb /components/script/dom/document.rs
parent04271124bb00567acfec546a469f5cc680a34ffd (diff)
parent01c3640e5fd957fc946c25708cdd8c364f5a59ad (diff)
downloadservo-7d978e7b3d6b41b234f7c9b4051b746a1fbeddee.tar.gz
servo-7d978e7b3d6b41b234f7c9b4051b746a1fbeddee.zip
Auto merge of #11665 - davideGiovannini:master, r=KiChjang
Fixed issue #11651 (Do not fire a blur event when calling .focus() on… <!-- Please describe your changes on the following line: --> Added check in `HTMLElement.Focus` to avoid requesting focus when the element already has it. Added check in `Document.commit_focus_transaction` to avoid sending `blur` and `focus` events when clicking on an already focused element. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #11651 <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11665) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r--components/script/dom/document.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index a69537d3c1c..08c04bf2b3e 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -599,6 +599,9 @@ impl Document {
/// Reassign the focus context to the element that last requested focus during this
/// transaction, or none if no elements requested it.
pub fn commit_focus_transaction(&self, focus_type: FocusType) {
+ if self.focused == self.possibly_focused.get().r() {
+ return
+ }
if let Some(ref elem) = self.focused.get() {
let node = elem.upcast::<Node>();
elem.set_focus_state(false);