File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -271,13 +271,25 @@ var onclick = function (event) {
271271 }
272272
273273 let link = $ . eventTarget ( event ) ;
274- while ( link && link . tagName !== "A" ) {
274+ while ( link && ! ( link . tagName === "A" || link . tagName === "a" ) ) {
275275 link = link . parentNode ;
276276 }
277277
278- if ( link && ! link . target && isSameOrigin ( link . href ) ) {
278+ if ( ! link ) return ;
279+
280+ // If the `<a>` is in an SVG, its attributes are `SVGAnimatedString`s
281+ // instead of strings
282+ let href = link . href instanceof SVGAnimatedString
283+ ? new URL ( link . href . baseVal , location . href ) . href
284+ : link . href ;
285+ let target = link . target instanceof SVGAnimatedString
286+ ? link . target . baseVal
287+ : link . target ;
288+
289+ if ( ! target && isSameOrigin ( href ) ) {
279290 event . preventDefault ( ) ;
280- let path = link . pathname + link . search + link . hash ;
291+ let parsedHref = new URL ( href ) ;
292+ let path = parsedHref . pathname + parsedHref . search + parsedHref . hash ;
281293 path = path . replace ( / ^ \/ \/ + / , "/" ) ; // IE11 bug
282294 page . show ( path ) ;
283295 }
You can’t perform that action at this time.
0 commit comments