Skip to content

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

@nicholasbrantley

Description

@nicholasbrantley

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions