Skip to main content

Bug Tracker

Side navigation

#1793 closed bug (duplicate)

Opened October 10, 2007 07:18PM UTC

Closed October 17, 2007 10:10PM UTC

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!

Attachments (0)
Change History (3)

Changed October 12, 2007 04:24PM UTC by diz comment:1

Hello,

I have corrected this bug with a patch that you can find here:

http://dev.jquery.com/ticket/1698

Cheers,

Gabriel

Changed October 16, 2007 06:11PM UTC by Jebber007 comment:2

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

Changed October 17, 2007 10:10PM UTC by john comment:3

resolution: → duplicate
status: newclosed

Duplicate of #1698.