Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-yuka05 authored Oct 4, 2022
1 parent 3d64490 commit fdbdeb5
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions dist/wade.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,27 @@
this.getAttributeNames().forEach(prop => {
props += ` ${prop}="${this.getAttribute(prop)}"`;
});

let component = `
<iframe
src="${path}"
${props}
style="border: none; display: none;"
onload="
let component = this.contentDocument.body.innerHTML;
if(component.match(/\^\\\#\\\! stylesComponent/g)){
let cont = document.createAttribute('contents');
cont.value = this.innerHTML;
this.setAttributeNode(cont);
};
if(component.match(/\{\{([^}]+)\}\}/g)){
component.match(/\{\{([^}]+)\}\}/g).forEach(el => {
let match = el.slice(2, -2);
component = component.replace(el, this.getAttribute(match.trim()));
});
}
};
this.contentDocument.body.innerHTML = component;
this.contentDocument.querySelectorAll('script').forEach((el)=>{
Expand All @@ -100,6 +107,7 @@
this.before((this.contentDocument.body||this.contentDocument).children[0]);
this.remove();
">
${this.innerHTML}
</iframe>
`;

Expand Down

0 comments on commit fdbdeb5

Please sign in to comment.