Skip to content
This repository was archived by the owner on Apr 22, 2020. It is now read-only.

Commit 7262a86

Browse files
documented fix for bug 85
1 parent 7ab5d68 commit 7262a86

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

README.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,22 @@ <h3>How do I put line numbers in my code?</h3>
148148
<p>For a more complete example see the issue22
149149
<a href="tests/prettify_test.html#issue22">testcase</a>.</p>
150150

151-
<br><br><br>
151+
<h3>I get an error message "a is not a function" or "opt_whenDone is not a function"</h3>
152+
<p>If you are calling <code>prettyPrint</code> via an event handler, wrap it in a function.
153+
Instead of doing
154+
<blockquote>
155+
<code class="prettyprint lang-js"
156+
>addEventListener('load', prettyPrint, false);</code>
157+
</blockquote>
158+
wrap it in a closure like
159+
<blockquote>
160+
<code class="prettyprint lang-js"
161+
>addEventListener('load', function (event) { prettyPrint() }, false);</code>
162+
</blockquote>
163+
so that the browser does not pass an event object to <code>prettyPrint</code> which
164+
will confuse it.
152165

166+
<br><br><br>
153167

154168
<div class="footer">
155169
<!-- Created: Tue Oct 3 17:51:56 PDT 2006 -->

0 commit comments

Comments
 (0)