On Sep 12, 2006, at 8:50 AM, Marc Boeren wrote:
> Hi,
>
> Is it useful to have a simple toDOM(html) function in MochKit.DOM? I
> like it because I can make simple templates as html snippets, which I
> find more readable than the corresponding createDOM constructions.
>
> Usage:
>
> var html = '<div class="selection"><img src="example.png"/>My
> Text</div>';
> var domElements = toDOM(html);
>
> var container= getElement('container');
> for(i=0, n=domElements.length; i<n; ++i) {
> container.appendChild(domElements[i]);
> }
>
>
> The implementation is simple (as standalone function):
>
> function toDOM(html)
> {
> var div = MochiKit.DOM.DIV();
> div.innerHTML = html;
> return div.childNodes;
> }
>
> Does anyone know how wel-supported the non-standard innerHTML is?
If you're using it for the implementation, why not just short circuit
it all with:
var container = getElement('container');
container.innerHTML = html;
?
Zac
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/mochikit
-~----------~----~----~----~------~----~------~--~---