//! The script the sanitizer injects into the document it produces. //! //! `sanitize_html` neutralises: an `a` loses its `href` (kept as `data-href`) //! and an `img` loses its `src` (kept as `data-original-src`, `src` becomes a //! dead `data:,` placeholder). Neutered alone, the placeholders promise an //! interaction they cannot keep — this is the other half of that promise: the //! document's own scripts are removed, and this one is put in their place. /// The script: one delegated click listener. A placeholder link opens a /// confirm dialog and only then navigates; a placeholder image does the same /// before its original `src` is restored. Nothing is fetched before the user /// has said yes, so `specs/ui.md` "no HTTP traffic to remote hosts" holds for /// an unconfirmed document. It only ever reaches URLs that are already in the /// sanitized markup. const SCRIPT: &str = r#" "#; /// Place `SCRIPT` where the document's own scripts used to be: before /// ``, else before `` (a fragment), else at the end. The /// rewriter runs before this, so the sanitizer's own `