shshaw / Splitting

JavaScript microlibrary to split an element by words, characters, children and more, populated with CSS variables!

Home Page:https://splitting.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nonexistent plugin check

shshaw opened this issue · comments

commented

From #26

Cannot read property 'depends' of undefined

It looks like React is setting data-splitting to data-splitting="true" instead of leaving it as only the attribute as you have in the JSX. Splitting then looks for a "true" split plugin, which doesn't exist, hence the error! 😀

There should be some better error checking in the plugin detection, which we'll look at for the next release.

commented

So here are some options.

  • we can explicitly assume "true" = "". this will fallback to chars. This would be a specific fix for JSX users
  • we can throw an error when a plugin is referenced that is not loaded

I think if we do one or both of those, it will make the issue better overall.

commented

I added code to check for the value and to treat both falsy and pluginName === "true" as chars

commented

This fell off my radar and was not in the master branch as I expected. I created #39 to get it into the main branch.

commented

Committed this directly to master