tinymins / vue-transfer-dom.js

A directive supported plugin for transfering DOM to another location in Vue.js components.
https://www.npmjs.com/package/vue-transfer-dom.js
1 stars 1 forks source link

Support for .clear modifier #5

Closed emahuni closed 5 years ago

emahuni commented 5 years ago

Your implementation of the replace modifier behaviour is ok, however, when I suggested this I was of the impression that it would clear the contents of the target then become its only child instead of destroying the target. I think we can call this new feature i just mentioned here clear so that it is different in a sense and leave replace doing what you just made it do. It could do it this way; in fact I had implemented virtually all of this functionality. Just having a few bugs here and there (in the remove function) so it could just do this:

let child;
while((child = parentNode.firstChild)) {
child.remove()
}

before it becomes the only child.

tinymins commented 5 years ago

Supported, please pull and check. 😸