Skip to content

Commit 9d785c6

Browse files
committed
fix: Markdown preview for <img> without src and <a> without href
1 parent fdcbf41 commit 9d785c6

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

assets/js/weasyl-markdown.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const weasylMarkdown = fragment => {
9393
const links = fragment.getElementsByTagName('a');
9494

9595
forEach(links, link => {
96-
const href = link.getAttribute('href');
96+
const href = link.getAttribute('href') || '';
9797
const i = href.indexOf(':');
9898
const scheme = href.substring(0, i);
9999
const user = href.substring(i + 1);
@@ -131,7 +131,7 @@ const weasylMarkdown = fragment => {
131131
const images = fragment.querySelectorAll('img');
132132

133133
forEach(images, image => {
134-
const src = image.getAttribute('src');
134+
const src = image.getAttribute('src') || '';
135135
const i = src.indexOf(':');
136136
const scheme = src.substring(0, i);
137137
const link = document.createElement('a');

0 commit comments

Comments
 (0)