•
diff --git a/ascii_elements/mouse_container.html b/ascii_elements/mouse_container.html
index 0441742..98eca13 100644
--- a/ascii_elements/mouse_container.html
+++ b/ascii_elements/mouse_container.html
@@ -7,6 +7,7 @@
.mouse_container {
position: relative;
margin-left: 0px;
+ display: contents;
/*
border: 1px solid red;
margin-right: auto;
diff --git a/scripts/load_html.js b/scripts/load_html.js
index d3b04c6..046bf71 100644
--- a/scripts/load_html.js
+++ b/scripts/load_html.js
@@ -9,12 +9,36 @@ customElements.define(
super();
let path = this.dataset.path;
- let templateContent = document.createDocumentFragment();
let load_content = (content_to_load) => {
let template = document.createElement('template');
template.innerHTML = content_to_load;
- templateContent = template.content;
+ let templateContent = template.content;
+ //this.appendChild(templateContent.cloneNode(true));
+ this.replaceWith(templateContent.cloneNode(true));
+ }
+
+ fetch(path)
+ .then(response => response.text())
+ .then(load_content)
+ .catch(error => console.log('Error:', error));
+ }
+ },
+);
+
+customElements.define(
+ "load-html-shadow",
+ class extends HTMLElement {
+ constructor() {
+
+ super();
+
+ let path = this.dataset.path;
+
+ let load_content = (content_to_load) => {
+ let template = document.createElement('template');
+ template.innerHTML = content_to_load;
+ let templateContent = template.content;
const shadowRoot = this.attachShadow({ mode: "open" });
shadowRoot.appendChild(templateContent.cloneNode(true));
}
diff --git a/scripts/old_load_html.js b/scripts/old_load_html.js
index 97f0f2b..13fb9c8 100644
--- a/scripts/old_load_html.js
+++ b/scripts/old_load_html.js
@@ -10,35 +10,14 @@ function deserialize_html(html) {
}
function fill_content(new_content, old_content, target_name) {
- // new_content :
- //
- // - //- // target_name : - // banner if (!old_content) return; let elements_with_class = find_elements_by_class(new_content, "content_html"); - // elements_with_class : - // - //
- //- //
-//-//
-//-//
- //let new_content = deserialize_html(content_to_load); - // new_content : - // - // let target_name = element_to_replace.dataset.path_target; - // target_name : - // banner transfert_class(element_to_replace, new_content); - // element_to_replace : - //
- //- //
template 4 !
- - - - -titre 0
-paragraph 0
-test default 3 . 2
-07
-hello from the other side
-the end
-