From: Robert R. <rai...@us...> - 2000-10-28 20:04:56
|
If we choose to set the children array to null, then maybe we should have an function hasChildren() that returns a boolean. Later, Robert <rai...@us...> > So I've posted a patch for DynLayer and DynDocument that assigns the > this.children array only when you use addChild. DynLayer-based widgets > won't have a children array until you add at least one child. > > I also made changes to removeChild, removeAllChildren, etc. that check for > the existence of the child array before proceeding. > > This should ensure that the children array is a unique object for each > widget, and not the common one in the Widget prototype. Then you can safely > use WidgetX to simulate inheritance without the shared-properties problem. > > The only consideration is if you build a widget that manipulates the > children array, you should test it it exists first (it's initially set to > null until you use addChild). > > I've only tested it on a few IBS and GUI widgets, but it seems to work > across the board. I've posted the patch for review. > > scottandrew |