You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For people who would like to add svg support, you need to add it in lower case, as well as path, to the white list.
A better solution is to change makeSanitizedCopy to get an upper case version of the tag name, and in that case we can use SVG and PATH:
functionmakeSanitizedCopy(node){letnewNode,nodeTagName=(node.tagName||"").toUpperCase();if(node.nodeType==Node.TEXT_NODE){newNode=node.cloneNode(true);}elseif(node.nodeType==Node.ELEMENT_NODE&&(tagWhitelist_[nodeTagName]||contentTagWhiteList_[nodeTagName])){//remove useless empty spans (lots of those when pasting from MS Outlook)if((nodeTagName=="SPAN"||nodeTagName=="B"||nodeTagName=="I"||nodeTagName=="U")&&node.innerHTML.trim()==""){returndocument.createDocumentFragment();}if(contentTagWhiteList_[nodeTagName])newNode=iframedoc.createElement('DIV');//convert to DIVelsenewNode=iframedoc.createElement(nodeTagName);for(leti=0;i<node.attributes.length;i++){letattr=node.attributes[i];if(attributeWhitelist_[attr.name]){if(attr.name=="style"){for(lets=0;s<node.style.length;s++){letstyleName=node.style[s];if(cssWhitelist_[styleName])newNode.style.setProperty(styleName,node.style.getPropertyValue(styleName));}}else{if(uriAttributes_[attr.name]){//if this is a "uri" attribute, that can have "javascript:" or somethingif(attr.value.indexOf(":")>-1&&!startsWithAny(attr.value,schemaWhiteList_))continue;}newNode.setAttribute(attr.name,attr.value);}}}for(leti=0;i<node.childNodes.length;i++){letsubCopy=makeSanitizedCopy(node.childNodes[i]);newNode.appendChild(subCopy,false);}}else{newNode=document.createDocumentFragment();}returnnewNode;}
Don't forget to also add the attributes (like xmlns, viewbox, d, fill, …)
The text was updated successfully, but these errors were encountered:
For people who would like to add
svg
support, you need to add it in lower case, as well aspath
, to the white list.A better solution is to change
makeSanitizedCopy
to get an upper case version of the tag name, and in that case we can useSVG
andPATH
:Don't forget to also add the attributes (like
xmlns
,viewbox
,d
,fill
, …)The text was updated successfully, but these errors were encountered: