On this Page

    domObj.childNamed

    (Merge only)

    Determine if an object has an immediate child (not further down descendant) of a given name.

    Syntax

    domObj.childNamed(name)

    Returned Value

    The domObj pointer of the child with the supplied name, or  null if no child with that name exists.

    Parameters

    name is a string, which is the name of a, considered by you to be a possible, child of this object.

    Description

    Often, very often, Panes are both not-mandatory and are allowed to occur multiple times. The data will determine how many of those Panes will exist in the _document DOM. The Pane may not exist at all. This function allows you to safely ask, the parent Pane (or other containing object type) whether it has any children of name 'name'.

    Critical Usage

    You must learn to use this function! Often folks try to use the _count property of a possible child Pane to see if it is zero. That will fail. If there are no instances of that child, then trying to refer to a non-existent object's _count property is doomed. Not detectible at compile time. Occurs at runtime, with deadly effect. Protect yourself, and your customers -- use .childNamed("xxxx");

    Example

    Consider the classic situation of a "Details" parent Pane, and an Allow Multiple child Pane, "Detail". On the parent "Details" Pane one might say:

    if (this.childNamed("Detail")) {
    	for (var i=0; i < this.Detail._count; i++) {
    	 	... process each child
    	}
    }

    See Also 

    domObj.ancestor