Closed GoogleCodeExporter closed 8 years ago
What are you passing to the prettyPrint function?
Original comment by mikesamuel@gmail.com
on 22 Jul 2009 at 5:55
[deleted comment]
I'm not sure I can easily answer that. You could just look at the (Lussumo-)
Vanilla-forum I linked - that's where the error occurs.
Are you looking for a response like:
<SNIP rel="original-source">
<code class="prettyprint">127) AC Improves my English.<br />128) AC makes me
feel
ok.<br />129) I like to meet some friends to pwn or to be pwned. "/<br />130)
AC's
gameplay did teach me that team work is everything.<br /><br />There's no much
left
to say... AC Rocks!</code>
</SNIP>
<SNIP rel="firebug-rendered-source-snip">
<code class="prettyprint">
<span class="lit">127</span>
<span class="pun">)</span>
<span class="pln"> AC </span>
<span class="typ">Improves</span>
<span class="pln"> </span>
<span class="kwd">my</span>
<span class="pln"> </span>
<span class="typ">English</span>
<span class="pun">.</span>
<span class="pln">
</span>
<span class="lit">128</span>
<span class="pun">)</span>
<span class="pln"> AC makes me feel ok</span>
<span class="pun">.</span>
<span class="pln">
</span>
<span class="lit">129</span>
<span class="pun">)</span>
<span class="pln"> I like to meet some friends to pwn </span>
<span class="kwd">or</span>
<span class="pln"> to be pwned</span>
<span class="pun">.</span>
<span class="pln"> </span>
<span class="str">
</span>
</code>
</SNIP>
Which I ripped from
http://assault.cubers.net/forum/comments.php?DiscussionID=2273&page=2
If this doesn't clear up your question, please be more elaborate.
Thank you for taking time for my problem though already! :)
Original comment by MeatR...@gmail.com
on 22 Jul 2009 at 7:04
Over a month w/o activity .. do you need further information?!?
Original comment by MeatR...@gmail.com
on 31 Aug 2009 at 5:23
Well, I've finally given up on getting help here and also finally found the
time to
do some testing on this - the issue does not arise when using a stand-alone
page and
the code-snippet from above, so it must be linked to Vanilla and not your code.
I'm sorry I didn't do this to begin with but a simple hint from your end
might've
cleared this up a lot sooner.
Still, I'm thankful for your code.
Please feel free to close this down.
Original comment by MeatR...@gmail.com
on 26 Sep 2009 at 11:26
Some more testing shows the issue lies with the way the onload is implemented.
If I place it as an inline attribute of the body-tag it will work fine, but
using a
dynamic attachment results in the mentioned error. Trying to find some
reference to
this hasn't brought me any useful results, maybe you could give me a
hint/solution!?!
The different methods I found to add onload-events don't seem to make a
difference.
I've tried:
<SNIP>
function addPrettyPrintLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != "function") {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addPrettyPrintLoadEvent(prettyPrint);
</SNIP>
and
<SNIP>
if (window.addEventListener) // W3C standard
{
window.addEventListener('load', prettyPrint, false); // NB **not** 'onload'
}
else if (window.attachEvent) // Microsoft
{
window.attachEvent('onload', prettyPrint);
}
</SNIP>
and
<SNIP>
function addEvent( obj, type, fn ) {
if ( obj.attachEvent )
{
obj['e'+type+fn] = fn;
obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
obj.attachEvent( 'on'+type, obj[type+fn] );
}
else
obj.addEventListener( type, fn, false );
}
addEvent( window, 'load', prettyPrint);
</SNIP>
Original comment by MeatR...@gmail.com
on 26 Sep 2009 at 11:59
Sorry it's taken me so long to respond. I've been working on projects I get
paid for.
Can you just pass in a function that calls prettyprint?
Instead of
window.addEventListener('load', prettyPrint, false);
try
window.addEventListener('load', function () { prettyPrint(); }, false);
so that the event object doesn't get passed to prettyPrint.
prettyPrint might be getting confused because it thinks the event object is a
callback that it should call when done.
Original comment by mikesamuel@gmail.com
on 3 Oct 2009 at 7:46
Yeah, we all need to bring home some bacon - I'm sorry if my earlier comment was
disrespectful; but still - I can't keep myself from hinting at the status-flags
of
posts here, a change there might have mullified me for a bit longer, but then
again
it'd have probably stopped me from finally doing tests of my own.
But:
All's well that ends well- the problem has been solved!
Thank you for your time, insight and
for your professionalism toward my impatience & insolence :-)
Original comment by MeatR...@gmail.com
on 4 Oct 2009 at 10:29
Don't worry. I didn't take offence.
I'm glad it's working for you now.
I'm going to close this issue and add a FAQ entry to explain the error message.
Original comment by mikesamuel@gmail.com
on 5 Oct 2009 at 3:32
Original issue reported on code.google.com by
MeatR...@gmail.com
on 22 Jul 2009 at 7:04