holtwick / zeed-dom

🌱 Lightweight offline DOM
MIT License
33 stars 5 forks source link

HTML entities are not being properly decoded #3

Closed dodas closed 2 years ago

dodas commented 2 years ago

Seems like encoded html entities are not handled properly. See this example: https://runkit.com/embed/9n1c04lodkqm Providing the following html:

<p>Let&#x27;s go</p>

I expect the following output when calling parseHTML(html).textContent:

Let's go

However, zeed-dom outputs the entities undecoded:

Let&#x27;s go

I can see there is a small list of encoded/decoded entites in encoding.ts, but all other entities are being ignored. Seems like there used to be a check to optionally load he if available. I understand this could cause issues, however the current behavior is not ideal either. Can this be improved in any way?

Thanks!

holtwick commented 2 years ago

Thanks for good description of the problem. I'll look into it, this is indeed a bug.

dodas commented 2 years ago

Thanks for a swift fix! Shouldn't he be now listed as zeed-dom's dependency in package.json?

holtwick commented 2 years ago

Absolutely, here it is https://github.com/holtwick/zeed-dom/blob/master/package.json#L44

dodas commented 2 years ago

Ah, overlook that. Great!