"sleepinglord" <sh*************@gmail.com> writes:
I'd like to write a class. It can be compatible with DOM's Elements,
that is, can be operated by appendChild, getElementByXXX, etc. How to?
You probably can't.
DOM elements are host objects, i.e., they are provided by the runtime
environment that the Javascript script is running in. They are not bound
by the rules that the objects created by the programmer is.
Objects you create yourself, native objects, will probably not be able
to contain the internal plumbing that allows DOM elements to work as
they do.
If you try to inheirt from a DOM element object (there are no classes
in Javascript, inheritance happens diretly between objects), then it
will loose access to some of the special features of the host object.
Reading might still work, but updating a property will only change it
on the nativ object you created, and not carry through to the DOM
elment below.
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'