.isTag()

Method to check whether a token is an XML/XHTML tag. You can use this method as a replacement for the RoboHelp.TagType constant. The RoboHelp.TagType constand only supports a limited number of tags. This method supports every possible tag.

The method .isTag() is located in the file token.jsxinc.

Usage

To check whether a token is a tag, regardless of the tag:

if(token.isTag())
  //Do something if this is tag

To check for a specific tag:

if(token.isTag("p"))
  //Do something if this is a paragraph start tag

To check for an array of specific tags:

//The second tag is an end paragraph tag: </p> in short.
var tags = new Array("p", "/p", "img");
if(token.isTag(tags))
   //Do something if this is one of the tags specified in the array tags

Note: When you check for a specific tag, specify only the name of the tag such as: p, img, etcetera. When you want to check for an end tag, specify only the backslash with the tag name: /p and /body.

Parameters

Parameter Data type Required Description
Tag String or Array with strings   The name of a node ar an array with node names. If omitted the method only checks that the token is a tag.
casesensitive Boolean   If set to true, the tag name comparison is case sensitive. Default is false.

Return values

Value Meaning
null The method encountered an error.
true The token is one of the specified tags.
false The token is not one of the specified tags.