diff --git a/src/js/extensions/anchor-preview.js b/src/js/extensions/anchor-preview.js index 8963f68ba..041356c2a 100644 --- a/src/js/extensions/anchor-preview.js +++ b/src/js/extensions/anchor-preview.js @@ -83,9 +83,11 @@ return true; } - if (this.previewValueSelector) { - this.anchorPreview.querySelector(this.previewValueSelector).textContent = anchorEl.attributes.href.value; - this.anchorPreview.querySelector(this.previewValueSelector).href = anchorEl.attributes.href.value; + const hrefAttribute = anchorEl.attributes.href; + if (hrefAttribute) { + const hrefValue = hrefAttribute.value; + this.anchorPreview.querySelector(this.previewValueSelector).textContent = hrefValue; + this.anchorPreview.querySelector(this.previewValueSelector).href = hrefValue; } this.anchorPreview.classList.add('medium-toolbar-arrow-over');