|
Last Exit to Springfield
The Simpsons, Season 4
The Simpsons |
|
|
Krusty Gets Kancelled
The Simpsons, Season 4
The Simpsons |
★★★ |
|
Marge in Chains
The Simpsons, Season 4
The Simpsons |
★★★ |
|
Whacking Day
The Simpsons, Season 4
The Simpsons |
★★★ |
|
The Front
The Simpsons, Season 4
The Simpsons |
★★★ |
|
I've Got You Under My Skin
Classic Sinatra
Frank Sinatra |
|
|
Doctorin' The Tardis
Doctorin' the Tardis CD Single
The Timelords |
★★★★ |
|
Strange Kind Of Love
Wild Birds 1985-1995: The Best Of The Beggars Banquet Years
Peter Murphy |
★★★ |
|
The History of the World (Part 1)
Smash It Up: The Anthology
The Damned |
★★★★★ |
|
Shoplifters of the World Unite
The World Won't Listen
The Smiths |
★★★ |
|
Absurd (Reeferendrum)
Absurd (Promo Single)
Fluke |
★★★★ |
|
There Is A Light That Never Goes Out (Josh Patrick Remix)
There Is A Light That Never Goes Out / Evil
The Smiths |
★★★★ |
|
Name of the Game
Tweekend
The Crystal Method |
|
|
Take A Chance On Me
Pop!
Erasure |
★★★ |
|
Only This Moment
The Understanding
Röyksopp |
★★★★ |
|
Opus 132
Pieces In A Modern Style
William Orbit |
★★★ |
|
Adagio For Strings (Ferry Corsten Remix)
Pieces In A Modern Style
William Orbit |
★★★★ |
|
Tomorrow People
1000 Original Hits: 1988
Ziggy Marley |
★★★ |
|
Least Complicated
Retrospective
Indigo Girls |
|
|
Luv 2 U
Trust It
Junior Jack |
|
|
Aerodynamic
Discovery
Daft Punk |
★★★★ |
|
Down In It
Pretty Hate Machine
Nine Inch Nails |
★★★ |
|
Movin' Right Along
Muppets: The Green Album
Alkaline Trio |
|
|
Disappearing Into You
Seventh Heaven
Govi |
|
|
P. Machinery [Beta Mix]
Outside World
Propaganda |
|
|
Ooh La La
Supernature
Goldfrapp |
★★★★ |
|
Monkey Gone To Heaven
Death To The Pixies
Pixies |
|
|
Down Down Down (Midnight Juggernauts Remix)
Re-Sets
The Presets |
|
|
In a State (Sasha Remix) 2003
Involver
UNKLE |
★★★★ |
|
Destiny
Simple Things (Bonus)
Zero 7 |
★★★★ |
|
Das Testament des Dr Mabuse [DJ Promo Version]
Outside World
Propaganda |
★★★ |
|
Stop!
Pop!
Erasure |
★★★ |
|
Rock You Like A Hurricane
The Platinum Collection
Scorpions |
★★★★ |
|
Frozen
Ray Of Light
Madonna |
|
|
Pompeji
Voices & Images
Camouflage |
|
|
Pop A Cap In Yo' Ass
Buzzin' Fly Volume 2
Ben Watt Feat. Estelle |
★★★★ |
|
La Luna
DJ Culture (Limited Edition)
Blank & Jones |
|
|
Soul Sauce (Guachi Guaro)
Verve Unmixed 2
Cal Tjader |
|
|
Desafinado
Jazz Samba
Stan Getz & Charlie Byrd |
|
|
La Flûte De Pan
The Seduction Of Claude Debussy
The Art Of Noise |
|
|
Agua De Beber
Jazz Masters 9
Astrud Gilberto |
|
|
Wild, Sweet And Cool
Tweekend
The Crystal Method |
|
|
Girl And The Sea (Cut Copy Remix)
Re-Sets
The Presets |
★★★★ |
|
Versus
Velocifero
Ladytron |
|
|
Day Too Soon
Some People Have Real Problems
Sia |
★★★★ |
|
My Weakness
Play
Moby |
|
|
Things Can Only Get Better (Superfly Development Vocal Mix)
Things Can Only Get Better (Single)
D:Ream |
★★★★★ |
|
These Days
Involver
Petter |
|
|
Isn't It Romantic
One Fine Day Soundtrack
Ella Fitzgerald |
|
|
The Sky Is Falling (Remix)
Leave The Light On
Agnes Poetry |
★★★★ |
A few days ago at work I ran into a behavior of Safari version 3.x that I had not previously noticed. Perhaps this is because I have long been aboard the Safari 4 beta train, where the CSS would update normally. Essentially, Safari 3 doesn't load CSS declarations that occur in the body of an AJAX response. They just get ignored. I need different styles applied to various elements on the page that get loaded with the AJAX response.
It turns out Safari 3 is pretty inflexible with regards to this particular web standard, and doesn't like any style declarations in body of the page. It's default behavior is to (ever so helpfully) "move" the style elements into the head of the document, printing a small log to the error console. One could make the case that this is correct behavior, but it's not the behavior implemented by any other browser I know of. Phooey.
To make Safari 3 display the CSS from the loaded AJAX page fragment, it's possible to mimic its native behavior and move the style elements into the head of the page. I did something like (using Prototype):
var myEl = $('MyUpdateEl');
// Safari 3 doesn't "see" the MyStyle CSS element because its declaration is in the body.
// Remove the EXISTING 'MyStyle' style element from the head if it exists.
var style_el = $('MyStyle');
if (style_el) {
style_el.remove();
}
// Switch out the content.
myEl.update(responseText);
Finally, move the new style element that was included in the response:
// Move the NEW MyStyle element to the head so Safari 3 will show the new styles.
style_el = $('MyStyle'); // This element comes inline with the responseText.
if (style_el) {
style_el.remove();
var head_el = Element.extend(document.getElementsByTagName('head')[0]);
head_el.insert(style_el);
}
This technique could be easily extended to loop through any style declaration blocks in the AJAX response and move them all into the document head. But this worked for my particular situation. :)
At Nov. 2, 2009 @ 10:40 p.m. Nikhat said:
Thank you so so so very very very much for this post.
I had a similar bug and it was driving me nuts.
Initially i thought that Safari was not loading the css in the ajax response.
But the code that i was using was scripted by someone else earlier and was working fine elsewhere on the site. It just wasnt working on my page.
And it was really making me pull out my hair.
But after reading your post, I checked the earlier page and turns out the original author had just included the styles both in the main page and the ajax response so that his page works in all browsers.
Anyway long story short, your post helped me a lot. Thanks a ton :-)
Have any thoughts about this post? Add your comment.