export function hasInvalidAttributes()

in src/js/contentUtils.js [461:485]


export function hasInvalidAttributes(htmlElement) {
  if (
    typeof htmlElement.attributes === 'object' &&
    Object.keys(htmlElement.attributes).length >= 1
  ) {
    Array.from(htmlElement.attributes).forEach(elementAttribute => {
      // check first for violating attributes
      if (DOM_EVENTS.indexOf(elementAttribute.localName) >= 0) {
        chrome.runtime.sendMessage({
          type: MESSAGE_TYPE.DEBUG,
          log:
            'violating attribute ' +
            elementAttribute.localName +
            ' from element ' +
            htmlElement.outerHTML,
        });
        currentState = ICON_STATE.INVALID_SOFT;
        chrome.runtime.sendMessage({
          type: MESSAGE_TYPE.UPDATE_ICON,
          icon: ICON_STATE.INVALID_SOFT,
        });
      }
    });
  }
}