src/js/htmlSanitizer.js
function leaveOnlyWhitelistAttribute($html) {
  $html.find('*').each((index, node) => {
    const attrs = node.attributes;
    const blacklist = util.toArray(attrs).filter(attr => {
      const isHTMLAttr = attr.name.match(HTML_ATTR_LIST_RX);
      const isSVGAttr = attr.name.match(SVG_ATTR_LIST_RX);

      return !isHTMLAttr && !isSVGAttr;
    });

    util.forEachArray(blacklist, attr => {
      // Edge svg attribute name returns uppercase bug. error guard.
      // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5579311/
      if (attrs.getNamedItem(attr.name)) {
        attrs.removeNamedItem(attr.name);
      }
    });
  });
}
function leaveOnlyWhitelistAttribute($html) {
  $html.find('*').each((index, node) => {
    const attrs = node.attributes;
    const blacklist = util.toArray(attrs).filter(attr => {
      const isHTMLAttr = attr.name.match(HTML_ATTR_LIST_RX);
      const isSVGAttr = attr.name.match(SVG_ATTR_LIST_RX);

      return !isHTMLAttr && !isSVGAttr;
    });

    util.forEachArray(blacklist, attr => {
      // Edge svg attribute name returns uppercase bug. error guard.
      // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5579311/
      if (attrs.getNamedItem(attr.name)) {
        attrs.removeNamedItem(attr.name);
      }
    });
  });
}
function leaveOnlyWhitelistAttribute ( $html ) { $html . find ( '*' ) . each ( ( index , node ) => { const attrs = node . attributes ; const blacklist = util . toArray ( attrs ) . filter ( attr => { const isHTMLAttr = attr . name . match ( HTML_ATTR_LIST_RX ) ; const isSVGAttr = attr . name . match ( SVG_ATTR_LIST_RX ) ; return ! isHTMLAttr && ! isSVGAttr ; } ) ; util . forEachArray ( blacklist , attr => { // Edge svg attribute name returns uppercase bug. error guard. // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/5579311/ if ( attrs . getNamedItem ( attr . name ) ) { attrs . removeNamedItem ( attr . name ) ; } } ) ; } ) ; }
Leave only white list attributes
@private
@param {jQuery} $html jQuery instance
Leave only white list attributes