tag:support.markedapp.com,2011-09-11:/discussions/problems/148528-normal-javascript-functions-are-not-available-with-the-console-reporting-errorsMarked: Discussion 2018-08-15T23:33:57Ztag:support.markedapp.com,2011-09-11:Comment/458957182018-08-14T16:39:53Z2018-08-14T16:39:53ZNormal javascript functions are not available with the console reporting errors<div><p>I've had a couple other reports this morning, I'm a bit concerned that<br>
this is a 10.11 issue, which I don't currently have a test machine for.<br>
I'm working to track something down right now.</p>
<p>-Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/458957182018-08-14T19:25:40Z2018-08-14T19:25:40ZNormal javascript functions are not available with the console reporting errors<div><p>I found the issue. I'll have an update posted later today (MAS version<br>
will take time for review but you're on direct so you'll have access to<br>
the Marked->Check for Updates automatic updater).</p>
<p>Thanks for reporting this,<br>
Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/458957182018-08-14T20:28:17Z2018-08-14T20:28:17ZNormal javascript functions are not available with the console reporting errors<div><p>The update is out for direct customers (Marked 2->Check for Updates).<br>
Let me know if it doesn't fix the issue for you.</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/458957182018-08-15T20:14:44Z2018-08-15T20:14:45ZNormal javascript functions are not available with the console reporting errors<div><p>Thanks. I just updated and now have additional errors when referencing an external JavaScript file (which was the start of the adventure for all of this). Using sample.md and sample.js (attached) the following errors are displayed in the console:</p>
<p>[Error] TypeError: codeTags.forEach is not a function. (In 'codeTags.forEach(updateTag)', 'codeTags.forEach' is undefined) (anonymous function)</p>
<p>Same OS and system configuration aside from the updated version, now 2.5.22 (957).</p></div>Larry Pescetag:support.markedapp.com,2011-09-11:Comment/458957182018-08-15T20:31:31Z2018-08-15T20:31:31ZNormal javascript functions are not available with the console reporting errors<div><p>You're actually running into the same problem that was causing the errors in my JavaScript: the version of macOS you're running doesn't process ECMA 6, so your <code>const</code> keyword is breaking your script. Change it to <code>var</code> and it should work fine.</p>
<p>P.S. The script as is should run fine on macOS 10.12 and newer. I can only verify it works fine on 10.14 and doesn't work on 10.11 at the moment, though.</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/458957182018-08-15T21:31:06Z2018-08-15T21:31:07ZNormal javascript functions are not available with the console reporting errors<div><p>hm.<br>
changing this:</p>
<p>document.addEventListener("DOMContentLoaded", function(event) {<br>
const codeTags = document.querySelectorAll('code.text'); codeTags.forEach(updateTag);</p>
<p>to this exhibits the same errors:</p>
<p>document.addEventListener("DOMContentLoaded", function(event) {<br>
var codeTags = document.querySelectorAll('code.text'); codeTags.forEach(updateTag);</p>
<p>I expect <code>document.querySelector('code.text')</code> to identify all of the code text blocks, but it returns an empty set. The <code>const</code>/<code>var</code> change doesn't address the issue with Marked2 on Mac OS 10.11.</p>
<p>A perfectly reasonable answer here is "Upgrade to an OS that supports an non-stone age ECMA".</p>
<p>Thanks for all of your help.</p></div>Larry Pescetag:support.markedapp.com,2011-09-11:Comment/458957182018-08-15T23:33:57Z2018-08-15T23:33:57ZNormal javascript functions are not available with the console reporting errors<div><p>Well, both .querySelectorAll() and .forEach() are available in ECMA 5.<br>
If the query is returning an empty set, you might want to examine the<br>
actual contents of the DOM to see what's there. You can test things out<br>
in the console (REPL), too. Just hit ctrl-opt-i in Marked or right click<br>
in the preview and choose Inspect.</p>
<p>-Brett</p></div>Brett