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

Error when splitting text containing line breaks #5

Closed
lukePeavey opened this issue Nov 13, 2020 · 1 comment
Closed

Error when splitting text containing line breaks #5

lukePeavey opened this issue Nov 13, 2020 · 1 comment

Comments

@lukePeavey
Copy link
Owner

Description

SplitType fails with an error when the target element contains <br> tags. This only occurs when splitting text into both lines and words.

Steps to reproduce

HTML

<div id="target">foo <br> bar </div>

Javascript

const text = new SplitType('#target', { types: 'lines, words' })

Live example

Expected result

It should respect <br> tags when splitting text into lines. The above code should produce the following html

<div id="target">
  <div class="line">
    <div class="word">foo</div>
  </div>
  <div class="line">
    <div class="word">bar</div>
  </div>
</div>

Actual result

Uncaught TypeError: Cannot read property 'concat' of null
    at split-type.js:567
    at Array.reduce (<anonymous>)
    at splitSingleElement (split-type.js:512)
    at split-type.js:875
    at Array.forEach (<anonymous>)
    at SplitType.split (split-type.js:872)
    at new SplitType (split-type.js:839)
    at pen.js:7
@lukePeavey
Copy link
Owner Author

Fixed

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

No branches or pull requests

1 participant