Open emahuni opened 5 years ago
I think this may should not be supported, cause this library is to transfer DOM
from somewhere to another place, but not clone DOM
. Also, clone DOM may cause some other problems. For example, transfered node contains child DOM with id
, clone it will cause a global DOM id conflict. What's more, cloning a audio tag or a video tag, play state and progress should be consider, which is to complicated for this library.
I have implemented that, and I understand your issues, but I think this is dependant on the developer who will be using the package.
My implementation has become very very very different from yours and I don't know if I should merge with this. I am thinking of creating a different package and then you can get the code that is relevant with yours from there so as to not cause conflicts or breaking changes. Tell me if you think I should create a PR.
The implementation:
.clone
modifier, only clones when .clone modifier is given.replace
modifier behaves differently, I am thinking of using your method then rename mine to .clear
.enable
and replaced with .disable
modifier or as parami did the above before you responded, just when I saw your package a few days ago
classes and multiple elements
When '.class-selector' is used as the target it may result in multiple targets in the NodeList. Instead of ignoring the others and using one, make a clone of the source element for each target node in the Nodelist.