]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12368 Fix documentation in IE11
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Thu, 15 Aug 2019 09:33:47 +0000 (11:33 +0200)
committerSonarTech <sonartech@sonarsource.com>
Thu, 17 Oct 2019 13:24:49 +0000 (15:24 +0200)
server/sonar-docs/gatsby-config.js
server/sonar-docs/package.json
server/sonar-docs/src/components/PluginMetaData.tsx
server/sonar-docs/yarn.lock

index 33d891cdb5c8cb658b35544f4eb2690e78ec44d9..17b858049ac705ab9d7916528c404fcf895896c4 100644 (file)
@@ -28,6 +28,12 @@ module.exports = {
     `gatsby-plugin-typescript`,
     `gatsby-plugin-layout`,
     'gatsby-plugin-react-helmet',
+    {
+      resolve: `gatsby-plugin-polyfill-io`,
+      options: {
+        features: [`Promise`, `fetch`, `Object.assign`, `Symbol`, `Array.from`]
+      }
+    },
     {
       resolve: `sonarsource-source-filesystem`,
       options: { name: 'src', path: `${__dirname}/src/` }
index 9b36e9600b89499520f0033f551e61669869a018..84dddb169867b2ef19878cb9334eca292907e8ba 100644 (file)
@@ -8,6 +8,7 @@
     "classnames": "2.2.6",
     "gatsby": "2.2.8",
     "gatsby-plugin-layout": "1.0.13",
+    "gatsby-plugin-polyfill-io": "1.1.0",
     "gatsby-plugin-react-helmet": "3.0.10",
     "gatsby-plugin-typescript": "2.0.11",
     "gatsby-plugin-typography": "2.2.10",
index 80fd723441311dfc3a40090b18c6eae2057d32e3..d0260bc286158943f8de21701f86e65103f184ec 100644 (file)
@@ -82,9 +82,22 @@ export default class PluginMetaData extends React.Component<Props, State> {
     const pageContainer = document.querySelector('.page-container');
 
     if (pageContainer) {
-      const iterator = document.createNodeIterator(pageContainer, NodeFilter.SHOW_COMMENT, {
-        acceptNode: (_: Node) => NodeFilter.FILTER_ACCEPT
-      });
+      // The following uses an older syntax for createNodeIterator() in order
+      // to support IE11
+      // - IE doesn't support the new { acceptNode: (node: Node) => number }
+      //   format for the 3rd parameter, and instead expects to get it passed
+      //   the function directly. Modern browsers support both paradigms as a
+      //   fallback, so we fallback to the old one.
+      // - IE11 requires the 4th argument.
+      // @ts-ignore: tsc requires an additional comment at the function call.
+      const iterator = document.createNodeIterator(
+        pageContainer,
+        NodeFilter.SHOW_COMMENT,
+        // @ts-ignore: IE11 doesn't support the { acceptNode: () => number } format.
+        (_: Node) => NodeFilter.FILTER_ACCEPT,
+        // @ts-ignore: IE11 requires the 4th argument.
+        false
+      );
 
       let node;
       const wrappers: Dict<HTMLDivElement> = {};
index 3719f7e3de6ca94948567b74ae4548fcb0c78170..7862252cb087b5f3c645abd620e3f6b9eb018058 100644 (file)
@@ -4826,6 +4826,13 @@ gatsby-plugin-page-creator@^2.0.11:
     parse-filepath "^1.0.1"
     slash "^1.0.0"
 
+gatsby-plugin-polyfill-io@^1.1.0:
+  version "1.1.0"
+  resolved "https://repox.jfrog.io/repox/api/npm/npm/gatsby-plugin-polyfill-io/-/gatsby-plugin-polyfill-io-1.1.0.tgz#61424c773ae123680e50b9a6692a4b939a1e6e13"
+  integrity sha1-YUJMdzrhI2gOULmmaSpLk5oebhM=
+  dependencies:
+    babel-runtime "^6.26.0"
+
 gatsby-plugin-react-helmet@3.0.10:
   version "3.0.10"
   resolved "https://registry.yarnpkg.com/gatsby-plugin-react-helmet/-/gatsby-plugin-react-helmet-3.0.10.tgz#08a4f3f7d6ffd020d78817679535fb6548602302"