<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic In an HTML dashboard, why is a simple JS file parsed into HTML? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/In-an-HTML-dashboard-why-is-a-simple-JS-file-parsed-into-HTML/m-p/547137#M37620</link>
    <description>&lt;P&gt;&lt;FONT size="4"&gt;In the context of an HTML Dashboard, why would a simple JS file get parsed into HTML within .../static/app/myapp/?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;For &lt;FONT face="lucida sans unicode,lucida sans"&gt;&lt;FONT face="helvetica"&gt;example&lt;/FONT&gt;,&lt;/FONT&gt; line 20 of &lt;FONT face="courier new,courier"&gt;myClass.js&lt;/FONT&gt; reads:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;size(width,height) {&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which, inside of&amp;nbsp;&lt;FONT face="courier new,courier"&gt;my.splunk.domain/en-US/static/@12B...85/app/myapp/myClass.js&amp;nbsp;&lt;FONT face="helvetica"&gt;becomes&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;tr&amp;gt;
  &amp;lt;td id="L20" class="blob-num js-line-number" data-line-number="20"&amp;gt;&amp;lt;/td&amp;gt;
  &amp;lt;td id="LC20" class="blob-code blob-code-inner js-file-line"&amp;gt;
   &amp;lt;span class=pl-en&amp;gt;size&amp;lt;/span&amp;gt;
   &amp;lt;span class=pl-kos&amp;gt;(&amp;lt;/span&amp;gt;
   &amp;lt;span class=pl-s1&amp;gt;width&amp;lt;/span&amp;gt;
   &amp;lt;span class=pl-kos&amp;gt;,&amp;lt;/span&amp;gt;
   &amp;lt;span class=pl-s1&amp;gt;height&amp;lt;/span&amp;gt;
   &amp;lt;span class=pl-kos&amp;gt;)&amp;lt;/span&amp;gt;
   &amp;lt;span class=pl-kos&amp;gt;{&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and so on for the entire file. Please note that &lt;FONT face="courier new,courier"&gt;myClass.js&lt;/FONT&gt; has the simple form&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// this is the entire file
class myClass {
 // vanilla js stuff...
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;Here's the relevant context:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I have an HTML dashboard, properly converted from a simple XML via the UI.&lt;/LI&gt;&lt;LI&gt;This dashboard uses two JS files: &lt;FONT face="courier new,courier"&gt;d3.js&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;myClass.js&lt;/FONT&gt;.&lt;UL&gt;&lt;LI&gt;The first file, d3, works just fine; the second is included identically:&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;require.config({
    baseUrl: "{{SPLUNKWEB_URL_PREFIX}}/static/js",
    waitSeconds: 0, // Disable require.js load timeout
    paths: {
        'd3': '{{SPLUNKWEB_URL_PREFIX}}/static/app/myapp/d3v5',
        'myClass': '{{SPLUNKWEB_URL_PREFIX}}/static/app/myapp/myClass'
    }
});​&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;require([
    "splunkjs/mvc",
    // ...
    "myClass",
    "d3"
    // Add comma-separated libraries and modules manually here, for example:
    // ..."splunkjs/mvc/simplexml/urltokenmodel"
    ],
    function(
        mvc,
        // ...
        myClass,
        d3
        // Add comma-separated parameter names here, for example:
        // ...UrlTokenModel
        ) {
      // Everything else...
    }​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT face="helvetica"&gt;Both scripts are properly located in &lt;FONT face="courier new,courier"&gt;/splunk/etc/apps/myapp/appserver/static&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="courier new,courier"&gt;myClass.js&lt;/FONT&gt; does depend on &lt;FONT face="courier new,courier"&gt;d3.js&lt;/FONT&gt;.&lt;/LI&gt;&lt;LI&gt;The browser console logs two errors:&lt;UL&gt;&lt;LI&gt;&lt;FONT face="courier new,courier" color="#FF0000"&gt;&lt;FONT face="courier new,courier" color="#FF0000"&gt;Uncaught SyntaxError: Unexpected token '&amp;lt;'&amp;nbsp;&lt;FONT face="helvetica" color="#000000"&gt;in &lt;FONT face="courier new,courier"&gt;myClass.js&lt;/FONT&gt;:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Translations for en_US
i18n_register({"plural": function(n) { return n == 1 ? 0 : 1; }, "catalog": {}});

&amp;lt;!DOCTYPE html&amp;gt; // ERROR THROWN HERE
// ...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;bubbling to&amp;nbsp;&lt;FONT color="#FF0000"&gt;Uncaught TypeError: Cannot read property 'myProperty' of undefined&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Again, &lt;FONT face="courier new,courier"&gt;d3.js&lt;/FONT&gt; is also included in the same way and works fine; the script includes a similar preamble but is otherwise unchanged.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Any ideas and/or solutions would be very much appreciated.&amp;nbsp;&lt;/STRONG&gt;Also, apologies for the formatting; extra spaces are being inserted.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Apr 2021 01:05:38 GMT</pubDate>
    <dc:creator>curtismcginity</dc:creator>
    <dc:date>2021-04-08T01:05:38Z</dc:date>
    <item>
      <title>In an HTML dashboard, why is a simple JS file parsed into HTML?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/In-an-HTML-dashboard-why-is-a-simple-JS-file-parsed-into-HTML/m-p/547137#M37620</link>
      <description>&lt;P&gt;&lt;FONT size="4"&gt;In the context of an HTML Dashboard, why would a simple JS file get parsed into HTML within .../static/app/myapp/?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;For &lt;FONT face="lucida sans unicode,lucida sans"&gt;&lt;FONT face="helvetica"&gt;example&lt;/FONT&gt;,&lt;/FONT&gt; line 20 of &lt;FONT face="courier new,courier"&gt;myClass.js&lt;/FONT&gt; reads:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;size(width,height) {&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;which, inside of&amp;nbsp;&lt;FONT face="courier new,courier"&gt;my.splunk.domain/en-US/static/@12B...85/app/myapp/myClass.js&amp;nbsp;&lt;FONT face="helvetica"&gt;becomes&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;tr&amp;gt;
  &amp;lt;td id="L20" class="blob-num js-line-number" data-line-number="20"&amp;gt;&amp;lt;/td&amp;gt;
  &amp;lt;td id="LC20" class="blob-code blob-code-inner js-file-line"&amp;gt;
   &amp;lt;span class=pl-en&amp;gt;size&amp;lt;/span&amp;gt;
   &amp;lt;span class=pl-kos&amp;gt;(&amp;lt;/span&amp;gt;
   &amp;lt;span class=pl-s1&amp;gt;width&amp;lt;/span&amp;gt;
   &amp;lt;span class=pl-kos&amp;gt;,&amp;lt;/span&amp;gt;
   &amp;lt;span class=pl-s1&amp;gt;height&amp;lt;/span&amp;gt;
   &amp;lt;span class=pl-kos&amp;gt;)&amp;lt;/span&amp;gt;
   &amp;lt;span class=pl-kos&amp;gt;{&amp;lt;/span&amp;gt;&amp;lt;/td&amp;gt;
&amp;lt;/tr&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and so on for the entire file. Please note that &lt;FONT face="courier new,courier"&gt;myClass.js&lt;/FONT&gt; has the simple form&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// this is the entire file
class myClass {
 // vanilla js stuff...
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="5"&gt;Here's the relevant context:&lt;/FONT&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I have an HTML dashboard, properly converted from a simple XML via the UI.&lt;/LI&gt;&lt;LI&gt;This dashboard uses two JS files: &lt;FONT face="courier new,courier"&gt;d3.js&lt;/FONT&gt; and &lt;FONT face="courier new,courier"&gt;myClass.js&lt;/FONT&gt;.&lt;UL&gt;&lt;LI&gt;The first file, d3, works just fine; the second is included identically:&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;require.config({
    baseUrl: "{{SPLUNKWEB_URL_PREFIX}}/static/js",
    waitSeconds: 0, // Disable require.js load timeout
    paths: {
        'd3': '{{SPLUNKWEB_URL_PREFIX}}/static/app/myapp/d3v5',
        'myClass': '{{SPLUNKWEB_URL_PREFIX}}/static/app/myapp/myClass'
    }
});​&lt;/LI-CODE&gt;&lt;LI-CODE lang="javascript"&gt;require([
    "splunkjs/mvc",
    // ...
    "myClass",
    "d3"
    // Add comma-separated libraries and modules manually here, for example:
    // ..."splunkjs/mvc/simplexml/urltokenmodel"
    ],
    function(
        mvc,
        // ...
        myClass,
        d3
        // Add comma-separated parameter names here, for example:
        // ...UrlTokenModel
        ) {
      // Everything else...
    }​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;FONT face="helvetica"&gt;Both scripts are properly located in &lt;FONT face="courier new,courier"&gt;/splunk/etc/apps/myapp/appserver/static&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT face="courier new,courier"&gt;myClass.js&lt;/FONT&gt; does depend on &lt;FONT face="courier new,courier"&gt;d3.js&lt;/FONT&gt;.&lt;/LI&gt;&lt;LI&gt;The browser console logs two errors:&lt;UL&gt;&lt;LI&gt;&lt;FONT face="courier new,courier" color="#FF0000"&gt;&lt;FONT face="courier new,courier" color="#FF0000"&gt;Uncaught SyntaxError: Unexpected token '&amp;lt;'&amp;nbsp;&lt;FONT face="helvetica" color="#000000"&gt;in &lt;FONT face="courier new,courier"&gt;myClass.js&lt;/FONT&gt;:&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Translations for en_US
i18n_register({"plural": function(n) { return n == 1 ? 0 : 1; }, "catalog": {}});

&amp;lt;!DOCTYPE html&amp;gt; // ERROR THROWN HERE
// ...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;bubbling to&amp;nbsp;&lt;FONT color="#FF0000"&gt;Uncaught TypeError: Cannot read property 'myProperty' of undefined&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Again, &lt;FONT face="courier new,courier"&gt;d3.js&lt;/FONT&gt; is also included in the same way and works fine; the script includes a similar preamble but is otherwise unchanged.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Any ideas and/or solutions would be very much appreciated.&amp;nbsp;&lt;/STRONG&gt;Also, apologies for the formatting; extra spaces are being inserted.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Apr 2021 01:05:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/In-an-HTML-dashboard-why-is-a-simple-JS-file-parsed-into-HTML/m-p/547137#M37620</guid>
      <dc:creator>curtismcginity</dc:creator>
      <dc:date>2021-04-08T01:05:38Z</dc:date>
    </item>
  </channel>
</rss>

