Skip to main content

Bug Tracker

Side navigation

#3619 closed enhancement (wontfix)

Opened November 17, 2008 04:46PM UTC

Closed November 17, 2008 04:59PM UTC

Last modified November 17, 2008 05:08PM UTC

$(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@taz.de
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(){ ... });

Attachments (0)
Change History (3)

Changed November 17, 2008 04:59PM UTC by flesler comment:1

component: unfilledevent
priority: blockerminor
resolution: → wontfix
status: newclosed

For that, you can use the elementReady plugin.

Changed November 17, 2008 05:03PM UTC by filOtaz.de comment:2

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)

Changed November 17, 2008 05:08PM UTC by filOtaz.de comment:3

Replying to [comment:1 flesler]:

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