Ari Krupnik wrote:
> I have a bunch of functions that provide XPath-style navigation of the
> DOM. Functions like followingSibling(node, predicate) that find the
> closest sibling in document order for which the function 'predicate'
> returns true. Also functions like textValue(node) that concatenates
> all character data within a node. Most of these are not specific to
> Element, e.g. textValue() of TextNode is its nodeValue. I wanted to
> make these functions methods of Node so I could call them as
> node.textValue() instead of textValue(node).
>
> It's not that big of a deal. Thanks for explaining the difference
> between String and Node to me.
You are welcome
In relevance to your original question you may indeed go for behavior
(please note that in this case US English spelling is implied because
it's the personal method name, not just a dictionary entry). As it's an
early mosning and I'm going to sleep now, I grapped the first .htc file
I found on my disk, just to explain the concept. By Murphy law it
happened to be the ugliest ill-formed crap from tmp dumps

But it
seems working for IE up to level to show what do I mean.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<style type="text/css">
body * {
behavior: url(hover.htc);
}
</style>
</head>
<body>
<p>P</p>
<address>ADDRESS</address>
<div>DIV</div>
</body>
</html
Where hover.htc is:
<PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="Hilite()" />
<PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="Restore()" />
<SCRIPT LANGUAGE="JScript">
function Hilite() {
if (event.srcElement == element) {
innerHTML = "Mouse is OVER me";
}
}
function Restore() {
if (event.srcElement == element) {
innerHTML = "Mouse is OUT of me";
}
}
</SCRIPT>
Now each and every HTML element on your page became mouse listener by
default (hover to see it).