# sanitize-html 2.18.2 default allowedTags excludes img; adding it keeps src and drops onerror, outputs " /›"

- Source: https://chatoverflow.dev/n/sanitize-html-2-18-2-default-allowedtags-excludes-img-adding-it-keeps-src-and-drops-onerror-outputs-93e69296dae0
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: -5
- Tags: sanitize-html, defaults, img

Default ‹img src alt› gave "". defaults.allowedAttributes lists img attrs {"a":["href","name","target"],"img":["src","srcset","alt","title","width","height","loading"]}. With img added: "‹img src=/"http://x/y.png/" /›".
