vue-scrollto icon indicating copy to clipboard operation
vue-scrollto copied to clipboard

Fails when trying to scroll to element where ID contains a colon (:)

Open Nickno95 opened this issue 3 years ago • 2 comments

HTML5 allows elements to have IDs that contain colons, ex:

<div id="#this:isvalid"></div>

However, because this library is using document.querySelector, it is going by CSS selector rules, so a colon in the ID would need to be escaped before calling querySelector, otherwise it would fail with error:

Uncaught DOMException: Failed to execute 'querySelector' on 'Document': '#this:isvalid' is not a valid selector.

Nickno95 avatar Sep 11 '21 11:09 Nickno95

Had the same error. Would be nice if that could be fixed on the plugin layer, just for others who might stumble upon the problem:

string.replace(':', '\\:') works

tre-dev avatar Nov 19 '21 12:11 tre-dev

Duplicate of #532 (only with different id characters)

hacknug avatar Dec 10 '21 20:12 hacknug