Famous / engine

MIT License
1.75k stars 250 forks source link

FR: Allow one to pass an Element to DOMElement.setContent() #459

Closed CompSciFutures closed 9 years ago

CompSciFutures commented 9 years ago

DOMElement's reliance on text to specify the innerHTML loses lots of useful DOM functionality, for example, fine grained event handling, XPathing and various manipulations and traversals of DOM content.

To keep things lightweight, I propose that you allow one to pass an Element (https://developer.mozilla.org/en-US/docs/Web/API/Element) to a Famous DOMElement, eg:

new DOMElement(node).setContent(document.createElement("div"));

This avoids the need to convert large slabs of HTML into a Famous render tree and retains all that DOM tree goodness.

alexanderGugel commented 9 years ago

This has been discussed before. Unfortunately the proposed solution won't work in a WebWorker. For now we prioritize having an environment agnostic platform.