head-manager.d.ts 1.1 KB

123456789101112131415161718192021
  1. /// <reference types="react" />
  2. export declare const DOMAttributeNames: Record<string, string>;
  3. /**
  4. * When a `nonce` is present on an element, browsers such as Chrome and Firefox strip it out of the
  5. * actual HTML attributes for security reasons *when the element is added to the document*. Thus,
  6. * given two equivalent elements that have nonces, `Element,isEqualNode()` will return false if one
  7. * of those elements gets added to the document. Although the `element.nonce` property will be the
  8. * same for both elements, the one that was added to the document will return an empty string for
  9. * its nonce HTML attribute value.
  10. *
  11. * This custom `isEqualNode()` function therefore removes the nonce value from the `newTag` before
  12. * comparing it to `oldTag`, restoring it afterwards.
  13. *
  14. * For more information, see:
  15. * https://bugs.chromium.org/p/chromium/issues/detail?id=1211471#c12
  16. */
  17. export declare function isEqualNode(oldTag: Element, newTag: Element): boolean;
  18. export default function initHeadManager(): {
  19. mountedInstances: Set<unknown>;
  20. updateHead: (head: JSX.Element[]) => void;
  21. };