jQuery: The Write Less, Do More JavaScript Library

Ticket #1959 (closed bug: fixed)

Opened 6 months ago

Last modified 5 months ago

"strings are automatically evaluated" - NOT!

Reported by: djot Assigned to: anonymous
Type: bug Priority: major
Milestone: 1.2.2 Component: core
Version: 1.2.1 Keywords: automatic evalscript
Cc: Needs: Review

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

Change History

Changed 6 months ago by djot

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

Changed 5 months ago by davidserduke

  • status changed from new to closed
  • resolution set to duplicate

This is essentially a duplicate of #1884.

Changed 5 months ago by davidserduke

  • status changed from closed to reopened
  • resolution deleted

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

Changed 5 months ago by davidserduke

  • status changed from reopened to closed
  • resolution set to fixed

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.