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
but got my styles removed as there seems to be a small bug in the validateStyles function (see comments in below code)
functionvalidateStyles(output,styles){Object.keys(styles).forEach(prop=>{// prop is the index, not the CSS style propertyconstvalue=styles[prop];// value is the CSS style propertyif(value&&typeofvalue==='string'){constnormalizedProp=prop.replace(/([A-Z])/g,'-$1').toLowerCase();if(allowed_properties.includes(normalizedProp)&&(allow_css_functions||!/\w+\(/.test(value))){output.push(`${normalizedProp}:${value};`);}}});}
I tried to implement this example:
https://github.com/cure53/DOMPurify/blob/main/demos/hooks-sanitize-css-demo.html
but got my styles removed as there seems to be a small bug in the validateStyles function (see comments in below code)
Below function gave me the correct result:
The text was updated successfully, but these errors were encountered: