Skip navigation.

Claws, fangs, fur...

...the bear essentials

Posts tagged with "html5"

Canvas image cut-off problem solved

, , , ...

Those of you who were curious enough to look at the preview of my Canvas Composition Studio over on Pantheonline.com, know that it suffered from having its composition images cropped in size. The cut-off seemed an arbitrary 300px wide by 150px high.

Together with an odd ghosting problem in Opera I spent a good year testing and trying. Not continuously, but on and off.

And I found the solution to the cut-off problem.

Hidden within the stack of the function calls, I managed to forget specifying a width and a height for the HTMLCanvasElements created in the library functions. I did specify every other width and height... from the recipient HTMLDivElement all the way down to the library functions' drawing algorythms.

In the current version of the draft specification for HTML5, the HTMLCanvasElement does define a width and height property, specifying that an implementation should default those dimensions to 300px by 150px, in case the author fails to supply them.

Problem solved. Expect an update of the preview pretty soon.

The long wait for Audio and Video support

, , ,

Competition's got it. HTML5's Audio and Video elements. Browser: Firefox 3.5, Safari 4, Google Chrome 3.

Great for me and my web sites... where we've chosen to implement these elements over the more traditional objects and embeds...

but not great for commercial companies that generate profit from publishing multimedia.

Why? Because no other browser supports Audio and Video yet.


Thank you, Microsoft and Opera.


(Wait... doesn't Opera claim support? No... Opera's Presto offers support in experimental builds only. Hop on over to my music publishing site and see for yourself.)

Public preview of canvas implementation available

, , , ...

For the Pantheon Online Games site we have created an Altar Dress-Up application. You may have read about this in my previous blog post.

This application is now up for public preview. It heavily uses the new Canvas element that will be part of HTML5, and requires the use of Javascript. People using browsers that either have Javascript turned off or do not understand the Canvas element, are out of luck.

One eerie thing I found: all modern popular browsers know the Canvas element except for Microsoft's attempt at a web browser... but even though it does not know how to handle a Canvas element, it has no qualms creating one using Javascript methods. That makes my fall-back content rather useless... Choose, Microsoft, choose! You either know it, or you don't!

Edited to add another eerie thing I found: Opera 10.0 Alpha (yes... Alpha) duplicates the canvas displays. The duplicates are offset by a handful pixels. Sometimes the duplicates move, too, when other stuff is being moved around.

Edited to add an o.O.: the canvas ghosting seems to occur in several versions of Opera. We haven't heard the last of this problem!

HTML5 and other unknown elements for non-HTML5-browsers

, , , ...

Just to see whether I could make sense of the specification-in-progress, I decided to create HTML5-versions of several of the pages in my website, including its homepage. Conclusion: it's feasable, but I'm sure less experienced web authors could use a "Web Authors' Guide to HTML5" (yup, this counts as prior art p: ).

I proceeded to testing how web browsers by various manufacturors displayed that HTML5-page. The results:
  • Opera 9.27: pass
  • Safari 3.1: pass
  • Firefox 3 (latest nightly build): pass
  • Firefox 2: fail
  • Internet Explorer 7: fail


Haven't tried it in MSIE8 yet... I'm part of the feedback program but I didn't want to risk having that beta application wreaking havoc on my system.

Now what's interesting about that list?

Wait, what? Opera 9.27? Does it know HTML5? It may have some basic understanding but I doubt Opera implemented the entire spec... if only because the spec is being developed as we speak. So how can it pass this test? And how is it that Firefox 2 and Microsoft's excuse for a browser fail?

My best guess: it's because of the way browsers handle unknown elements.

Huh?

Point in case: HTML5 has a SECTION element. With it, an author can divide just about any part of the body in, you guessed it, sections. How should such a section be rendered? Should it be a block? A table row? A floating square? The specification doesn't say... it leaves that directive to CSS.

So what should a browser do, when running into an element it doesn't recognise? It could simply ignore the element... but none of the current major browsers chose that option. Bravely, they try their best at displaying it anyway.

With one major difference:

where some browsers (Opera 9, Safari 3, Firefox 3) display the unknown element and apply CSS and javascript rules to that element as provided by the author, some others (Internet Explorer 7, Firefox 2) display the unknown element bare, meaning without CSS and / or without javascript.

Why? Is it a strategic management decision? Is it developer short-sightedness? Is it a technical difficulty? And if so, in what part of the browser? In the HTML-parser, or in the CSS-parser, or in the javascript parser? In all 3? Somewhere else?

It can't be a technical difficulty. After all, all of the tested browsers can handle XML and do render CSS on XML documents... and XML by definition is riddled with unknown elements.

It shouldn't be a CSS-parser problem, as the CSS that I wrote isn't all that difficult and does work when applied to known elements.

It shouldn't be an HTML-parser problem, as all of the tested browsers are well-adept at handling TAG SOUP, especially Internet Explorer (yay, history!).

So that leaves... that leaves a browser trying to render TAG SOUP using standards-compliant render-mode for a doctype that has no DTD where one is expected. It is one thing to have NO doctype, as is the case with many XML documents. It is quite another, to have a document that claims to have a doctype and then breaks the rules by providing neither a public nor a system identifier... which is normal for HTML5, but not for HTML4 nor the XHTMLs.

So unless a browser is instructed to handle such cases, it will behave in unexpected ways. If anything, the fact that both Internet Explorer 7 and Firefox 2 do display the unknown elements shows that the developers did expect some unexpected authoring and made sure their browsers wouldn't crash, which is quite commendable. That makes the fail largely a strategic management decision.

Conclusion: Microsoft's flagship browser and Firefox 2 don't necessarily fail at HTML5... they simply fail at handling unrecognised doctypes altogether.
Download Opera, the fastest and most secure browser