Ok, this is one of my ranting posts. It's been a bit since I ragged on Safari. The main reason I feel the need to do so is:
1) the assinine Mac commercials that make out like the Mac and its software are superior to anything else
2) an article I read on Ajaxian months ago where developers were invited to comment on Safari... after about a dozen or so developers (who think like me) had commented... then the Mac-faithful descended and glowingly declared that Safari was at least on par...
[Despite the rant, if you got a solution I would love to hear it]
So I just finished working on a new Ajax Behavior called LayoutSpanBehavior (in MS Ajax). It simply lets you define a group of divs/spans/table cells as able to work together to render text to the screen. The moment one HTML Element overflows then the next one takes over. The way they operate together is pretty cool... So nothing needs to be contiguous and you can create some freaky looking layouts if you want (and the browser figures out where to break up the text).
My initial version uses the "watch/unwatch" on HTML statements (Mozilla-based) and the onpropertychanged event (IE) to monitor the innerHTML, and innerText properties of all the elements for changes and then takes the new text and lays it out across all the elements in your layout (it's very cool!)
So since my client is a Mac guy I decided I had better try this in Safari <sigh />.
Where do I begin... Ok, neither the watch/unwatch nor the onpropertychanged events exist, and there is no alternative that I can find (since Apple in their infinite wisdom doesn't publish a javascript reference to their browser... they refer you to a JavaScript 1.2 reference and then tell you that they implement parts of JavaScript 1.3. I just want to know what I can do in your %^&**&^ (simulated swearing) browser, so I can work around the issues.
To solve this I create a new method on all the elements called set_text. This works, but I'd rather let the user be able to work without having to remember anything (and if Safari is not necessary then you are set).
Now if that weren't bad enough. My original examples used a table with the CSS table-layout set to fixed, and an L shaped text region (with an extra cell marked with the text IMG to simulate an image here). All cells have heights and widths applied to them (which means that they should hold the supplied height/width regardless of the actual content).
The moment text gets written to the upper left hand cell, the "IMG" cell shifts and it occupies about half the space of the left upper hand cell (BTW, the "IMG" cell should the the right upper hand). When I turn on borders it shows that the position where everything should be... but Safari insists on rendering this strangely.
I ended up switching to a div-based example (but the original layout is still in the original example and will continue to be when this gets released... it's available in the source for the codeplex DTAjax project).
But let's go back to the Table problem. If I were a betting man I would say the problem is the table-layout style (which is, BTW, required by IE and Mozilla). Even if this were the case there is no reason for Safari to render something this poorly. This is not alternate formatting... this is incorrect. Tables have been around for a while now... So why does Safari rend this way when no other browser does?
Easy... When the Apple Engineers started with Konqueror (which uses the Mozilla render engine), they decided that for some reason they didn't like the rendering engine for Tables... so they rewrote it (and now it's better because Apple built it).
Now, mind you, Safari has a number of nice debugging features (none of which are on the top of favorite web-based debugging tools...), but the standards of the browser are poor... actually I would say that Safari is on par at least with the 5.0 browsers (that would be Mozilla FireFox 0.5-0.8 and IE 5/5.5). I come up with 5.0 because it's better than any of the 4.0 browsers (just barely).
That said, IE 5/5.5 was a long time ago... we are now 2 iterations of browser beyond this. And, we are not talking about emerging technology here. When IE 2 was going head to head with NS 2, IE was really just a version behind... IE3 and NS3 were a lot closer together (feature-wise NS was still ahead, but the browsers were closer in what they were enabling).
Raise your hands if who would like to build web apps that support NS4 and the more recent browsers? No one?!!? What's wrong with you? NS4 is/was a widely used browser! How about IE4? (I see a few of you)...
<My final shot across the bow /> Hey Apple! The name of the object is XMLHttp! It's an industry standard at this point. Why don't you support the XML part of that equation?
[tags: Safari, Mac, Mac Love, Safari Love, Ajax, Browser Rendering]
Print | posted on Tuesday, May 08, 2007 1:30 PM