Commit 527b49d7 authored by Romain Courteaud's avatar Romain Courteaud

erp5_web_js_style: using a template instead of noscript is good in JS

But completely breaks in case of browsers not handling JS...
parent 85d84bfe
Pipeline #23736 failed with stage
in 0 seconds
...@@ -81,7 +81,7 @@ ...@@ -81,7 +81,7 @@
<body tal:attributes="data-nostyle-gadget-url no_style_gadget_url; <body tal:attributes="data-nostyle-gadget-url no_style_gadget_url;
data-nostyle-css-url no_style_css_url"> data-nostyle-css-url no_style_css_url">
<tal:block tal:content="structure python: web_section.WebSection_generateNavigationHTML()"></tal:block> <tal:block tal:content="structure python: web_section.WebSection_generateNavigationHTML()"></tal:block>
<main><noscript> <main><template>
<p tal:content="request/portal_status_message | nothing" id="portal_status_message"/> <p tal:content="request/portal_status_message | nothing" id="portal_status_message"/>
<tal:block tal:condition="request/field_errors | nothing"> <tal:block tal:condition="request/field_errors | nothing">
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
tal:content="python:here.Base_getFormViewDialogActionButtonTitle(form)">Submit</span> tal:content="python:here.Base_getFormViewDialogActionButtonTitle(form)">Submit</span>
</button> </button>
</form> </form>
</noscript></main> </template></main>
</body> </body>
</html> </html>
</tal:block> </tal:block>
......
...@@ -233,14 +233,18 @@ ...@@ -233,14 +233,18 @@
new_element_2; new_element_2;
// Move the content of the noscript tag // Move the content of the noscript tag
element = body_element.querySelector('main > noscript'); element = body_element.querySelector('main > template');
console.log(body_element);
console.log(element);
/*
new_element = document.createElement('div'); new_element = document.createElement('div');
new_element.innerHTML = element.textContent; new_element.innerHTML = element.textContent;
new_element_2 = document.createDocumentFragment(); new_element_2 = document.createDocumentFragment();
while (new_element.firstChild) { while (new_element.firstChild) {
new_element_2.appendChild(new_element.firstChild); new_element_2.appendChild(new_element.firstChild);
} }
element.parentNode.replaceChild(new_element_2, element); */
element.parentNode.replaceChild(element.content.cloneNode(true), element);
if (base_uri !== undefined) { if (base_uri !== undefined) {
// Rewrite relative url (copied from renderjs) // Rewrite relative url (copied from renderjs)
......
...@@ -104,7 +104,7 @@ ...@@ -104,7 +104,7 @@
<tal:block tal:content="structure python: web_section.WebSection_generateNavigationHTML(include_document=include_document)"></tal:block> <tal:block tal:content="structure python: web_section.WebSection_generateNavigationHTML(include_document=include_document)"></tal:block>
<p tal:content="request/portal_status_message | nothing" id="portal_status_message"/> <p tal:content="request/portal_status_message | nothing" id="portal_status_message"/>
<main><noscript><tal:block metal:define-slot="main"/></noscript></main> <main><template><tal:block metal:define-slot="main"/></template></main>
</body> </body>
</html> </html>
</tal:block> </tal:block>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment