Bug Tracker

Opened 12 years ago

Closed 12 years ago

#1793 closed bug (duplicate)

Bug in domManip - mal-timed script evaluation

Reported by: Jebber007 Owned by:
Priority: major Milestone: 1.2.2
Component: core Version: 1.2.1
Keywords: domManip, evalScripts Cc:
Blocked by: Blocking:

Description

If you do an ajax load, with this being the content, it will fail.

<div>
    <input type="text" id="test" value="Test" />
    <script>alert(document.getElementById('test').value);</script>
</div>

However, THIS currently works:

<input type="text" id="test" value="Test" />
<script>alert(document.getElementById('test').value);</script>

This worked previously in Version 1.1.3.1, but stopped working in 1.1.4 and hasn't worked since.

We did some tweaking, and found that in the globalEval function, if the line:

eval.call( window, data );

was changed to:

window.setTimeout( data, 0 );

...it started working for us.

Thanks for the great work, guys!

Change History (3)

comment:1 Changed 12 years ago by diz

Hello,

I have corrected this bug with a patch that you can find here: http://dev.jquery.com/ticket/1698

Cheers, Gabriel

comment:2 Changed 12 years ago by Jebber007

Gabriel's solution is a much more robust one. Please disregard this solution and see this ticket, as the above solution does not deal with inline functions, whereas Gabriel's does. http://dev.jquery.com/ticket/1698

comment:3 Changed 12 years ago by john

Resolution: duplicate
Status: newclosed

Duplicate of #1698.

Note: See TracTickets for help on using tickets.