File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -147,16 +147,13 @@ export function open({hash} = {}) {
147147 switch ( item . type ) {
148148 case "html" :
149149 if ( root . children . length === 0 ) {
150- var template = document . createElement ( "template" ) ;
151- template . innerHTML = item . html ;
152- root . appendChild ( template . content . firstChild ) ;
153- }
154- if ( newPos >= root . children . length ) {
155- root . children [ root . children . length - 1 ] . insertAdjacentHTML ( "afterend" , item . html ) ;
156- newPos ++ ;
150+ root . insertAdjacentHTML ( "beforeend" , item . html ) ;
151+ } else if ( newPos < root . children . length ) {
152+ root . children [ newPos ] . insertAdjacentHTML ( "beforebegin" , item . html ) ;
157153 } else {
158- root . children [ newPos ++ ] . insertAdjacentHTML ( "beforebegin " , item . html ) ;
154+ root . lastElementChild . insertAdjacentHTML ( "afterend " , item . html ) ;
159155 }
156+ ++ newPos ;
160157 item . cellIds . forEach ( ( id ) => {
161158 const cell = cellsById . get ( id ) ;
162159 if ( cell ) define ( cell . cell ) ;
You can’t perform that action at this time.
0 commit comments