google / budoux

https://google.github.io/budoux/
Apache License 2.0
1.44k stars 32 forks source link

BudouX replaces single quotes in html attributes with double quotes and can break the rendering #660

Closed trandles-google closed 3 months ago

trandles-google commented 3 months ago

single quotes in data attributes get converted into double quotes and that breaks when there is a double quote in the data attribute.

<div data-number-list='["1","2","3"]'> becomes <div data-number-list="["1","2","3"]">

Example: https://codepen.io/trandlesg/pen/dyBvpEw

tushuhei commented 3 months ago

It seems your demo is not applying BudouX to the source HTML code. Also, please note that the attribute value is actually coded as data-number-list="[&quot;1&quot;,&quot;2&quot;,&quot;3&quot;]" even if it renders as data-number-list="["1","2","3"]" in the dev console, so the attribute value should be processed as intended as a (JSON-encoded) list of strings i.e. ["1,", "2", "3"].

I'm closing this issue, but please feel free to reopen it if you encounter any cases where HTML attribute values are corrupted because of BudouX application.