Giter VIP home page Giter VIP logo

microh's People

Contributors

fuzetsu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

microh's Issues

support for attributes in tag selector?

Like mithril's hyperscript.

I left this out intentionally since I mainly use the selectors for classNames and I don't mind using the attributes object for attributes, but it could be nice.

Hyperapp >=2.0.5 Compatibility

Hey there, great library! This is exactly what I was looking for in my next project. Coming from Mithril, I got spoiled by its hyperscript helper. Also, clever that the m in m() stands for microh, but looks like Mithril. ๐Ÿ‘

As you may know, newer versions of Hyperapp post-v2.0.4 introduce the text() function for text nodes, and is now incompatible with other implementations of hyperscript. As such, writing h('p', {}, 'foo') is no longer valid. You must now write h('p', {}, text('foo')). This also applies to primitive number values, so you must also write h('p', {}, text(5)) if that's your intention.

The author of Hyperapp writes here about using newer versions of Hyperapp with JSX. Although microh has nothing to do with JSX, this comment was helpful in writing a function to pass to microh. Here's an example of this working in Flems.

Less of an issue, but still worth considering: Vnodes generated by Hyperapp's new text() function are invalid with microh if the value passed to text() is falsey. This is because writing text(0) or text('') for example, will generate these respectively:

{ type: 0, props: {}, children: [], node: undefined, key: null, tag: 3 }
{ type: '', props: {}, children: [], node: undefined, key: null, tag: 3 }

microh will use the type property as the tagKey here on this line, and so the children will be shifted. Here's the incompatibility in action

As Hyperapp now strays from normal hyperscript implementations, it might be silly for microh to chase compatibility with it until its API is stable. These breaking changes in Hyperapp occurred between 2.0.4 and 2.0.5, so it's hard to predict if you instinctively follow semver. It might, however, be worth adding a disclaimer in the README that Hyperapp versions past 2.0.4 require additional code to work with microh.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.