1"use strict";(globalThis.webpackChunksvgo_dev=globalThis.webpackChunksvgo_dev||[]).push([[2663],{506:(e,t,s)=>{s.d(t,{R:()=>i,x:()=>c});var n=s(2888);const r={},o=n.createContext(r);function i(e){const t=n.useContext(o);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),n.createElement(o.Provider,{value:t},e.children)}},4512:(e,t,s)=>{s.r(t),s.d(t,{assets:()=>l,contentTitle:()=>c,default:()=>p,frontMatter:()=>i,metadata:()=>n,toc:()=>d});const n=JSON.parse('{"id":"plugins/removeScripts","title":"removeScripts","description":"Removes all scripts from the document.","source":"@site/svgo/docs/04-plugins/removeScripts.mdx","sourceDirName":"04-plugins","slug":"/plugins/removeScripts","permalink":"/docs/plugins/removeScripts","draft":false,"unlisted":false,"editUrl":"https://github.com/svg/svgo/tree/main/docs/04-plugins/removeScripts.mdx","tags":[],"version":"current","frontMatter":{"title":"removeScripts","svgo":{"pluginId":"removeScripts"}},"sidebar":"docsSidebar","previous":{"title":"removeRasterImages","permalink":"/docs/plugins/removeRasterImages"},"next":{"title":"removeStyleElement","permalink":"/docs/plugins/removeStyleElement"}}');var r=s(1684),o=s(506);const i={title:"removeScripts",svgo:{pluginId:"removeScripts"}},c=void 0,l={},d=[];function a(e){const t={a:"a",admonition:"admonition",code:"code",li:"li",p:"p",strong:"strong",ul:"ul",...(0,o.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.p,{children:"Removes all scripts from the document."}),"\n",(0,r.jsxs)(t.p,{children:["SVGs can be interactive through JavaScript. However, unless the SVG is coming from a trusted source, it's strongly advised to strip off JavaScript to avoid ",(0,r.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Glossary/Cross-site_scripting",children:(0,r.jsx)("abbr",{title:"Cross-Site Scripting",children:"XSS"})})," attacks."]}),"\n",(0,r.jsx)(t.admonition,{type:"caution",children:(0,r.jsxs)(t.p,{children:["This ",(0,r.jsx)(t.strong,{children:"will"})," break interactive SVGs that rely on JavaScript."]})}),"\n",(0,r.jsx)(t.p,{children:"This plugin performs the following operations:"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:["Removes ",(0,r.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/SVG/Element/script",children:(0,r.jsx)(t.code,{children:"<script>"})})," elements."]}),"\n",(0,r.jsxs)(t.li,{children:["Removes ",(0,r.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/Events",children:"SVG event attributes"}),", such as ",(0,r.jsx)(t.code,{children:"onload"}),", ",(0,r.jsx)(t.code,{children:"onclick"}),", and ",(0,r.jsx)(t.code,{children:"oninput"}),", preserving the element itself."]}),"\n",(0,r.jsxs)(t.li,{children:["Collapses ",(0,r.jsx)(t.a,{href:"https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a",children:(0,r.jsx)(t.code,{children:"<a>"})})," elements, moving children up to the parent element."]}),"\n"]}),"\n",(0,r.jsx)(t.admonition,{type:"info",children:(0,r.jsxs)(t.p,{children:["Between v3 and v4, the plugin was renamed from ",(0,r.jsx)(t.code,{children:"removeScriptElement"})," to ",(0,r.jsx)(t.code,{children:"removeScripts"})," to reflect that it does more than just remove the ",(0,r.jsx)(t.code,{children:"<script>"})," tag."]})})]})}function p(e={}){const{wrapper:t}={...(0,o.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(a,{...e})}):a(e)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.