Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Early return in utils if node does not have tagName #1

Merged
merged 1 commit into from
Aug 27, 2018

Conversation

noweverywhere
Copy link
Contributor

If any node between the first and the last nodes of the scrollyteller is
followed by text, or whitespace (like a carriage return) the call to
nextSibling returns a Text node which does not have a tagName
property, and does have a querySelectorAll method.

When querySelectorAll is called, in the changes introduced in commit
0a43e75 the text nodes cause an exception like this:

TypeError: s.querySelectorAll is not a function

The inability to have newlines between nodes, makes it very difficult to
manually write markup as all the marks have to be on the same
line.

It might be better to only reject if node does not respond to
querySelectorAll. I'm not sure if a Text node is valid as a
scrollyTeller panel node.

If any node between the first and the last nodes of the scrollyteller is
followed by text, or whitespace (like a carriage return) the call to
nextSibling returns a Text node is which does not have a `tagName`
property, and does have a `querySelectorAll` method.

When `querySelectorAll` is called, in the changes introduced in commit
0a43e75 the text nodes cause an exception like this:
```
TypeError: s.querySelectorAll is not a function
```

The inability to have newlines between nodes, makes it very difficult to
configure panel node markup as all the panels have to be on the same
line.

It might be better to only reject if node does not respond to
`querySelectorAll`. I'm not sure if a Text node is valid as a
scrollyTeller panel node.
@drzax drzax requested a review from nathanhoad August 27, 2018 02:15
@nathanhoad nathanhoad merged commit c37a7d8 into abcnews:master Aug 27, 2018
@drzax
Copy link
Member

drzax commented Aug 27, 2018

Thanks @noweverywhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants