(cb = noop)
| 21 | } |
| 22 | |
| 23 | onchange(cb = noop) { |
| 24 | on('click', e => { |
| 25 | const el = e.target.tagName === 'A' ? e.target : e.target.parentNode; |
| 26 | |
| 27 | if (el && el.tagName === 'A' && !isExternal(el.href)) { |
| 28 | e.preventDefault(); |
| 29 | const url = el.href; |
| 30 | window.history.pushState({ key: url }, '', url); |
| 31 | cb({ event: e, source: 'navigate' }); |
| 32 | } |
| 33 | }); |
| 34 | |
| 35 | on('popstate', e => { |
| 36 | cb({ event: e, source: 'history' }); |
| 37 | }); |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Parse the url |
nothing calls this directly
no test coverage detected