Advertisement
gp27id

react-helmet+6.1.0.patch

Jan 14th, 2023
1,494
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.14 KB | Source Code | 0 0
  1. diff --git a/node_modules/react-helmet/es/Helmet.js b/node_modules/react-helmet/es/Helmet.js
  2. index 11d745a..9a1422d 100644
  3. --- a/node_modules/react-helmet/es/Helmet.js
  4. +++ b/node_modules/react-helmet/es/Helmet.js
  5. @@ -38,7 +38,8 @@ var TAG_PROPERTIES = {
  6.      PROPERTY: "property",
  7.      REL: "rel",
  8.      SRC: "src",
  9. -    TARGET: "target"
  10. +    TARGET: "target",
  11. +    ASYNC: "async"
  12.  };
  13.  
  14.  var REACT_TAG_MAP = {
  15. @@ -488,6 +489,14 @@ var updateTags = function updateTags(type, tags) {
  16.                          var value = typeof tag[attribute] === "undefined" ? "" : tag[attribute];
  17.                          newElement.setAttribute(attribute, value);
  18.                      }
  19. +
  20. +                    // The async attribute is ignored on dynamic scripts, the property must be set directly
  21. +                    if (
  22. +                        attribute === TAG_PROPERTIES.ASYNC &&
  23. +                        typeof tag.async === "boolean"
  24. +                    ) {
  25. +                        newElement.async = tag.async;
  26. +                    }
  27.                  }
  28.              }
  29.  
  30. diff --git a/node_modules/react-helmet/lib/Helmet.js b/node_modules/react-helmet/lib/Helmet.js
  31. index d7f564c..3953169 100644
  32. --- a/node_modules/react-helmet/lib/Helmet.js
  33. +++ b/node_modules/react-helmet/lib/Helmet.js
  34. @@ -44,7 +44,8 @@ var TAG_PROPERTIES = {
  35.      PROPERTY: "property",
  36.      REL: "rel",
  37.      SRC: "src",
  38. -    TARGET: "target"
  39. +    TARGET: "target",
  40. +    ASYNC: "async"
  41.  };
  42.  
  43.  var REACT_TAG_MAP = {
  44. @@ -494,6 +495,14 @@ var updateTags = function updateTags(type, tags) {
  45.                          var value = typeof tag[attribute] === "undefined" ? "" : tag[attribute];
  46.                          newElement.setAttribute(attribute, value);
  47.                      }
  48. +
  49. +                     // The async attribute is ignored on dynamic scripts, the property must be set directly
  50. +                    if (
  51. +                        attribute === TAG_PROPERTIES.ASYNC &&
  52. +                        typeof tag.async === "boolean"
  53. +                    ) {
  54. +                        newElement.async = tag.async;
  55. +                    }
  56.                  }
  57.              }
  58.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement