Bug Tracker

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#3619 closed enhancement (wontfix)

$(document).ready waits for external js so everything waits for ads

Reported by: filOtaz.de Owned by: flesler
Priority: minor Milestone: 1.3
Component: event Version: 1.2.6
Keywords: Cc: fil@…
Blocked by: Blocking:

Description

Ad distributors commonly provide js tags, that use document.write to inject new <script> tags, that inject new <script> tags and so on until finally some actual html is inserted. All these scripts use document.write() and are fully under control of the ad deliverer.

With $(document).ready waiting for all html to be parsed and the DOM build, everything waits for the whole chain loaded, which can be quite some time. Wrapping the tags in $(document).ready handlers makes things even worse: The document.write() is done in the global context and so overwrites the whole DOM. This results in only the ads shown.

This is a showstopper for using $(document).ready together with software like Openads or Companies like e.g. Adlink, Doubleclick and the like.

Possible remedy (?): Allow .ready() on subparts of the DOM, not only on $(document) in a way so that only completion of that subtree is waited for. to be used like:

<body>

<div id='site'> ... </div> <div id='ads'> ... </div>

</body>

---

$('#site').ready(function(){ ... });

Change History (3)

comment:1 Changed 15 years ago by flesler

Component: unfilledevent
Priority: blockerminor
Resolution: wontfix
Status: newclosed

For that, you can use the elementReady plugin.

comment:2 Changed 15 years ago by filOtaz.de

This seems to be Gecko specific behaviour:

"If a document exists in the target, this method [document.open] clears it [...] Also, an automatic document.open() call happens when document.write() is called after the page has loaded, but that's not defined in the W3C specification."

(https://developer.mozilla.org/en/DOM/document.open)

comment:3 in reply to:  1 Changed 15 years ago by filOtaz.de

Replying to flesler:

Oh, Great! Wasn't aware of that one. thx.

Note: See TracTickets for help on using tickets.