When I remove the HYPE_element_container structure using JS… everything still works as expected. Why can't this be the default. What was the use case for keeping them around again?
removeHypeElementContainer.hype.zip (57,0 KB)
Test file with all sorts of stuff happening. All work.
<script >
/**
* This function removes the HYPE_element_container from the DOM.
* @param {HTMLElement} element - The element to remove the container from. As we are using it on HypeDocumentLoad the element will be the root of the document.
*/
function HypeDocumentLoad(hypeDocument, element, event) {
let hypeElementContainer = element.querySelector('.HYPE_element_container');
while (hypeElementContainer) {
let parent = hypeElementContainer.parentNode;
let children = hypeElementContainer.children;
for (let i = children.length - 1; i >= 0; i--) {
parent.insertBefore(children[i], hypeElementContainer);
}
parent.removeChild(hypeElementContainer);
hypeElementContainer = element.querySelector('.HYPE_element_container');
}
}
if ("HYPE_eventListeners" in window === false) window.HYPE_eventListeners = Array();
window.HYPE_eventListeners.unshift({type: "HypeDocumentLoad", callback: HypeDocumentLoad});
</script>
Update: Works even on complex layouts… just used it on a nested multi layout project. This really makes me wonder now. Feedback and other opinions welcome…