Clone node deeply not working properly

Asked

Viewed 31 times

0

I’m trying to duplicate the div meta from a Youtube video page. It’s the div below the video title div and like and dislike. I want you to have 2 equal ones, one on top of the other.

But when I use:

original = document.querySelectorAll('#meta');
clone = original[original.length-1].cloneNode(true);
clone.id = "meta1";
original[original.length-1].after(clone);

It duplicates the div, but the information within it (the children) does not appear.

EXAMPLE inserir a descrição da imagem aqui

  • "I’m trying to duplicate the div meta of a Youtube video page"... how so?

  • @Sam I just updated the question, hope it helps.

  • Is that a built-in video? How is that?

  • is a Youtube video page, for example: https://www.youtube.com/watch?v=nM__lPTWThU

  • Dude, doubling you should be. The problem is that it goes beyond simply adding the div below the other. You’ll have to change the css and the responsive commands that Youtube uses. I believe the issue is too wide...

  • It seems to me that the div is rendered at runtime. You can even clone, the data is all in the clone, but the data does not appear because it is rendered only when loading the page.

  • It’s weird because as far as I know, the deep clone clones everything. CSS, etc. I’ve already put the same ID instead of changing it. You can see the entire HTML of the cloned Ode just like that. I think what it can be is a complex JS acting there. You know some other way to do what I want?

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.