@@ -30,12 +30,7 @@ export default function (client: ScramjetClient, self: typeof window) {
3030 self . HTMLScriptElement ,
3131 self . HTMLSourceElement ,
3232 ] ,
33- href : [
34- self . HTMLAnchorElement ,
35- self . HTMLLinkElement ,
36- self . SVGUseElement ,
37- self . SVGImageElement ,
38- ] ,
33+ href : [ self . HTMLAnchorElement , self . HTMLLinkElement ] ,
3934 data : [ self . HTMLObjectElement ] ,
4035 action : [ self . HTMLFormElement ] ,
4136 formaction : [ self . HTMLButtonElement , self . HTMLInputElement ] ,
@@ -219,6 +214,28 @@ export default function (client: ScramjetClient, self: typeof window) {
219214 } ,
220215 } ) ;
221216
217+ // this is separate from the regular href handlers because it returns an SVGAnimatedString
218+ client . Trap ( "SVGAnimatedString.prototype.baseVal" , {
219+ get ( ctx ) {
220+ const href = ctx . get ( ) as string ;
221+ if ( ! href ) return href ;
222+
223+ return unrewriteUrl ( href ) ;
224+ } ,
225+ set ( ctx , val : string ) {
226+ ctx . set ( rewriteUrl ( val , client . meta ) ) ;
227+ } ,
228+ } ) ;
229+ client . Trap ( "SVGAnimatedString.prototype.animVal" , {
230+ get ( ctx ) {
231+ const href = ctx . get ( ) as string ;
232+ if ( ! href ) return href ;
233+
234+ return unrewriteUrl ( href ) ;
235+ } ,
236+ // it has no setter
237+ } ) ;
238+
222239 client . Proxy ( "Element.prototype.removeAttribute" , {
223240 apply ( ctx ) {
224241 if ( ctx . args [ 0 ] . startsWith ( "scramjet-attr" ) ) return ctx . return ( undefined ) ;
0 commit comments