worker-dom
worker-dom copied to clipboard
Bug: strings.getString() sometimes returns non-strings
I noticed this surprising type error when testing todomvc in amp-script. After tapping a checkbox, the worker sends the following mutation:
{
nodeName: "INPUT",
attribute: "checked",
value: true,
}
Then, the value
will be true
(actual) instead of "true"
(expected):
https://github.com/ampproject/worker-dom/blob/184e42560f8a40fcbe36d7d28ef5e9b9d1eb378b/src/main-thread/mutator.ts#L77-L84
Then, DOMPurify assumes attempts to call String.replace
on a boolean and an exception is thrown.