aokiken/vue-remove-whitespace

Cant bind event after removing whitespace

Closed this issue · 7 comments

Hey friend,

This lib is very nice, but i found something could be a problem when worked with the event, maybe it can't replace elements with InnerHTML directly.

Hi @Xing-He

Currently only "inserted" is used

export var removeWhitespace = {
inserted(el) {
el.innerHTML = el.innerHTML.replace(/\s*<("[^"]*"|'[^']*'|[^'">])*>\s*/g, match => match.trim())
},
}

Should "update" also be support?

ref https://vuejs.org/v2/guide/custom-directive.html#Hook-Functions

If you remove white-space on 'update' hook, it will call hook after every updated.
How about this vue-tight?

I remembered that I try with on 'update' hook 😂
I try fix it, Thx:)

Hi, @Xing-He

This lib is very nice, but i found something could be a problem when worked with the event, maybe it can't replace elements with InnerHTML directly.

Can I confirm this?

For example, codesandbox, codepen

Thanks, I was able to confirm.