Skip to content
This repository has been archived by the owner on Jul 25, 2022. It is now read-only.

Fix id starting with number #103

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

acekat
Copy link

@acekat acekat commented Nov 14, 2019

Hey !

This PR is to fix cases where ids are set and start with a number (this is valid HTML5).
querySelector raise a SyntaxError as it expects a valid CSS selector, yet we can use getElementById as we are only looking for ids

I changed the test fixtures to have 3rd-heanding as id and fixed the selector in src/util/updateActiveNavItem.js and src/util/updatePositionData.js

My demo Pen works as expected : https://codepen.io/acekat/pen/pooxLjy

Thanks for your work 👍

Copy link
Owner

@jimmynotjim jimmynotjim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR @acekat, sorry it took me so long to reply. Just a couple of comments and then I can merge this and set up a release.

src/util/updateActiveNavItem.js Outdated Show resolved Hide resolved
dist/scrollnav.min.js Outdated Show resolved Hide resolved
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants