function isEqualNode(oldTag, newTag) {
  if (oldTag instanceof HTMLElement && newTag instanceof HTMLElement) {
    const nonce = newTag.getAttribute(`nonce`)
    // Only strip the nonce if `oldTag` has had it stripped. An element's nonce attribute will not
    // be stripped if there is no content security policy response header that includes a nonce.
    if (nonce && !oldTag.getAttribute(`nonce`)) {
      const cloneTag = newTag.cloneNode(true)
      cloneTag.setAttribute(`nonce`, ``)
      cloneTag.nonce = nonce
      return nonce === oldTag.nonce && oldTag.isEqualNode(cloneTag)
    }
  }

  return oldTag.isEqualNode(newTag)
}
When a `nonce` is present on an element, browsers such as Chrome and Firefox strip it out of the
actual HTML attributes for security reasons *when the element is added to the document*. Thus,
given two equivalent elements that have nonces, `Element,isEqualNode()` will return false if one
of those elements gets added to the document. Although the `element.nonce` property will be the
same for both elements, the one that was added to the document will return an empty string for
its nonce HTML attribute value.

This custom `isEqualNode()` function therefore removes the nonce value from the `newTag` before
comparing it to `oldTag`, restoring it afterwards.

For more information, see:
https://bugs.chromium.org/p/chromium/issues/detail?id=1211471#c12