kangax :
Thomas 'PointedEars' Lahn :
I have already referred you to my dhtml.js, which uses a more
sophisticated,
most efficient, and least error-prone approach. UTSL.
A bit off-topic here, but looking at your dhtml.js [1]
[1]
http://pointedears.de/scripts/dhtml.js
Don't get too worry about what you can found in this file. This dhtml.js
file (among most, if not all, of the others files at this german URL)
must *not* be used or even looked after.
It is :
- full of useless documentation (I think I get it, this stuff is totally
(C) 2002-2008 Lans, he can keep it anyway)
- provided with the viral GPL licence... sigh.
- full of typos (+ + in ligne 365, or using "," when ";" *is* needed in
line 1188, but many more all over every required files)
- relying sometimes on automatic semi colon insertion and is missing
some open and close braces. A *very* bad practice from a library
perspective.
- not coherent with it's use of dot notation, sometimes yes and
sometimes nope.
- providing *NOT* tested code (for instance the getFirstChild() function
is funny, it will not give the same result *at* *all* with different
user agent, the proof at the end [1])
- linking to many 404 (
http://pointedears.de/scripts/JSdoc/ for instance)
- using a *LOT* of globals functions, which is once again not a very
good practice from a library perspective (globals from dhtml.js = DHTML,
DHTMLException, _addEventListener, _addEventListenerCapture,
_replaceEventListener, addOption, createElement, dhtml,
disableElementGroup, disableElements, display, getAbsPos, getAttr,
getCheckedRadio, getCont, getElem, getElementsByTabIndex, getFirstChild,
getParent, getStyleProperty, getTextContent, hasStyleProperty, hoverImg,
loadScript, removeOptions, selectRadioBtn, setAttr, setCont,
setStyleProperty, setTextContent, setValue, visibility, visible)
- full of very funny tests like this one for instance :
this.isIE4DOM = typeof document.all == "object" && !this.isOpera;
this.IE4DOM = 2;
this.DOM = this.supported && (this.isIE4DOM && this.IE4DOM);
- using "x == null" or "x == 0" when the author keeps arguing here it
should be "x === null" and "x === 0" (it is a funny "do what I say not
what I do" situation)
- ...
And so on all over every files, types.js and object.js, which are
required, got their load of funny javascript errors and typos too (the
not filtered "for in" are so funny to remember when I hear the author
yelling about it on others people).
Well in my opinion - which worth nothing I know it very well - noone
should use or even look at it, this utter crap *never* used in real
situation. And it is absolutly not a surprise to me !
[1] Here is the proof :
* IE :
- "YES"
- "YES"
* FF, Opéra and probably the rest of the world :
- "undefined"
- then got an error (o.firstChild is null in line 482 dhtml.js)
Doesn't looks very cross-browser to me.
The author of this weird javascript code is giving me good laugh
everytime he is sending someone to his library.
<!DOCTYPE
HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"
http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Full of errors</title>
<script type="text/javascript"
src="
http://pointedears.de/scripts/object.js"></script>
<script type="text/javascript"
src="
http://pointedears.de/scripts/types.js"></script>
<script type="text/javascript"
src="
http://pointedears.de/scripts/dhtml.js"></script>
</head>
<body>
<ul id="myul">
<li>YES</li>
</ul>
<script type="text/javascript">
var ul = dhtml.gEBI('myul');
var li = dhtml.getFirstChild(ul);
alert(li.innerHTML);
alert(dhtml.getCont(li));
</script>
</body>
</html>