PUBLIC:COMPONENT Element

Internet Development Index

Identifies the content of the file as HTML Component (HTC).

What's New for Microsoft® Internet Explorer 6

The literalContent attribute supports nested as a new possible value, which creates a nested literal content element behaviors.

Syntax

<PUBLIC:COMPONENT
    ID = "sID"
    lightWeight = "bLight"
    literalContent = "sLiteral"
    NAME = "sName"
    supportsEditMode = "bEditable"
    tagName = "sTagName"
    URN = "sURN"
>
<!-- child elements -->
</PUBLIC:COMPONENT>

Attributes

ID
Optional. String that uniquely identifies the PUBLIC:COMPONENT element within the component. This attribute is analogous to the ID attribute in Dynamic HTML (DHTML).
lightWeight
Optional. String that specifies whether the HTC file contains markup. If the HTC file contains no markup, this attribute should be set to true to improve rendering performance. This attribute is valid for any HTC file.
trueThe HTC file does not contain markup, so it does not need to be parsed and rendered each time the custom tag, which is defined by the HTC file, is used in the primary document.
falseDefault. HTC contains markup that must be parsed and rendered each time the custom tag, which is defined by the HTC file, is used in the primary document.
literalContent
Optional. String that specifies whether the content contained within the custom tag is parsed and rendered, or if it is to be treated as a data island. This attribute is only valid when the HTC file defines an element behavior, which requires the use of the tagName attribute. See the remarks for more information.
falseDefault. Text and markup within the tag defined by the tagName attribute is not treated as a data island and is parsed and rendered.
nested  Internet Explorer 6 and later versions. Content within the first opening and last closing of the tag defined by the tagName attribute is treated as a data island and is not parsed or rendered. See Using the literalContent Attribute for more information.
trueContent within the first opening and first closing of the tag defined by the tagName attribute is treated as a data island and is not parsed or rendered.
NAME
Optional. String that specifies the name by which the behavior is referred to in the containing document.
supportsEditMode
Optional. String that specifies whether the content within the HTC file is editable. This attribute is valid only when the HTC file defines an element behavior.
trueMarkup contained within the HTC file is editable.
falseDefault. Markup contained within the HTC file is not editable. You can override this value by setting the isContentEditable property to VARIANT_TRUE on each element within the HTC file.
tagName
Optional. String that specifies the name of the custom tag, which is defined in the HTC file and imported into the primary document. This attribute is only valid for an HTC file that defines an element behaviors; see the remarks for more information.
URN
Optional. String, in Uniform Resource Name (URN) format, that uniquely identifies the component. This allows events to be uniquely identified when multiple behaviors may be firing events of the same name. When the event is fired, the event object's srcUrn property is set to the URN of the behavior that fired the event.

Element Information

Child elements
May occur at most oncePUBLIC:DEFAULTS
May occur one or more timesPUBLIC:ATTACH, PUBLIC:EVENT, PUBLIC:METHOD, PUBLIC:PROPERTY
Minimum availabilityInternet Explorer 5
Minimum operating systems Windows 95, Windows NT 4.0

Remarks

The PUBLIC:COMPONENT element is used to define two distinct types of behavior. The first is an attached behavior, which modifies the behavior of an existing element using the behavior Cascading Style Sheets (CSS) attribute. The second type, which was introduced in Internet Explorer 5.5, is called an element behavior. An element behavior is used to define a custom tag, which can be used in a Web page like a standard HTML tag.

An element behavior implies the creation and use of a custom tag in a Web page. Therefore, it is necessary to define the tagName attribute of the PUBLIC:COMPONENT element when the HTC file defines an element behavior. As noted previously, several of the attributes for this element are specifically designed for use with element behaviors. For more information, see Element Behaviors.

The NAME attribute is especially useful when multiple behaviors are attached to an element, as it allows you to invoke the properties or methods of the desired behavior from the containing document. If multiple behaviors are attached to a <SPAN ID="mySpan"> element in a document, you can use the following syntax to set the delay property of the behavior named behaviorABC.

mySpan.behaviorABC.delay = 1000;

See Also

Introduction to DHTML Behaviors, Using HTML Components to Implement DHTML Behaviors in Script, About Element Behaviors, Using the literalContent Attribute