hexonaut / haxe-dom

A cross-platform implementation of the DOM. Built to reduce duplicate code across server and client.
MIT License
46 stars 4 forks source link

Serialization of html partials (not wrapped in EHtml)? #10

Closed cambiata closed 10 years ago

cambiata commented 10 years ago

Hi Sam!

Is it somehow possible to serialize dom elements not wrapped in a EHtml? For example, something like:

var ul = new EUnorderedList();
ul.appendChild(new EListItem().addText('Hello'));
var ulHtml = HtmlSerializer.run(ul);

?

hexonaut commented 10 years ago

I haven't tested this, but it may work with a couple of tweaks.

I've thought about this and felt it was not a priority as I fail to see a use case. If you are choosing to use hxdom at the core of your web app then there should be no need for partials. The initial load is the only time you really need hxdom and after that you can just pass data via JSON/haxe serialization/remoting/etc.

Could you provide me with an example of where this would be useful?

cambiata commented 10 years ago

I'm just playing around, doing some "pre-prototyping" for a coming smaller project - trying to see if haxe-dom somehow could fit in. I'll throw a question at you on the haxelang forum about the use of Isomorphic JS in larger web apps. (I guess this is of interest to others.) Cheers!

hexonaut commented 10 years ago

Sounds good. Let me know if you come up for a use case for partials and I'll consider adding support.

cambiata commented 10 years ago

No need to care about that for now, I can always strip a wrapping html node...

Opened a question on haxelang: "Isomorphic Javascript (haxe-dom etc) and larger webapps?". Hopefully this can enlighten me a bit about the real life use-cases of haxe-dom and isomorphic js...! :-)