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

m() should be able to tolerate "[" as a tag and do the right thing about it. #2349

Closed
dead-claudia opened this issue Dec 28, 2018 · 0 comments · Fixed by #2352
Closed

m() should be able to tolerate "[" as a tag and do the right thing about it. #2349

dead-claudia opened this issue Dec 28, 2018 · 0 comments · Fixed by #2352
Labels
Type: Bug For bugs and any other unexpected breakage

Comments

@dead-claudia
Copy link
Member

dead-claudia commented Dec 28, 2018

Mithril Version: 2.0.0-rc.3

Expected Behavior

m("[", attrs, ...children) should be equivalent to m.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 with m("[", ...) (you could just wrap all the tests in a factory that is passed both m.fragment and function () { 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

  • Browser Name and version:
  • Operating System and version (desktop or mobile):
  • Link to your project:
@dead-claudia dead-claudia added the Type: Bug For bugs and any other unexpected breakage label Dec 28, 2018
vrimar added a commit to vrimar/mithril.js that referenced this issue Dec 29, 2018
dead-claudia pushed a commit that referenced this issue Jan 7, 2019
* Handle `[` fragment selector. Fix #2349

* Update tests

* Simplify hyperscript function
@dead-claudia dead-claudia moved this to Closed in Triage/bugs Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug For bugs and any other unexpected breakage
Projects
Status: Closed
Development

Successfully merging a pull request may close this issue.

1 participant