FR: Allow one to pass an Element to DOMElement.setContent()
CompSciFutures opened this issue · comments
Andrew (AP) Prendergast commented
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.
Alexander Gugel commented
This has been discussed before. Unfortunately the proposed solution won't work in a WebWorker. For now we prioritize having an environment agnostic platform.