skpal / scale9grid

Automatically exported from code.google.com/p/scale9grid
Other
0 stars 0 forks source link

contained scripts execute twice #17

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a div containing a JS script block
2. Apply scale9Grid() to the div

What is the expected output? What do you see instead?
The script should execute only once. Instead, the script executes the first
time before scale9Grid() runs, then executes again.

What version of the product are you using? On what operating system?
Code: scale9grid 0.9.3, jQuery 1.4.2
Browsers: Firefox 3.6.3, IE 8.0.6001.18702
OS: Windows XP SP3

Original issue reported on code.google.com by escher...@gmail.com on 11 May 2010 at 9:26

GoogleCodeExporter commented 8 years ago
Ok, seems that this is a jQuery issue -- when you detach and reattach script 
elements
to the DOM, it re-executes any scripts inside those elements. This even applies 
to
using html() to put content into an element.

Fortunately, you can use the Javascript innerHTML property to add content that 
may
include script tags without the scripts being executed again.

Original comment by escher...@gmail.com on 11 May 2010 at 10:42