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 var middleButtonMouseDownTarget = null; | |
|
Dan Beam
2016/05/24 01:57:31
wrap this in:
(function() {
... code ...
})();
Navid Zolghadr
2016/05/24 17:51:14
Done.
| |
| 6 document.addEventListener('mousedown', function(e) { | |
| 7 if (e.button == 1) { | |
|
Dan Beam
2016/05/24 01:57:32
no curlies
Navid Zolghadr
2016/05/24 17:51:14
Done.
| |
| 8 middleButtonMouseDownTarget = e.target; | |
| 9 } | |
| 10 }, true); | |
| 11 document.addEventListener('mouseup', function(e) { | |
| 12 if (e.button == 1) { | |
| 13 if (e.target == middleButtonMouseDownTarget) | |
|
Dan Beam
2016/05/24 01:57:32
how does this work with shadow DOM? should you be
Navid Zolghadr
2016/05/24 17:51:14
I don't think there is any shadow DOM here in this
| |
| 14 e.target.dispatchEvent(new MouseEvent('click', e)); | |
| 15 middleButtonMouseDownTarget = null; | |
| 16 } | |
| 17 }, true); | |
|
Dan Beam
2016/05/12 02:06:24
both of our code has all kind of things wrong with
dtapuska
2016/05/12 02:12:50
Won't this dispatch two click events if the mouse
Navid Zolghadr
2016/05/12 13:56:01
Yes, I believe Dave is right. Dan, your solutions
Dan Beam
2016/05/12 18:59:05
mousing up outside of the window still dispatches
Dan Beam
2016/05/12 19:08:21
obviously it's possible some other listener stops
Navid Zolghadr
2016/05/12 20:53:59
Dan, I totally agree that having a platform suppor
| |
| OLD | NEW |