Skip to main content

Class: GarminChecklistDOMParser<I>

Defined in: src/garminsdk/checklist/GarminChecklistDOMParser.ts:16

A parser of Garmin checklist definitions from DOM elements.

Extends

  • ChecklistDOMParser<I>

Type Parameters

Type ParameterDefault typeDescription
I extends GarminChecklistItemTypeDefMapGarminChecklistItemTypeDefMapA map from checklist item types to checklist item definitions to which the definitions parsed by the parser conform. Defaults to GarminChecklistItemTypeDefMap. Subclasses that parse item definitions that do not conform to the default map should override this type parameter as appropriate.

Constructors

Constructor

new GarminChecklistDOMParser<I>(): GarminChecklistDOMParser<I>

Returns

GarminChecklistDOMParser<I>

Inherited from

ChecklistDOMParser<I>.constructor

Methods

protected auditBranchItemLinks(set, group, list, branch, item, options): void

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:704

Audits links contained in a parsed branch checklist item definition.

Parameters

ParameterTypeDescription
setChecklistSetDef<I>The set containing the group to audit.
groupChecklistGroupDef<I>The group containing the item to audit.
listChecklistListDef<I>The list containing the item to audit.
branchundefined | ChecklistBranchDef<I, unknown>The branch containing the item to audit, or undefined if the item is not in a branch.
itemI[Branch]The item to audit.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

void

Inherited from

ChecklistDOMParser.auditBranchItemLinks


auditLinkItemTarget()

protected auditLinkItemTarget(set, group, list, branch, item, options): void

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:729

Audits links contained in a parsed link checklist item definition.

Parameters

ParameterTypeDescription
setChecklistSetDef<I>The set containing the group to audit.
groupChecklistGroupDef<I>The group containing the item to audit.
listChecklistListDef<I>The list containing the item to audit.
branchundefined | ChecklistBranchDef<I, unknown>The branch containing the item to audit, or undefined if the item is not in a branch.
itemI[Link]The item to audit.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

void

Inherited from

ChecklistDOMParser.auditLinkItemTarget


auditLinksInGroup()

protected auditLinksInGroup(set, group, options): void

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:638

Audits links contained in a parsed checklist group definition.

Parameters

ParameterTypeDescription
setChecklistSetDef<I>The set containing the group to audit.
groupChecklistGroupDef<I>The group to audit.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

void

Inherited from

ChecklistDOMParser.auditLinksInGroup


auditLinksInItem()

protected auditLinksInItem(set, group, list, branch, item, options): void

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:677

Audits links contained in a parsed checklist item definition.

Parameters

ParameterTypeDescription
setChecklistSetDef<I>The set containing the group to audit.
groupChecklistGroupDef<I>The group containing the item to audit.
listChecklistListDef<I>The list containing the item to audit.
branchundefined | ChecklistBranchDef<I, unknown>The branch containing the item to audit, or undefined if the item is not in a branch.
itemChecklistItemDef<I>The item to audit.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

void

Inherited from

ChecklistDOMParser.auditLinksInItem


auditLinksInList()

protected auditLinksInList(set, group, list, options): void

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:651

Audits links contained in a parsed checklist list definition.

Parameters

ParameterTypeDescription
setChecklistSetDef<I>The set containing the group to audit.
groupChecklistGroupDef<I>The group containing the list to audit.
listChecklistListDef<I>The list to audit.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

void

Inherited from

ChecklistDOMParser.auditLinksInList


auditLinksInSet()

protected auditLinksInSet(set, options): void

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:626

Audits links contained in a parsed checklist set definition.

Parameters

ParameterTypeDescription
setChecklistSetDef<I>The set to audit.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

void

Inherited from

ChecklistDOMParser.auditLinksInSet


parse()

Call Signature

parse(element): ChecklistSetDef<I>

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:147

Parses the checklist set definition specified by a DOM element.

Parameters
ParameterTypeDescription
elementElementThe element to parse.
Returns

ChecklistSetDef<I>

The checklist set definition parsed from the specified element.

Throws

Error if the parsing operation encounters an unrecoverable syntax error or if the errorInsteadOfDiscard option is enabled and the operation encounters a syntax error that would normally cause a definition to be discarded.

Inherited from

ChecklistDOMParser.parse

Call Signature

parse<O>(element, options): ChecklistSetDef<I, TypeOfParseOptionsSetMetadata<O>, TypeOfParseOptionsGroupMetadata<O>, TypeOfParseOptionsListMetadata<O>, TypeOfParseOptionsBranchMetadata<O>>

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:159

Parses the checklist set definition specified by a DOM element.

Type Parameters
Type Parameter
O extends ChecklistDOMParserParseOptions<I, any, any, any, any>
Parameters
ParameterTypeDescription
elementElementThe element to parse.
optionsReadonly<O>Options to apply to the parsing operation.
Returns

ChecklistSetDef<I, TypeOfParseOptionsSetMetadata<O>, TypeOfParseOptionsGroupMetadata<O>, TypeOfParseOptionsListMetadata<O>, TypeOfParseOptionsBranchMetadata<O>>

The checklist set definition parsed from the specified element.

Throws

Error if the parsing operation encounters an unrecoverable syntax error or if the errorInsteadOfDiscard option is enabled and the operation encounters a syntax error that would normally cause a definition to be discarded.

Inherited from

ChecklistDOMParser.parse


parseActionableItemDef()

protected parseActionableItemDef(element, groupName, listName, branchName, options): undefined | I[Actionable]

Defined in: src/garminsdk/checklist/GarminChecklistDOMParser.ts:164

Parameters

ParameterType
elementElement
groupNamestring
listNamestring
branchNameundefined | string
optionsChecklistDOMParseOptionsToUse<I>

Returns

undefined | I[Actionable]

Inherit Doc

Overrides

ChecklistDOMParser.parseActionableItemDef


parseAutoBranchItemLinkItemDefs()

protected parseAutoBranchItemLinkItemDefs(parentItemElement, parentItem, groupName, listName, branchName, options): undefined | GarminChecklistBranchItemLinkItemDef[]

Defined in: src/garminsdk/checklist/GarminChecklistDOMParser.ts:61

Parses automatically generated branch item link item definitions from a parent branch item definition.

Parameters

ParameterTypeDescription
parentItemElementElementThe DOM element from which the parent branch item definition was parsed.
parentItemI[Branch]The parent branch item definition.
groupNamestringThe name of the checklist group for which the link items are to be parsed.
listNamestringThe name of the checklist list for which the link items are to be parsed.
branchNameundefined | stringThe name of the checklist branch for which the link items are to be parsed.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

undefined | GarminChecklistBranchItemLinkItemDef[]

The automatically generated branch item link checklist item definitions parsed from the specified parent branch item, or undefined none could be parsed.


parseBranchDef()

protected parseBranchDef(element, groupName, listName, options): undefined | ChecklistBranchDef<I, unknown>

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:291

Parses a checklist branch definition from a DOM element.

Parameters

ParameterTypeDescription
elementElementThe element to parse.
groupNamestringThe name of the checklist group for which the branch is to be parsed.
listNamestringThe name of the checklist list for which the branch is to be parsed.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

undefined | ChecklistBranchDef<I, unknown>

The checklist branch definition parsed from the specified element, or undefined if the definition was discarded.

Inherited from

ChecklistDOMParser.parseBranchDef


parseBranchItemDef()

protected parseBranchItemDef(element, groupName, listName, branchName, options): undefined | I[Branch]

Defined in: src/garminsdk/checklist/GarminChecklistDOMParser.ts:198

Parameters

ParameterType
elementElement
groupNamestring
listNamestring
branchNameundefined | string
optionsChecklistDOMParseOptionsToUse<I>

Returns

undefined | I[Branch]

Inherit Doc

Overrides

ChecklistDOMParser.parseBranchItemDef


parseBranchItemLinkItemDef()

protected parseBranchItemLinkItemDef(element, groupName, listName, branchName, options): undefined | GarminChecklistBranchItemLinkItemDef

Defined in: src/garminsdk/checklist/GarminChecklistDOMParser.ts:369

Parses a branch item link checklist item definition from a DOM element.

Parameters

ParameterTypeDescription
elementElementThe element to parse.
groupNamestringThe name of the checklist group for which the item is to be parsed.
listNamestringThe name of the checklist list for which the item is to be parsed.
branchNameundefined | stringThe name of the checklist branch for which the item is to be parsed.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

undefined | GarminChecklistBranchItemLinkItemDef

The branch item link checklist item definition parsed from the specified element, or undefined if the definition was discarded.


parseGroupDef()

protected parseGroupDef(element, options): undefined | ChecklistGroupDef<I, unknown, unknown, unknown>

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:208

Parses a checklist group definition from a DOM element.

Parameters

ParameterTypeDescription
elementElementThe element to parse.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

undefined | ChecklistGroupDef<I, unknown, unknown, unknown>

The checklist group definition parsed from the specified element, or undefined if the definition was discarded.

Inherited from

ChecklistDOMParser.parseGroupDef


parseItemDef()

protected parseItemDef(element, groupName, listName, branchName, options): undefined | ChecklistItemDef<I>

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:359

Parses a checklist item definition from a DOM element.

Parameters

ParameterTypeDescription
elementElementThe element to parse.
groupNamestringThe name of the checklist group for which the item is to be parsed.
listNamestringThe name of the checklist list for which the item is to be parsed.
branchNameundefined | stringThe name of the checklist branch for which the item is to be parsed.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

undefined | ChecklistItemDef<I>

The checklist item definition parsed from the specified element, or undefined if the definition was discarded.

Inherited from

ChecklistDOMParser.parseItemDef


parseItemDefArray()

protected parseItemDefArray(element, groupName, listName, branchName, options): ChecklistItemDef<I>[]

Defined in: src/garminsdk/checklist/GarminChecklistDOMParser.ts:18

Parameters

ParameterType
elementElement
groupNamestring
listNamestring
branchNameundefined | string
optionsChecklistDOMParseOptionsToUse<I>

Returns

ChecklistItemDef<I>[]

Inherit Doc

Overrides

ChecklistDOMParser.parseItemDefArray


parseLinkItemDef()

protected parseLinkItemDef(element, groupName, listName, branchName, options): undefined | I[Link]

Defined in: src/garminsdk/checklist/GarminChecklistDOMParser.ts:277

Parameters

ParameterType
elementElement
groupNamestring
listNamestring
branchNameundefined | string
optionsChecklistDOMParseOptionsToUse<I>

Returns

undefined | I[Link]

Inherit Doc

Overrides

ChecklistDOMParser.parseLinkItemDef


parseListDef()

protected parseListDef(element, groupName, options): undefined | ChecklistListDef<I, unknown, unknown>

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:246

Parses a checklist list definition from a DOM element.

Parameters

ParameterTypeDescription
elementElementThe element to parse.
groupNamestringThe name of the checklist group for which the list is to be parsed.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

undefined | ChecklistListDef<I, unknown, unknown>

The checklist list definition parsed from the specified element, or undefined if the definition was discarded.

Inherited from

ChecklistDOMParser.parseListDef


parseNormalLinkItemDef()

protected parseNormalLinkItemDef(element, groupName, listName, branchName, options): undefined | GarminChecklistNormalLinkItemDef

Defined in: src/garminsdk/checklist/GarminChecklistDOMParser.ts:307

Parses a normal link checklist item definition from a DOM element.

Parameters

ParameterTypeDescription
elementElementThe element to parse.
groupNamestringThe name of the checklist group for which the item is to be parsed.
listNamestringThe name of the checklist list for which the item is to be parsed.
branchNameundefined | stringThe name of the checklist branch for which the item is to be parsed.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

undefined | GarminChecklistNormalLinkItemDef

The normal link checklist item definition parsed from the specified element, or undefined if the definition was discarded.


parseNoteItemDef()

protected parseNoteItemDef(element, groupName, listName, branchName, options): undefined | I[Note]

Defined in: src/garminsdk/checklist/GarminChecklistDOMParser.ts:405

Parameters

ParameterType
elementElement
groupNamestring
listNamestring
branchNameundefined | string
optionsChecklistDOMParseOptionsToUse<I>

Returns

undefined | I[Note]

Inherit Doc

Overrides

ChecklistDOMParser.parseNoteItemDef


parseSpacerItemDef()

protected parseSpacerItemDef(element, groupName, listName, branchName, options): undefined | I[Spacer]

Defined in: src/garminsdk/checklist/GarminChecklistDOMParser.ts:491

Parameters

ParameterType
elementElement
groupNamestring
listNamestring
branchNameundefined | string
optionsChecklistDOMParseOptionsToUse<I>

Returns

undefined | I[Spacer]

Inherit Doc

Overrides

ChecklistDOMParser.parseSpacerItemDef


parseTitleItemDef()

protected parseTitleItemDef(element, groupName, listName, branchName, options): undefined | I[Title]

Defined in: src/garminsdk/checklist/GarminChecklistDOMParser.ts:457

Parameters

ParameterType
elementElement
groupNamestring
listNamestring
branchNameundefined | string
optionsChecklistDOMParseOptionsToUse<I>

Returns

undefined | I[Title]

Inherit Doc

Overrides

ChecklistDOMParser.parseTitleItemDef


resolveAndValidateBranchItemLinkItemDef()

protected resolveAndValidateBranchItemLinkItemDef(itemArray, item, groupName, listName, branchName, options): undefined | GarminChecklistBranchItemLinkItemDef

Defined in: src/garminsdk/checklist/GarminChecklistDOMParser.ts:110

Resolves and validates a branch item link checklist item definition. First, the item definitions preceding the item to resolve and validate will be checked to ensure that the latter is not separated from its parent branch item by any items that are not another branch item link item. Then, the item's specified parent branch item UID will be compared to the actual UID of the candidate parent branch item to ensure they match. If the item does not specify a parent branch item UID, then it will be assigned the UID of the candidate parent. Next, the item's link index will be compared to the parent branch item's linked branch array to ensure the index is not out of bounds. Finally, the item's link target UID will be resolved from the parent branch item's linked branch array.

Parameters

ParameterTypeDescription
itemArrayreadonly ChecklistItemDef<I>[]An array of item definitions that precede the item to resolve and validate.
itemGarminChecklistBranchItemLinkItemDefThe item definition to resolve and validate.
groupNamestringThe name of the checklist group for which the item is to be resolved and validated.
listNamestringThe name of the checklist list for which the item is to be resolved and validated.
branchNameundefined | stringThe name of the checklist branch for which the item is to be resolved and validated.
optionsChecklistDOMParseOptionsToUse<I>The options to use when parsing.

Returns

undefined | GarminChecklistBranchItemLinkItemDef

The resolved and validated branch item link checklist item definition, or undefined if the definition could not be resolved or validated.


tryParseTextAsJSON()

static tryParseTextAsJSON(text): string

Defined in: src/sdk/checklist/ChecklistDOMParser.ts:775

Attempts to parse a text string as a JSON-formatted string.

Parameters

ParameterTypeDescription
textstringThe text string to parse.

Returns

string

The string parsed from the text string, or the original text string if it did not encode a JSON-formatted string.

Inherited from

ChecklistDOMParser.tryParseTextAsJSON