mwbot-ts - v1.2.7
    Preparing search index...

    Interface Tag

    Object that holds information about an HTML tag, parsed from wikitext.

    This object is returned by Wikitext.parseTags.

    interface Tag {
        children: Set<number>;
        content: null | string;
        end: string;
        endIndex: number;
        index: number;
        name: string;
        nestLevel: number;
        parent: null | number;
        selfClosing: boolean;
        skip: boolean;
        start: string;
        startIndex: number;
        unclosed: boolean;
        void: boolean;
        get text(): string;
    }
    Index

    Properties

    children: Set<number>

    The indices of the child Tag objects within the parseTags result array.

    content: null | string

    The innerHTML of the tag. May be null if this is a void tag.

    end: string

    The end tag.

    Be aware of the following cases:

    • If this tag is a void tag, this property is an empty string.
    • If this tag is unclosed even though it should be closed, this property is the expected end tag.
    endIndex: number

    The index at which this tag ends in the wikitext.

    index: number

    The index of this Tag object within the result array returned by parseTags.

    name: string

    The name of the tag (e.g. 'div' for <div></div>). Comment tags (i.e. <!-- -->) are named '!--'.

    nestLevel: number

    The nesting level of this tag. 0 if not nested within another tag.

    parent: null | number

    The index of the parent Tag object within the parseTags result array, or null if there is no parent.

    selfClosing: boolean

    Whether this tag is a self-closing tag (which is invalid in HTML).

    skip: boolean

    Whether the tag appears inside an HTML tag specified in SkipTags.

    start: string

    The start tag.

    startIndex: number

    The index at which this tag starts in the wikitext.

    unclosed: boolean

    Whether this tag is properly closed.

    Note that void tags have this property set to false because they do not need to be closed.

    void: boolean

    Whether this tag is a void tag.

    See MDN Web Docs for a list of void elements.

    Accessors