Ignore modifier+click and middle click in m.route.link

Currently, middle clicking and ctrl+click change the route in the
current tab. Expected behavior is to open a new tab/window.
This commit is contained in:
Skyler 2016-10-18 13:54:18 -07:00 committed by Skyler Lipthay
parent 4b01d1dfd4
commit 27e98e6fc3

View file

@ -112,6 +112,7 @@ module.exports = function($window) {
function link(vnode) {
vnode.dom.setAttribute("href", prefix + vnode.attrs.href)
vnode.dom.onclick = function(e) {
if (e.ctrlKey || e.metaKey || e.shiftKey || e.which === 2) return
e.preventDefault()
e.redraw = false
var href = this.getAttribute("href")