Bug Tracker

Opened 12 years ago

Closed 12 years ago

#1959 closed bug (fixed)

"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 -

Change History (4)

comment:1 Changed 12 years ago by djot

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

comment:2 Changed 12 years ago by davidserduke

Resolution: duplicate
Status: newclosed

This is essentially a duplicate of #1884.

comment:3 Changed 12 years ago by davidserduke

Resolution: duplicate
Status: closedreopened

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

comment:4 Changed 12 years ago by davidserduke

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.

Note: See TracTickets for help on using tickets.