Skip to content

Conversation

@jviide
Copy link
Collaborator

@jviide jviide commented Jul 23, 2019

This pull request fixes issue #104, making babel-plugin-htm act correctly for non-element roots. For example text-only roots (html`foo`) or mixed text/dynamic roots (html`foo${1}bar`) should now work. This is done by unifying how root nodes and child nodes are handled, essentially simplifying the plugin code.

This PR also add tests for the fixed behavior (that fail without the fix).

Fixes #104.

@jviide jviide requested a review from developit July 23, 2019 20:52
@luwes
Copy link

luwes commented Jul 24, 2019

@jviide was if (node === null) return t.nullLiteral(); not needed anymore?

@jviide
Copy link
Collaborator Author

jviide commented Jul 24, 2019

@luwes Correct. The node parameter should not be null in any valid situation, it should be either undefined, a string, a Babel node or an HTM element (of form { tag, props, children }). Unless I'm mistaken, of course 🙂

@luwes
Copy link

luwes commented Jul 24, 2019

thanks, great to know. Congrats on the 5000 🌟 This pkg is the best thing since sliced bread!

@jviide jviide merged commit 4d50d16 into developit:master Jul 25, 2019
@jviide jviide deleted the issue-104 branch July 25, 2019 15:44
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.

Issue with simple text in root

3 participants