Ahh, I take your point but wouldn't that imply that this should not
work with Gecko based browsers either? Which (unfortunately?) it does!
No, it implies that you should have no expectation of it working with
Gecko browsers, and if it does you should have no expectation of it
continuing to work with Gecko browsers. When it comes to host objects
(which DOM elements are) the ECMA Script specifications don't get
involved so what happens is largely up to the implementers (at least in
the areas not covered by the W3C DOM specifications/recommendations (and
even then only the Core DOM is mandatory)).
If it works with Gecko browsers now then you got lucky. That happens: I
remember a post from someone who wanted to create a cross-frame pop-up
menu and had discovered that creating/appending an absolutely positioned
DIV element in/to the topmost frameset document in one Mozilla release
allowed that DIV to float across frame boundaries, displaying over all
of them. The resulting DOM was invalid as DIVs cannot be children of
FRAMESETs and the attempt should have thrown a HIERARCHY_REQUEST_ERR
exception. The previous versions of Mozilla had not allowed it, and the
subsequent versions did not allow it, so I don't imagine the menu script
he had written using it lasted very long.
Ok, updating my DOM knowledge here. Does this mean that every frame
has got its own DOM or is the DOM still 'defined at browser level'
if you wish and are the frames just nodes in the overall structure?
I was under the impression that the latter is the case.
There are a number of different things that are referred to as DOM
(often incorrectly ), what I am referring to above as "DOM
implementations" are implementations of the W3C Core DOM specification
(which, in web browsers, usually include the W3C HTML DOM and other W3C
standards like events). The W3C DOM specifications *only* cover a -
Document - object and its descendants/content, they say noting about
window/frame/global objects. Web Browsers have an Object Model that
(with a frameset) does represent a hierarchical structure of
window/frame/global objects and those objects each contain a document
object that (more or less, mostly more with modern browsers) implements
the W3C DOM.
In summary: the variable that holds the reference indeed still contains
it. Because 'further down' in the reference part of it is 'linked' to a
'disappearing' document this part becomes 'stuffed up.
I (think) I can follow the reasoning but I'm still not getting the fact
that Gecko is *not* compliant with *this* behaviour.
Actually, should it not be irrelevant how complex a structure is? Either
you loose cit or you don't. the table as a whole is part of the document
so wouldn't it be more logical for it to disappear as a whole and not
just its rows?
This behaviour is outside of any specifications so you are just
experiencing differences in implementations of the browser object model,
the W3C DOM and the garbage collecting system. Nobody is right or wrong
they have just made different decisions about how to implement their
browsers (and probably included different bugs).
But if you are examining the residual structure of elements under the
table only via its - rows - collection then you haven't verified that
the rows are absent, just that the - rows - collection is no longer
working. If you checked - firstChild - you might find that they are
still there. Then again you might find that the rows are gone. It
doesn't matter, once the page in the other frame has unloaded you have
no grounds for expecting a reference to an element in the document from
that frame to be in any way useful.
Ok, couldn't cloneNode be used to basically 'do' this.
I don't think cloneNode is going to help at all as it is a method of the
Node interface and a clone of a Node that belongs to a document will be
a Node that belongs to the same document. only the importNode method of
another document could do the job, and as Lasse pointed out, IE doesn't
support it yet.
On init one just clones the 'skeleton'
On subsequent modification one just clones the required part and
inserts it into the static structure.
IF the above would hold can I than still 'replace' the not required
table coming in on the new page with the 'stored' static one or
would that result in funny behaviour as well.
<snip>
Having used insertNode to clone a Node into a document in frame A for
storage you would then have to use insertNode on the newly loaded
document to put a clone of the stored node into it.
Richard.