Drew's Blog

The Joys of Technology Explored

Reusable Components: Where The Web Standards Fall Short.

From Scott Galloway:

Reading this post from Stephen Sharrock reminded me about something I often overlook, the phenomenally powerful DHTML behaviours which IE supports using HTC files. The WebService behaviour for instance lets you pull information into your client from aribtrary web services, even without using HTCs, tools like xLoadTree provide the ability to load data straight into the client without forcing a postback.
Before anyone comments, I know these are IE only - to be honest I don't care, when only
3% of users use anything other than IE, it seems a shame to ignore the functional improvements these kind of tools provide.
Now, Mozilla does support it's own version using
XBL and XUL - hopefully some genius will work out a way for mozilla to support full HTC as well...

Scott it could be a good idea to find or to create a page with all the .htc files existing around.

[help.net]

This is one of the main reasons Microsoft needed to create a technology like XAML. It drives me nuts when people ask why they didn't just use XHTML, the DOM, etc. There's zero support for re-usable component technology in those standards! Hacking together scripts that haphazzardly add behavior to existing HTML elements is the only way to do it and man it's a mess.

IE's HTC and Mozilla's XUL/XBL are awesome component technology implementations, it's just too bad there still isn't a standard. :(

Mimeo makes extensive use of DHTML for several portions of its document building process. We invented all sorts of cross-browser component technology hacks when we started, but believe me they suck compared to HTC/XUL. We're a small team, we didn't have the resources to dedicate to “best of” experiences for NS4, IE5.x+ and Mozilla 1.x at the time, so instead we had to cater to the lowest common denominator (NS4... yuck). We're getting ready to overhaul our site and bring it into the new world though, so these are both technologies we'll be spending a lot of time investigating. More difficult today though is figuring out how to write good ASP.NET server controls which emit the proper client code by detecting the browser and ultimately receive the data generated on the client back at the server side.

Part of me just wants to write it as an Avalon smart-client, but uhh... I don't think that would pull in much business over the next 4-10 years. ;)

Update: I did a little research and found some interesting stuff. It appears the HTC spec was submitted to the w3c in 1998. At that time, all the names on the spec were from Microsoft. In 1999 it looks like it became a working draft expanded to what became known as Behavioral Extensions to CSS. This document seems to spell out the specifics of how the behaviors were attached to a particular element or set of elements and even has a Netscape developer on board. This makes me wonder why work stopped there. Sure it wasn't perfect, but... it was a start. It was supported by IE. So why didn't the Mozilla people at least provide an implementation of the working draft? I understand and agree XUL/XBL is better in plenty of ways, but... at least IE already supported HTC and we could have had some form of cross-browser component technology. :(

Comments

DonXML said:

The only problem with being an htc fan is there are so few of us out there, and that we are the only ones that realize that XAML is just the next logical progression of htc. Another sad thing is that element behaviors was submitted to the W3C by Microsoft and Netscape as a note called Behavioral Extensions to CSS (http://www.w3.org/TR/becss ), but nothing was ever done with it at the W3C, although it still is listed as a module on the CSS Roadmap: http://www.w3.org/Style/CSS/current-work

DonXML Demsak
# November 24, 2003 3:04 PM

Drew Marsh said:

Woah Don, that's scary, just as I posted my update you posted your comment about the Behavioral Extensions spec. Great minds think alike. ;P

*sigh* I wish Mozilla at least made an attempt to support the existing spec when they were working on 1.0. I guess Microsoft isn't the only one guilty of going and inventing new technology and not supporting a perfectly valid one already exists. :(
# November 24, 2003 3:10 PM

DonXML said:

It all happened around the time Netscape was bought by AOL, and all the confusion over what AOL was going to do with the browser. I think it may have gotten lost in the Netscape 5.0 version and the switch to the Gecko engine, or something like that.

DonXML Demsak
# November 24, 2003 3:45 PM

Drew Marsh said:

Yeah, I didn't even stop to think about the timing on that. I guess it was right around that time, so you're probably right. What a shame. Now we all suffer.

Personally I prefer the XUL approach much better, so I'm not advocating HTC should have been the end all be all HTML component technology. It just would have been nice to have even rudimentary support across browsers. I wonder if anyone has ever tried to implement HTC support for Mozilla. Hmmm... time to Google.
# November 24, 2003 3:48 PM

Dean Edwards said:

I think I've solved your problem! I've successfully developed a Mozilla wrapper for Microsoft's HTC files. It is encapsulated in a single XBL binding, so is exremely portable. The binding is small (4k) and contains compressed JavaScript code which loads the behavior and applies the interface. The interfaces of some objects have been extended to allow further cross-browser compatibility.

I've only just finished this development. So you are the first to here about it (apart from a few bored friends). I would be delighted if you would take a look and feed back some comments.

For a full working demo (with no browser sniffing), go here:

http://dean.edwards.name/my/examples/moz-behaviors/">http://dean.edwards.name/my/examples/moz-behaviors/

there is some (scant) documentation here:

http://dean.edwards.name/my/

Dean Edwards

dean@edwards.name
# January 14, 2004 7:09 AM

TrackBack said:

# May 24, 2005 9:16 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)