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

Add support for JSX fragments #25

Merged
merged 4 commits into from
Sep 8, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ const createElement = tagName => {
return document.createElementNS('http://www.w3.org/2000/svg', tagName);
}

if (tagName === DocumentFragment) {
return document.createDocumentFragment();
}

return document.createElement(tagName);
};

Expand Down Expand Up @@ -78,6 +82,7 @@ const build = (tagName, attrs, children) => {
};

function h(tagName, attrs) {
// eslint-disable-next-line prefer-rest-params

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you disabling this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My intent was to keep the original source code as intact as possible, so I decided the disable the rule for the line below instead of changing it. I have no problem in fixing it though, if you prefer :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, what you have is ok. Was just wondering whether there was another reason you disabled it.

const childrenArgs = [].slice.apply(arguments, [2]);
const children = document.createDocumentFragment();

Expand Down
Loading