Skip to content

Commit

Permalink
FIX: innerHTML was broken for elements that was not in the body tree
Browse files Browse the repository at this point in the history
  • Loading branch information
Javiani committed Sep 22, 2024
1 parent efb528f commit 052c343
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dist/jails.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jails.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "jails-js",
"version": "5.8.1",
"version": "5.8.2",
"description": "Jails - Elegant and Minimalistic Javascript Application Library",
"module": "./dist/jails.js",
"main": "./dist/jails.js",
Expand Down
7 changes: 3 additions & 4 deletions src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,11 @@ export default function Component( elm, { module, dependencies, templates, compo
innerHTML( target, html_ ) {

const element = html_? target : elm
const parser = new DOMParser()
const virtual = parser.parseFromString(element.outerHTML, 'text/html')
const clone = element.cloneNode()
const html = html_? html_ : target
clone.innerHTML = html

virtual.body.firstElementChild.innerHTML = html as string
rAF( _ => Idiomorph.morph(element, virtual.body.innerHTML, IdiomorphOptions) )
rAF( _ => Idiomorph.morph(element, clone, IdiomorphOptions) )
}
}

Expand Down

0 comments on commit 052c343

Please sign in to comment.