-
Notifications
You must be signed in to change notification settings - Fork 2
why not return a fragment instead of a node list ? #1
Comments
Ouch. Shame on me, I didn't even know That would certainly be the better approach and even make the |
It's cool to be able to return a single node when it's a single node that is expected. |
Yep, I'd support that idea. In fact—as opposed to what I thought—that wouldn't even be a breaking change. |
I'm working on this right now and would like to hear your opinion: Do you see any downsides to returning a It would definitely simplify the API compared to determining return types by number of elements. |
Well, i've been using dom string templates for a project and most of the time, it's cool to be able to directly have the top node under the fingers. However, |
Unless |
Yeah, point taken. I've just read through some issues over at So basically that would mean having the However, that would in fact be a breaking change. I'm not sure much I'd value not releasing a new major version since almost nobody uses this package at the moment. (That issue generally could easily be fixed by defeating my terrible habit of releasing everything as So, to keep the current API, things could also be done the other way around: The current behaviour could be kept as the single-node option while adding a new alternative to Thoughts? |
Fair enough, though a bit verbose, but that can be fixed client-side. |
Also i think the |
Totally agreed. Verbosity should be fixable with ease, a Any thoughts on the method name though? |
|
I've read that over at Domenic's suggestion. It feels a little weird to me since I associate it with shooter games (even if I never actually played those), but I guess since I'm apparently the only one with that feeling I guess it's fine. :) |
I've updated the comment, please check the other ones. |
I like it as well. So, |
Handling fragments is simpler, because it works with native methods:
document.body.appendChild(Inst.list('<p></p><p></p>'))
The text was updated successfully, but these errors were encountered: