Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 (function() { | |
| 6 | |
| 7 var middleButtonMouseDownTarget = null; | |
| 8 | |
| 9 document.addEventListener('mousedown', function(e) { | |
| 10 if (e.button == 1) | |
| 11 middleButtonMouseDownTarget = e.path[0]; | |
| 12 }, true); | |
| 13 | |
| 14 document.addEventListener('mouseup', function(e) { | |
| 15 if (e.button != 1) | |
| 16 return; | |
| 17 | |
| 18 if (e.path[0] == middleButtonMouseDownTarget) | |
|
Dan Beam
2016/05/24 18:48:00
btw, it probably doesn't matter, but if e.path.len
Navid Zolghadr
2016/05/24 19:22:30
I added the length check as well. I guess that wou
| |
| 19 middleButtonMouseDownTarget.dispatchEvent(new MouseEvent('click', e)); | |
| 20 | |
| 21 middleButtonMouseDownTarget = null; | |
| 22 }, true); | |
| 23 | |
| 24 })(); | |
| OLD | NEW |