Skip to main content

Bug Tracker

Side navigation

#1959 closed bug (fixed)

Opened November 22, 2007 06:40PM UTC

Closed December 10, 2007 07:07PM UTC

"strings are automatically evaluated" - NOT!

Reported by: djot Owned by:
Priority: major Milestone: 1.2.2
Component: core Version: 1.2.1
Keywords: automatic evalscript Cc:
Blocked by: Blocking:
Description

-

Hi,

quote from: http://docs.jquery.com/Release:jQuery_1.2

"$(...).evalScripts()

This method is no longer necessary in jQuery - all scripts included in HTML strings are automatically evaluated when injected into the document. No substitute method is needed."

if you have this, the click event gets bound (works).

any html/text <span id="foo">bar</span> any html/text
$(document).ready(function(){
$("#foo").click(...
});

if you do it the other way round, the event does not get bound (does not work):

$(document).ready(function(){
$("#foo").click(...
});
any html/text <span id="foo">bar</span> any html/text

I am not sure if this is a feature, for me it's a bug.

djot

-

Attachments (0)
Change History (4)

Changed November 22, 2007 06:41PM UTC by djot comment:1

forget to mention that my codeblocks shown above are delivered by ajax responses ...

Changed December 06, 2007 03:08AM UTC by davidserduke comment:2

resolution: → duplicate
status: newclosed

This is essentially a duplicate of #1884.

Changed December 10, 2007 06:47PM UTC by davidserduke comment:3

resolution: duplicate
status: closedreopened

Sorry, on closer examination this actually wasn't a close enough duplicate so I'm reopening it.

Changed December 10, 2007 07:07PM UTC by davidserduke comment:4

resolution: → fixed
status: reopenedclosed

Fixed in [4094]. Now all scripts are postponed till after the html is inserted. Unfortunately, $(document).ready() doesn't work with html insertion so at this time it makes sense to postpone all script evaluation since some of them (depending on where they are in the html) have to be postponed anyway. This gives the most consistent results.