Skip to content

Commit e44642f

Browse files
fix(mock-doc): return empty string if anchor has no href attribute (#6051)
1 parent 8f1bc55 commit e44642f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/mock-doc/element.ts

+3
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ export class MockAnchorElement extends MockHTMLElement {
107107
this.setAttribute('href', value);
108108
}
109109
get pathname() {
110+
if (!this.href) {
111+
return '';
112+
}
110113
return new URL(this.href).pathname;
111114
}
112115
}

0 commit comments

Comments
 (0)