m()
should be able to tolerate "["
as a tag and do the right thing about it.
#2349
Labels
Type: Bug
For bugs and any other unexpected breakage
Mithril Version: 2.0.0-rc.3
Expected Behavior
m("[", attrs, ...children)
should be equivalent tom.fragment(attrs, ...children)
Current Behavior
Mithril treats it like a DOM element, which is obviously the wrong thing to do here.
Possible Solution
Add
&& selector !== "["
to this condition and duplicate all the basic fragment tests to check that it works equivalently withm("[", ...)
(you could just wrap all the tests in a factory that is passed bothm.fragment
andfunction () { return m.apply(null, ["["].concat(arguments)) }
to create the fragment. Yes, it's that simple.Steps to Reproduce
Context
It makes it basically impossible to use
pragmaFrag: "'['"
//* @jsxFrag '[' */
with Babel (which does actually work)Additional Information
Your Environment
The text was updated successfully, but these errors were encountered: