File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -271,13 +271,25 @@ var onclick = function (event) {
271
271
}
272
272
273
273
let link = $ . eventTarget ( event ) ;
274
- while ( link && link . tagName !== "A" ) {
274
+ while ( link && ! ( link . tagName === "A" || link . tagName === "a" ) ) {
275
275
link = link . parentNode ;
276
276
}
277
277
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 ) ) {
279
290
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 ;
281
293
path = path . replace ( / ^ \/ \/ + / , "/" ) ; // IE11 bug
282
294
page . show ( path ) ;
283
295
}
You can’t perform that action at this time.
0 commit comments