mirror of
https://gitee.com/docsifyjs/docsify.git
synced 2024-12-02 03:59:19 +08:00
fix: Cannot read property 'tagName' of null (#1655)
Have a look at this issue #1154 . https://codesandbox.io/s/loving-matsumoto-hp985?file=/index.html Open devtools and click the *blank space* of svg(not path) will reproduce this issue. `parentNode` may be `null`. https://github.com/docsifyjs/docsify/blob/develop/src/core/router/history/html5.js#L25-L27 However, hash router has fixed this issue😜. https://github.com/docsifyjs/docsify/blob/develop/src/core/router/history/hash.js#L47-L49 Co-authored-by: 沈唁 <52o@qq52o.cn>
This commit is contained in:
parent
57dc8a9238
commit
c3cdadc371
@ -24,7 +24,7 @@ export class HTML5History extends History {
|
||||
on('click', e => {
|
||||
const el = e.target.tagName === 'A' ? e.target : e.target.parentNode;
|
||||
|
||||
if (el.tagName === 'A' && !/_blank/.test(el.target)) {
|
||||
if (el && el.tagName === 'A' && !/_blank/.test(el.target)) {
|
||||
e.preventDefault();
|
||||
const url = el.href;
|
||||
// solve history.pushState cross-origin issue
|
||||
|
Loading…
Reference in New Issue
Block a user