From d065e37e0e19f399597796b5257bfca3a5c79fd6 Mon Sep 17 00:00:00 2001 From: Anthony Sendra Date: Thu, 1 Dec 2016 10:42:08 +0100 Subject: [PATCH] fix .getAttribute on an object without this method --- src/components/link.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/link.js b/src/components/link.js index 11dc829a5..fd1b9a3ac 100644 --- a/src/components/link.js +++ b/src/components/link.js @@ -94,8 +94,10 @@ function guardEvent (e) { if (e.button !== 0) return // don't redirect if `target="_blank"` /* istanbul ignore if */ - const target = e.target.getAttribute('target') - if (/\b_blank\b/i.test(target)) return + if (e.target && e.target.getAttribute) { + const target = e.target.getAttribute('target') + if (/\b_blank\b/i.test(target)) return + } e.preventDefault() return true