question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Currently using jsdom for testing which could be part of the issue, but the following diff detaches the document element and fails.

morphdom(document.documentElement, `
    <!DOCTYPE html>
    <html>
        <head>
            <title>Test</title>
        </head>
        <body>content</body>
    </html>
`);

Am I doing something wrong? Even tried removing the doctype.


Edit:

Also tried doing this directly in Chrome Version 51.0.2680.0 canary (64-bit) and received the following error.

VM414:479 Uncaught DOMException: Failed to execute 'replaceChild' on 'Node': Nodes of type '#text' may not be inserted inside nodes of type '#document'

From: https://github.com/patrick-steele-idem/morphdom/blob/master/lib/index.js#L478


Edit2:

Looks like the issue stems from https://github.com/patrick-steele-idem/morphdom/blob/master/lib/index.js#L38 and https://github.com/patrick-steele-idem/morphdom/blob/master/lib/index.js#L41 in my case, but it looks like #toElement just doesn’t support anything outside of body.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
AutoSpongecommented, Jul 2, 2016

Please keep in mind that morphing HEAD tags client-side will probably not work for most use cases. For instance, og meta tags will not get morphed in time and Facebook will only see the sever-rendered ones.

Additionally, morphed script and link tags will likely become async and no longer block so you’d likely get flash of unstyled content or have scripts loading out of order.

0reactions
DylanPierceycommented, Oct 21, 2016

@AutoSponge - That PR could be reverted. The issue was it appeared to be working but ended up actually just discarding the entire page in most cases. I just ended up rolling my own solution anyways.

Thanks both of you for getting back to me on this issue though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Morphs - StimulusReflex
Page morphs are the default behavior of StimulusReflex and they are what will occur if you don't call morph in your Reflex. All...
Read more >
Creating a full-page morph transition - GSAP - GreenSock
I am first interested in morph effects of page transitions . ... Create a morph SVG animation that covers the whole screen.
Read more >
Simple Morphing Search - Codrops
The idea is to have a search input in the upper right corner of the page and once the input is clicked, the...
Read more >
Morph transition: Tips and tricks - Microsoft Support
Learn how to use the Morph transition in PowerPoint to easily create animations and movements ... It shows a list of all the...
Read more >
Using Morph to Highlight Parts of an Image in PowerPoint
Do you want to use a full screen image or even a large image on your PowerPoint slide and now you want to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found