W3C home > Mailing lists > Public > www-dom@w3.org > July to September 1998

Efficient read-only cloning?

From: <keshlam@us.ibm.com>
Date: Tue, 22 Sep 1998 13:47:49 -0400
To: www-dom@w3.org
Message-ID: <85256687.005FC86F.00@us.ibm.com>
EntityReference is supposed to (appear to) contain a read-only copy of the
data stored in the Entity. I'm looking for a more elegant method of
achieving that.

The alternatives I've looked at are:

1) Store the Entity's children as read-only, and preserve that when they
get cloned into the EntityReference. Works, but makes editing them a bit
awkward in tools which permit manipulation of both the DTD and the

2) Have EntityReference's replicate-entity-contents code do an additional
walk over the cloned subtree to set this flag. Works, but requires that the
subtrees be walked twice -- once to clone, and again to set them readonly.

3) Add a "boolean makeReadOnly" parameter to cloneNode() which sets this
flag during the same tree-walk that copies everything else. Works, but
would have to be made part of the official DOM API since otherwise
applications that subclass the DOM wouldn't know that they had to patch
this version of cloneNode() to support their added fields.

Of those three, I'm most attracted by the third; it's easy, fast, and might
be useful in other situations where readonly nodes were desired. But I
suspect it's too late to lobby for this to be included in DOM Level 1...?

Joe Kesselman  / IBM Research
Unless stated otherwise, all opinions are solely those of the author.
Received on Tuesday, 22 September 1998 12:54:56 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 20 October 2015 10:46:04 UTC