Ticket #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@… | |
| Blocking: | Blocked by: |
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
comment:1 follow-up: ↓ 3 Changed 5 years ago by flesler
- Priority changed from blocker to minor
- Resolution set to wontfix
- Status changed from new to closed
- Component changed from unfilled to event
comment:2 Changed 5 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."
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

For that, you can use the elementReady plugin.