Skip to content

Commit 0457bf3

Browse files
author
Ferry Kobus
committed
Fixed bug where elem isn't an element fixes cferdinandi#252
1 parent 1aae80a commit 0457bf3

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

dist/js/smooth-scroll.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*!
2-
* smooth-scroll v9.1.2: Animate scrolling to anchor links
2+
* smooth-scroll v9.1.3: Animate scrolling to anchor links
33
* (c) 2016 Chris Ferdinandi
44
* MIT License
55
* http://github.com/cferdinandi/smooth-scroll
@@ -122,7 +122,7 @@
122122
}
123123

124124
// Get closest match
125-
for ( ; elem && elem !== document; elem = elem.parentNode ) {
125+
for ( ; elem && elem !== document && elem.nodeType === 1; elem = elem.parentNode ) {
126126

127127
// If selector is a class
128128
if ( firstChar === '.' ) {

dist/js/smooth-scroll.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "smooth-scroll",
3-
"version": "9.1.2",
3+
"version": "9.1.3",
44
"description": "Animate scrolling to anchor links",
55
"main": "./dist/js/smooth-scroll.min.js",
66
"author": {

src/js/smooth-scroll.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
}
116116

117117
// Get closest match
118-
for ( ; elem && elem !== document; elem = elem.parentNode ) {
118+
for ( ; elem && elem !== document && elem.nodeType === 1; elem = elem.parentNode ) {
119119

120120
// If selector is a class
121121
if ( firstChar === '.' ) {

0 commit comments

Comments
 (0)