Ticket #3479 (closed bug: duplicate)
wrap causing problems in Firefox 2/3 when used with google adsense.
| Reported by: | tobins | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3 |
| Component: | core | Version: | 1.2.6 |
| Keywords: | script | Cc: | tobins, flesler |
| Blocking: | Blocked by: |
Description
Take the following example: (NOTE: I've removed my ad client code...)
<div class="rounded"> <script type="text/javascript"><!-- google_ad_client = "pub-*"; /* 300x250, created 11/13/07 */ google_ad_slot = "4807*801"; google_ad_width = 300; google_ad_height = 250; --> </script> <script type="text/javascript" src=" http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script></div>
And apply the following JS:
$("div.rounded").wrap('<div class="roundedcorner"><div class="ml"><div class="mr"><div class="mm"></div></div></div></div>');
In firefox 2/3 the wrap will cause the google ad code to hide the entire page (page appears blank) and no ad appears. Safari and IE work fine.
Change History
comment:2 Changed 5 years ago by flesler
- Cc tobins, flesler added
- Owner flesler deleted
- Component changed from unfilled to core
comment:3 Changed 5 years ago by dmethvin
Google's show_ads.js uses document.write() to put the ad html into the document. What happens when you try to $().wrap() a script that document.write()s html? If the script re-executes it will wipe out the current document. From your description it sounds like that may be happening but I didn't test it.
As for a solution, maybe you could put the ad code in an iframe and round that.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

<div class="rounded"> <script type="text/javascript"><!-- google_ad_client = "pub-*************"; /* 300x250, created 11/13/07 */ google_ad_slot = "4807***801"; google_ad_width = 300; google_ad_height = 250; //--></script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script> </div>The JS call:
$("div.rounded").wrap('<div class="roundedcorner"><div class="ml"><div class="mr"><div class="mm"></div></div></div></div>');