tbranyen/diffhtml

First interpolation of multiple in an attribute value is replaced with __DIFFHTML__

apaleslimghost opened this issue · 3 comments

e.g.:

const foo = 'foo', bar = 'bar';
console.log(html`<span class="${foo}" />`);
//⇒ {nodeName: 'span', ..., attributes: [{name: 'class', value: 'foo'}]}
console.log(html`<span class="${foo} ${bar}" />`);
//⇒ {nodeName: 'span', ..., attributes: [{name: 'class', value: '__DIFFHTML__ bar'}]}

Woah that's certainly not good, I'll have a patch out shortly. Thanks for filing!

Hey @quarterto can you give this build a try: #110?

I realized the isProp regular expression wasn't running on the entire output, so only the first item would get "detected" as a prop. I've since fixed this with a smarter regex and running on the entire output instead of just the string preceding the interpolation.

Basically before it was testing: instead of<span class="foo