I have a Firefox addon with the following code:
$("table > tbody > tr > td[width='600']").wrapInner("<div id='content_cont' />");
That line of code executes, but all the lines after it don't. It throws an error that has a code that's over 500KB in the Firefox error console.
CODE:
An exception occurred.
Traceback (most recent call last):
File "resource://jid0-ib8arkgejpxo7qidkuieut5rquk-at-jetpack/flvs-educator-release-version/data/redesign.js", line 49, in
$("table > tbody > tr > td[width='600']").wrapInner("<div id='content_cont' />");
File "resource://jid0-ib8arkgejpxo7qidkuieut5rquk-at-jetpack/flvs-educator-release-version/data/jquery.js", line 2, in .wrapInner
(function(a,b){function G(a){var b=F[a]={};return p.each(a.split(s)...<tons of meaningless code>...&define("jquery",[],function(){return p})})(window);
ReferenceError: Begin is not defined
I can't figure out why it's doing this. Is the syntax wrong?
If the content you are wrapping contains any script
elements, then wrapInner
will execute them again, even if they ran when the page first loaded. See Ticket #9134 on jQuery's bug tracker for some more information.
It looks like there is an error in the one of the script
elements inside the content you are wrapping, and that error is preventing your code from continuing to execute past the wrapInner
call. The error may be occurring because the code assumes that it will only ever be run once. The simplest solution might be to just remove any script
elements from the content before wrapping it:
$("table > tbody > tr > td[width='600']").find('script')
.remove()
.end().wrapInner("<div id='content_cont' />");