File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -313,10 +313,19 @@ function morphdomFactory(morphAttrs) {
313313 }
314314
315315 if ( typeof toNode === 'string' ) {
316- if ( fromNode . nodeName === '#document' || fromNode . nodeName === 'HTML' || fromNode . nodeName === 'BODY' ) {
316+ if ( fromNode . nodeName === '#document' || fromNode . nodeName === 'HTML' ) {
317317 var toNodeHtml = toNode ;
318318 toNode = doc . createElement ( 'html' ) ;
319319 toNode . innerHTML = toNodeHtml ;
320+ } else if ( fromNode . nodeName === 'BODY' ) {
321+ var toNodeBody = toNode ;
322+ toNode = doc . createElement ( 'html' ) ;
323+ toNode . innerHTML = toNodeBody ;
324+ // Extract the body element from the created HTML structure
325+ var bodyElement = toNode . querySelector ( 'body' ) ;
326+ if ( bodyElement ) {
327+ toNode = bodyElement ;
328+ }
320329 } else {
321330 toNode = toElement ( toNode ) ;
322331 }
Original file line number Diff line number Diff line change @@ -251,10 +251,19 @@ function morphdomFactory(morphAttrs) {
251251 }
252252
253253 if ( typeof toNode === 'string' ) {
254- if ( fromNode . nodeName === '#document' || fromNode . nodeName === 'HTML' || fromNode . nodeName === 'BODY' ) {
254+ if ( fromNode . nodeName === '#document' || fromNode . nodeName === 'HTML' ) {
255255 var toNodeHtml = toNode ;
256256 toNode = doc . createElement ( 'html' ) ;
257257 toNode . innerHTML = toNodeHtml ;
258+ } else if ( fromNode . nodeName === 'BODY' ) {
259+ var toNodeBody = toNode ;
260+ toNode = doc . createElement ( 'html' ) ;
261+ toNode . innerHTML = toNodeBody ;
262+ // Extract the body element from the created HTML structure
263+ var bodyElement = toNode . querySelector ( 'body' ) ;
264+ if ( bodyElement ) {
265+ toNode = bodyElement ;
266+ }
258267 } else {
259268 toNode = toElement ( toNode ) ;
260269 }
Original file line number Diff line number Diff line change 319319 }
320320
321321 if ( typeof toNode === 'string' ) {
322- if ( fromNode . nodeName === '#document' || fromNode . nodeName === 'HTML' || fromNode . nodeName === 'BODY' ) {
322+ if ( fromNode . nodeName === '#document' || fromNode . nodeName === 'HTML' ) {
323323 var toNodeHtml = toNode ;
324324 toNode = doc . createElement ( 'html' ) ;
325325 toNode . innerHTML = toNodeHtml ;
326+ } else if ( fromNode . nodeName === 'BODY' ) {
327+ var toNodeBody = toNode ;
328+ toNode = doc . createElement ( 'html' ) ;
329+ toNode . innerHTML = toNodeBody ;
330+ // Extract the body element from the created HTML structure
331+ var bodyElement = toNode . querySelector ( 'body' ) ;
332+ if ( bodyElement ) {
333+ toNode = bodyElement ;
334+ }
326335 } else {
327336 toNode = toElement ( toNode ) ;
328337 }
Original file line number Diff line number Diff line change @@ -315,10 +315,19 @@ function morphdomFactory(morphAttrs) {
315315 }
316316
317317 if ( typeof toNode === 'string' ) {
318- if ( fromNode . nodeName === '#document' || fromNode . nodeName === 'HTML' || fromNode . nodeName === 'BODY' ) {
318+ if ( fromNode . nodeName === '#document' || fromNode . nodeName === 'HTML' ) {
319319 var toNodeHtml = toNode ;
320320 toNode = doc . createElement ( 'html' ) ;
321321 toNode . innerHTML = toNodeHtml ;
322+ } else if ( fromNode . nodeName === 'BODY' ) {
323+ var toNodeBody = toNode ;
324+ toNode = doc . createElement ( 'html' ) ;
325+ toNode . innerHTML = toNodeBody ;
326+ // Extract the body element from the created HTML structure
327+ var bodyElement = toNode . querySelector ( 'body' ) ;
328+ if ( bodyElement ) {
329+ toNode = bodyElement ;
330+ }
322331 } else {
323332 toNode = toElement ( toNode ) ;
324333 }
You can’t perform that action at this time.
0 commit comments