plumatic / dommy

A tiny ClojureScript DOM manipulation and event library
758 stars 74 forks source link

Add support for Custom Elements #68

Closed jeluard closed 9 years ago

jeluard commented 10 years ago

Custom Elements is a new w3c specification that introduces a new API to create DOM element: document.createElement(localName, typeExtension). This API reflects a new html syntax <button is="my-button"></button> where button would be the localName and my-button the typeExtension.

The equivalent hiccup syntax [:button {:is "my-button"}] should generate the proper DOM call when used with dommy to support this spec as setting is as an attribute (current behavior) has no effect.

jeluard commented 10 years ago

Any comment? Is that something you would consider addressing? Thanks!

cpetzold commented 10 years ago

Yeah, I think this is definitely a reasonable thing to add! If you're interested in taking a stab at it, it should just be a small change to base-element in template.cljs and compile-compound in macros.clj:

https://github.com/Prismatic/dommy/blob/master/src/dommy/template.cljs#L32-L34 https://github.com/Prismatic/dommy/blob/master/src/dommy/macros.clj#L126

jeluard commented 10 years ago

Great, I'll take a look then.

cpetzold commented 9 years ago

@jeluard thanks for contributing -- sorry to say we're deprecating templating. Please see https://github.com/Prismatic/dommy/pull/85

Let us know if you'd like to see templating maintained as a separate project!

jeluard commented 9 years ago

Actually yes I would be interested in creating a separate project that would be based on the templating code and add some more features on top of it. Would that be fine from your side?

cpetzold commented 9 years ago

Definitely! Let me know if you need any help getting started.

jeluard commented 9 years ago

Great! I'll let you know how it goes.

jeluard commented 9 years ago

I pushed a first release that just bundle dommy templating code. Let me know if something looks incorrect.

loganlinn commented 9 years ago

@jeluard That's giving me a 404. Might it be a private repo?

jeluard commented 9 years ago

Oups it should be public now.

jeluard commented 9 years ago

I am curious to know why there was 2 versions of node, one as a macro and one as a function. Is there a specific reason you would not want to use the macro one?

cpetzold commented 9 years ago

I think the function version was dead code that wasn't ever removed after the introduction of ->node-like. It's probably not necessary anymore.