Share via


Template.extractChild property

Gets a value that specifies whether templates should be instantiated without the creation of an additional child element. Note that not all controls use this property; see the Remarks section for more info.

Syntax

<div 
    data-win-control="WinJS.Binding.Template" 
    data-win-options="{ extractChild : value}" >
</div>
var extractChild = template.extractChild;
template.extractChild = extractChild;

Property value

Type: Boolean

true if the template uses its first child as the container element; false if the template generates an additional container element. The default value is false.

Remarks

By default, templates create a new container div, then add their child elements into the new div. This new div adds a new (often unnecessary) element into the rendered control tree. Setting extractChild to true allows the developer to specify that the first child element of the template control should be the container for the template.

Which controls use the extractChild property?

Not all controls use the extractChild property. Here's a list of how different controls use or don't use it.

Control Processes extractChild?
FlipView Yes. The extractChild property works as expected.
ListView Yes. The extractChild property works as expected.
NavBarContainer No. The NavBarContainer control always behaves as though extractChild is true, regardless of its actual value.
Repeater No. The Repeater control always behaves as though extractChild is true, regardless of its actual value.

 

Requirements

Minimum WinJS version

WinJS 1.0

Namespace

WinJS.Binding

See also

Template