Categories
Technology Web

IE8 and breaking the web

Recovered from the Wayback Machine.

Another break between IE7 and IE8 is the support for opacity.

In previous versions of Internet Explorer, Microsoft used its own custom filters in order to implement opacity. This has been known for some time and libraries manage opacity for old and new browsers by using code like the following, in JavaScript:


// cross-browser adjust opacity function
function setOpacity(obj,val) {
  obj.style.opacity = val;
  obj.style.MozOpacity=val;
  obj.style.KhtmlOpacity=val;
  val*=100;
  obj.style.filter = "alpha(opacity="+val+")";
}

It’s a trick that takes advantage of JavaScript’s dynamic prototyping to “set” any possible combination of opacity properties, including the CSS3 opacity, the older Mozilla opacity, as well as IE’s opacity filter. Of course now, we can pretty much drop anything but the CSS3 opacity, and the IE filter:


// cross-browser adjust opacity function
function setOpacity(obj,val) {
  obj.style.opacity = val;
  val*=100;
  obj.style.filter = "alpha(opacity="+val+")";
}

This will work with IE6 and IE7, but not IE8. The reason why is that Microsoft dropped implementation of a proprietary functionality called hasLayout, which the company’s opacity filter was dependent on (at least, that’s what I’ve read). This is good, because hasLayout is a Bad Thing.

Unfortunately, this also “broke the web” in that Microsoft, in IE8 beta 1 at least, didn’t bother to replace the now missing opacity filter with support for the CSS3 opacity filter. True, CSS3 isn’t a “released spec” yet, but every other browser–Firefox, Safari, and Opera–supports CSS3 opacity.

I’ve explored the online discussions related to IE8 and opacity, and there are rumors that the long handled Alpha opacity filter will work, but I’ve not found that this to be true, and I’ve not found anything at Microsoft on a workaround.

At this time, and to the best of my knowledge, to get opacity to work with IE8, you’ll have to add the IE compatibility meta tag:



<meta http-equiv="X-UA-Compatible" content="IE=7" />

You put this meta element right after the title element. Of course, you lose the “good” standards stuff that comes with IE8 if you do this. It’s a damned if you do, damned if you don’t situation: either opacity doesn’t work with IE8, or you lose the stuff that does work correctly with IE8.

I’m also finding another problem with IE8: adding an onclick event handler to a DIV element seems to only be sensitized to whatever content is in that element, not the element itself. So if you have centered text in the DIV element, only the text is sensitized to the onclick event, not the entire block.

This impacts on many Ajax applications, including most accordion functionality, and not just on mine. For instance, Rico’s Accordion widget doesn’t work with IE8 if the person clicks anywhere but the text. To recapture this functionality, you’ll again have to use the compatibility meta tag.

Categories
Web

Grace in winning

Now, this is what I hoped to see when the Acid3 test was first announced. Not the macho posturing I saw yesterday.

The WebKit folks published a writing at the Surfin’ Safari site that details the challenges met by Cameron McCormack associated with the last test. To me, the story is a fascinating look into browser development. I hope we can see something similar from Opera about that organization’s own effort.

I particularly like, and want to highlight, the writing at the end of the post:

Web standards can often seem boring compared to super fast performace, whizzy new features, and even the basic Web compatibility work of making sites work properly. Interoperability is critical to the Web as an open platform, but it can be difficult to explain to regular users why it’s so important. The Acid tests make web standards fun, for browser developers, for Web designers, and for regular users. Whatever the intrinsic value of the tests may be, I think we should all thank Ian Hickson and all the test contributors.

I’d also like to thank Opera for giving us some serious competition and making this a real horse race. We have huge respect for their developers and all the work they do on Web standards.

As for Firefox 3 not “passing” the Acid3 test, I’d rather hear Firefox explain its future development goals such as when it plans on incorporating SVG animation and text-shadow and the like, than having to worry about the test. The test brought about awareness. We’re aware. Now, let’s move on.

It’s with relief that I can now say congratulations sans any reservations to WebKit/Safari and Opera. Below is my first 100/100 snapshot, using the WebKit nightly on my PC.

update

And Opera’s result, using the special Windows build:

(via Anne, who hasn’t quite decided to move on from yesterday’s querulousness, albeit defense of a friend is noble.)

Categories
Web

Google’s excanvas only works in quirks mode for IE8

Recovered from the Wayback Machine.

I’m in the process of proofing Painting the Web, including testing all of the examples with the new IE8 beta. Yeah, fools rush in where angels fear to tread.

I was frustrated that all of my canvas examples weren’t working with IE8, even if I picked IE7 emulation mode. From a Google group I discovered that if I used quirks mode (ie, removed the DOCTYPE), the applications do work in IE8 and in IE7 mode, both. (Well, some of the applications–but at least I see some of the pieces with the ones that don’t work.)

I tried the meta tag and using IE7 strict mode, but it doesn’t work, though it doesn’t break as badly as IE8 standards mode. You see a box where the canvas rendering should be.

So, what this demonstrates is that Microsoft is dropping support for VML, but hasn’t implemented the HTML5 canvas element. More importantly, Microsoft doesn’t support VML in strict mode even if you’re running in IE7 mode. Jay-sus Microsoft, could you possibly leave things in worse shape?

However, further checking finds for us a Silverlight version of excanvas.js. Well, we knew that one was coming. Still, the problems with using Silverlight is that your page readers have to install Silverlight. Previously, all of the effort to translate canvas to Microsoft speak occurred without the reader having to install anything. This is a better approach that we no longer have. In addition, I don’t believe that Silverlight works with IE6, though I don’t know for sure, since I don’t have IE6 to test.

More importantly, this new JavaScript library works in IE7 emulation mode, but is pretty buggy in IE8 standards mode, though at least it works in Strict not Quirks. And, as long as you name the JavaScript files differently, you can include both JS libraries, which should enable the canvas applications to work with IE6. I don’t have access to check this out with IE6–I’m just making a guess. Having both libraries doesn’t break IE8, whether as IE8 or IE7 emulation. I don’t know if having both will break IE7. The real IE7.

Who’s on first?

Jay-sus Microsoft.

update MS does still support VML, I tried out a couple of pages that use VML directly and they work. The problem is in the excanvas.js library, then. It should work in IE7 emulation, because the examples did work with IE7. However, it doesn’t unless you also serve up the application in quirks mode (with no DOCTYPE).

I tried an SVN snapshot version of excanvas.js, the older one that’s still being developed, but it’s worse than the released version. However, that doesn’t mean that there won’t be a release of the non-Silverlight excanvas that will work with IE8 at some point.

Until then, currently:

The released version of excanvas.js only works in quirks mode for IE8, including running IE8 in IE7 emulation mode. Using the new meta tag doesn’t work, unless I used it incorrectly. I’m assuming one would use the following:


<meta http-equiv="X-UA-Compatible" content="IE=7" />

Do I have that wrong?

The Silverlight version of excanvas.js works in IE8 standards, and IE7 strict mode, but it’s not released yet, is still under development, and requires your page readers to install Silverlight. In addition, I don’t know that this library works with IE6.

I have included both in web pages, and assume one can use IE6 conditional statements to wrap the non-Silverlight option to ensure only IE6 picks it up:


<!--[if IE 6]>
<script type="text/javascript" src="originalexcanvas.js">
</script>
<![endif]-->

I have found, though, that when running IE in IE8 standards mode, most of the sample applications I had partially failed with the Silverlight version of the library. The only reliable results I received with IE8 was using quirks mode with the older excanvas.js library.

last update

Another area impacted by changes associated with VML is the mapping APIs provided by Google and Yahoo (non-Flash version). I’ve found if you do add the meta tag above, the applications mostly work. Some of the routing is off with Yahoo maps, but it’s close enough.

Categories
Specs Web

Joel Spolsky: Crap is good

Recovered from the Wayback Machine.

Joel Spolksy just spent several thousand words and accompanying diagrams saying one thing: we did things crappy in the past, and we should continue doing things crappy in the future because crap is easy.

Where do I start?

This upcoming battle will be presided over by Dean Hachamovitch, the Microsoft veteran currently running the team that’s going to bring you the next version of Internet Explorer, 8.0.

At a minimum Microsoft can go off and do its own thing in total isolation, and in the long run, Microsoft will end up being the loser. The more I work with SVG and the new CSS, the more I find that I can develop using the new technologies, and the page still works for IE but I don’t have to make it look the same for IE. As long as the page is clean, legible, and accessible via IE, it doesn’t have to look the same for IE as it does for the Big Three (Firefox, Safari, and Opera).

So I’d say that Hachamovitch is a player, but only to the extent that Microsoft wants to be a part of a larger community.

In practice, with the web, there’s a bit of a problem: no way to test a web page against the standard, because there’s no reference implementation that guarantees that if it works, all the browsers work. This just doesn’t exist.

Question: can you see this page?

There is no practical way to check if the web page you just coded conforms to the spec.

Question: can you see this page?

There are validators, but they won’t tell you what the page is supposed to look like, and having a “valid” page where all the text is overlapping and nothing lines up and you can’t see anything is not very useful. What people do is check their pages against one browser, maybe two, until it looks right. And if they’ve made a mistake that just happens to look OK in IE and Firefox, they’re not even going to know about it.

I’m trying to untangle this one mentally and failing. What Spolsky seems to be saying is that standards don’t matter, because people don’t test in all browsers, and standards somehow make lines not even up. Or something.

He can’t possibly be saying that standards break the web. Can he?

Actually, he can.

Standards are a great goal, of course, but before you become a standards fanatic you have to understand that due to the failings of human beings, standards are sometimes misinterpreted, sometimes confusing and even ambiguous.

The precise problem here is that you’re pretending that there’s one standard, but since nobody has a way to test against the standard, it’s not a real standard: it’s a platonic ideal and a set of misinterpretations, and therefore the standard is not serving the desired goal of reducing the test matrix in a MANY-MANY market.

DOCTYPE is a myth.

A mortal web designer who attaches a DOCTYPE tag to their web page saying, “this is standard HTML,” is committing an act of hubris. There is no way they know that. All they are really saying is that the page was meant to be standard HTML. All they really know is that they tested it with IE, Firefox, maybe Opera and Safari, and it seems to work. Or, they copied the DOCTYPE tag out of a book and don’t know what it means.

There’s at least four separate thoughts in these few seemingly related paragraphs. First: there really are no standards, because standards are a thing of the mind. Second, because standards are a thing of the mind, one can’t test pages against a standard. One such standards thing is DOCTYPE, which really doesn’t exist because no one knows what it does, and people just copy it, anyway. Therefore…

I must admit to getting lost at this point. Who’s on first?

And so if you’re a developer on the IE 8 team, your first inclination is going to be to do exactly what has always worked in these kinds of SEQUENCE-MANY markets. You’re going to do a little protocol negotiation, and continue to emulate the old behavior for every site that doesn’t explicitly tell you that they expect the new behavior, so that all existing web pages continue to work, and you’re only going to have the nice new behavior for sites that put a little flag on the page saying, “Yo! I grok IE 8! Give me all the new IE 8 Goodness Please!”

And indeed that was the first decision announced by the IE team on January 21st. The web browser would accommodate existing pages silently so that nobody had to change their web site by acting like the old, buggy IE7 that web developers hated.

A pragmatic engineer would have to come to the conclusion that the IE team’s first decision was right. But the young idealist “standards” people went nuclear.

It’s been a long time since I’ve been called a “young idealist”. I wonder how Sam Ruby likes being called a young idealist? I’m surprised Spolsky didn’t pat us all on the heads, offer us a cookie. But wait, it gets better…

Almost every web site I visited with IE8 is broken in some way. Websites that use a lot of JavaScript are generally completely dead. A lot of pages simply have visual problems: things in the wrong place, popup menus that pop under, mysterious scrollbars in the middle. Some sites have more subtle problems: they look ok but as you go further you find that critical form won’t submit or leads to a blank page.

Fancy that…this young idealist’s web sites both worked with IE8, right out of the box. In fact, the only problem I’ve had with IE8 is with Netflix and that’s because of the ActiveX controls and nothing to do with standards.

I think we’ll find that most web sites don’t break with IE8, or if they do, they’re just as likely break with Firefox 3b, and Opera 9.5b, and the latest WebKit. There’s a reason you have a long beta period for a browser–to give people time to make any necessary fixes in order to have the browser work with the page once the browser is released out of beta.

True, there are sites that will continue to break with IE8 once it’s released. If you want to find them, go to the geocities.com web sites, and search on muscle cars. Better yet: “Unicorn rainbow pony”. Heck, even most of them will *probably work.

Some of those pages can’t be changed. They might be burned onto CD-ROMs. Some of them were created by people who are now dead. Most of them created by people who have no frigging idea what’s going on and why their web page, which they paid a designer to create 4 years ago, is now not working properly.

So the web has to stop because a web site has been burned on a CD, or the person who created the site is dead? Isn’t that equivalent to saying, “No, you can’t have blu-ray, because I still have VHS tapes”? Or maybe more in line with, “No, you can’t have that vaccine because there are people in the world who think the plague is caused by evil spirits, and we have to halt our practice of medicine until they catch up.”

You know, it is OK to let old pages break. There is nothing so valuable online today that we have to halt all further progress of the web because of the off chance a page won’t be viewable in a modern browser. If it were truly that valuable, it wouldn’t be that vulnerable.

Leaving aside vapid, sexist twaddles such as, Mmhmm. All you smug idealists are laughing at this newbie/idjit. The consumer is not an idiot. She’s your wife. So stop laughing (speaking of which, it doesn’t matter where the quote arises, Joel, only your use of it to prove a point), Spolsky’s whole pitch is basically a race for the bottom. Crap has happened in the past, and therefore we should continue supporting crap in the future. Not only support old crap, but encourage new crap because, frankly, people are too stupid to learn how to do things right. She’s your wife, indeed.

In response to Spolsky’s writing, Sam Ruby wrote, If people want web browsers that work with actual web sites, they still have three choices. Three good, solid choices, created by three organizations populated by people who don’t believe we have to be stuck with muscle cars, unicorns, rainbows, and ponies forever.

*Do scroll down the page and look at the comment annotating the page view counter.

Categories
Web

Up Down browsers

A new beta version of Firefox is out. Chances are if you’re running beta 3, you already received a notice of beta 4. The new release has done interesting things with the toolbar. Unfortunately, it may have some roughness with SVG embedded using the object element. We’ll see.

On the down side, Microsoft’s new IE8 beta does not work with the Netflix Watch Now feature, regardless of whether you’re emulating IE7 or not. It’s that whole modifying the underlying operating system thing. Netflix keeps wanting to upgrade the movie object, and the upgrade keeps failing. You have to de-install IE8 to get the Netflix Watch Now feature to work.

More time to test, I guess.