2.3.3.9 literalContent

Quirks Mode, IE7 Mode, IE8 Mode, and IE9 Mode (All Versions)

String that specifies whether the content contained within the custom element it is to be treated as a data island. Although the HTC may still treat any content as a data island, literal content is not automatically parsed and rendered in the primary document. This attribute is only valid when the HTC defines an element behavior, which requires the use of the tagName attribute.

The literalContent attribute can contain one of the following values:

  • false – Text and markup within the custom element is parsed and rendered normally.

  • true – Content within the first opening and first closing tags of the element defined by tagName is treated as a data island.

  • nested – Content between the first opening and last closing tags of the element defined by tagName is treated as a data island. This mode allows custom tags to be nested in the primary document but requires the HTC to import the custom element namespace.

The following example demonstrates how to read nested literal content in an HTC. First, the HTC imports the myns:mytag custom element into a viewlink, then it sets the body of the component from literal content of the master element.

 <HTML XMLNS:myns>
    <HEAD>
       <?import namespace="myns" implementation="mytag"/>
    </HEAD>
    <PUBLIC:COMPONENT TAGNAME="mytag" LITERALCONTENT="nested">
       <PUBLIC:DEFAULTS VIEWLINKCONTENT />
       <PUBLIC:ATTACH EVENT="oncontentready" ONEVENT="main()"/>
    </PUBLIC:COMPONENT>
    <SCRIPT>
       function main()
       {
          document.body.innerHTML = element.innerHTML;
          .
          .
          .
       }
    </SCRIPT>
 </HTML>

The literalContent attribute is declared in markup only.

This attribute is used by the PUBLIC:COMPONENT element.