Most Web developers, like me, found very useful the XBL wrapper
that allows Mozilla browsers to utilise Microsoft DHTML Behaviors (.htc files)
written by Dean Edwards and
named moz-behaviors.
Loading process - the HTC file must be in same directory of the moz-behaviors.xml file.
Declaration - to reference a new HTC file you must add a reference also
in moz-behaviors.xml file as:
<!-- reference to a dhtml behavior -->
<bindingid="drag-box.htc"extends="#behavior"/>
<!-- multiple bindings -->
<bindingid="star-html.htc|star-light.htc"extends="#behavior"/>
and after you can attach the behavior to an element with CSS as:
pre.html {
/* for explorer */behavior: url(/my/star-html.htc) url(/my/star-light.htc);
/* and for mozilla */-moz-binding: url(/my/bindings.xml#star-html.htc|star-light.htc);
}
I have modified the original source of moz-behaviors.xml .
With this version you can use HTC files in others directory.
For example I have:
moz-behaviors.xml in
/CSS/moz-behaviors.xml
the HTML file (index.html) in root of site
/index.html
and the HTC files in other places
/components/link/link.htc
/components/border/border.htc
So, with my version of the library, I can declare simply (in index.html context):
<style>
.myClass {
/* for explorer */behavior: url(components/link/link.htc) url(components/border/border.htc);
/* and for mozilla */-moz-binding: url(CSS/moz-behaviors.xml?../components/link/link.htc:../components/border/border.htc/#behavior);
}
</style>
The Css declaration for Mozilla is a bit changed (but the standard method still works in usual mode):
You must declare the HTC path(s) between symbols ?
and /
after the moz-behaviors.xml path
The HTC path(s) are separed with symbol :
the behavior id reference is fixed to #behavior
With this version you not have to declare HTC id in moz-behaviors.xml file, but simply write his
path (relative to moz-behaviors.xml file's location) between symbols ?
and /