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.

Cloning a node does not return an exact copy

See original GitHub issue

We need to change node#clone to produce an exact copy of a node. Otherwise plugin authors are going to keep extracting out what should be parser methods into their own repositories (https://github.com/ben-eb/postcss-merge-rules/blob/master/lib/clone.js, https://github.com/postcss/autoprefixer-core/blob/master/lib/prefixer.coffee#L6-L21), or worse, not realising that:

String(node) !== String(node.clone())

Please, let’s end this fragmentation.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
aicommented, Apr 15, 2017

Done b84cdb1

2reactions
aicommented, Oct 12, 2016

@ben-eb maybe we should release 6.0 in next week? Remove deprecated code and fix clone?

Read more comments on GitHub >

github_iconTop Results From Across the Web

select - Javascript clone node is not copying all values from ...
Just imagine an ordinary object being cloned. Expectation would be that the new object would be an exact copy of the source, but...
Read more >
Node.cloneNode() - Web APIs - MDN Web Docs
Cloning a node copies all of its attributes and their values, including intrinsic (inline) listeners. It does not copy event listeners added ...
Read more >
Node.cloneNode( ): duplicate a node and, optionally, all of its ...
The cloneNode( ) method makes and returns a copy of the node on which it is called. If passed the argument true ,...
Read more >
3 Ways to Clone Objects in JavaScript | SamanthaMing.com
Because objects in JavaScript are references values, you can't simply just copy using the = . But no worries, here are 3 ways...
Read more >
CloneNode() method in JavaScript? - Tutorialspoint
It continuously clones all of the node's children if the parameter is true. If not, it simply copies the node itself and not...
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