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 Parameter | Default type | Description |
---|---|---|
I extends GarminChecklistItemTypeDefMap | GarminChecklistItemTypeDefMap | A 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
auditBranchItemLinks()
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
Parameter | Type | Description |
---|---|---|
set | ChecklistSetDef <I > | The set containing the group to audit. |
group | ChecklistGroupDef <I > | The group containing the item to audit. |
list | ChecklistListDef <I > | The list containing the item to audit. |
branch | undefined | ChecklistBranchDef <I , unknown > | The branch containing the item to audit, or undefined if the item is not in a branch. |
item | I [Branch ] | The item to audit. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
set | ChecklistSetDef <I > | The set containing the group to audit. |
group | ChecklistGroupDef <I > | The group containing the item to audit. |
list | ChecklistListDef <I > | The list containing the item to audit. |
branch | undefined | ChecklistBranchDef <I , unknown > | The branch containing the item to audit, or undefined if the item is not in a branch. |
item | I [Link ] | The item to audit. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
set | ChecklistSetDef <I > | The set containing the group to audit. |
group | ChecklistGroupDef <I > | The group to audit. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
set | ChecklistSetDef <I > | The set containing the group to audit. |
group | ChecklistGroupDef <I > | The group containing the item to audit. |
list | ChecklistListDef <I > | The list containing the item to audit. |
branch | undefined | ChecklistBranchDef <I , unknown > | The branch containing the item to audit, or undefined if the item is not in a branch. |
item | ChecklistItemDef <I > | The item to audit. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
set | ChecklistSetDef <I > | The set containing the group to audit. |
group | ChecklistGroupDef <I > | The group containing the list to audit. |
list | ChecklistListDef <I > | The list to audit. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
set | ChecklistSetDef <I > | The set to audit. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
element | Element | The 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
Parameter | Type | Description |
---|---|---|
element | Element | The element to parse. |
options | Readonly <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
Parameter | Type |
---|---|
element | Element |
groupName | string |
listName | string |
branchName | undefined | string |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
parentItemElement | Element | The DOM element from which the parent branch item definition was parsed. |
parentItem | I [Branch ] | The parent branch item definition. |
groupName | string | The name of the checklist group for which the link items are to be parsed. |
listName | string | The name of the checklist list for which the link items are to be parsed. |
branchName | undefined | string | The name of the checklist branch for which the link items are to be parsed. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
element | Element | The element to parse. |
groupName | string | The name of the checklist group for which the branch is to be parsed. |
listName | string | The name of the checklist list for which the branch is to be parsed. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type |
---|---|
element | Element |
groupName | string |
listName | string |
branchName | undefined | string |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
element | Element | The element to parse. |
groupName | string | The name of the checklist group for which the item is to be parsed. |
listName | string | The name of the checklist list for which the item is to be parsed. |
branchName | undefined | string | The name of the checklist branch for which the item is to be parsed. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
element | Element | The element to parse. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
element | Element | The element to parse. |
groupName | string | The name of the checklist group for which the item is to be parsed. |
listName | string | The name of the checklist list for which the item is to be parsed. |
branchName | undefined | string | The name of the checklist branch for which the item is to be parsed. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type |
---|---|
element | Element |
groupName | string |
listName | string |
branchName | undefined | string |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type |
---|---|
element | Element |
groupName | string |
listName | string |
branchName | undefined | string |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
element | Element | The element to parse. |
groupName | string | The name of the checklist group for which the list is to be parsed. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
element | Element | The element to parse. |
groupName | string | The name of the checklist group for which the item is to be parsed. |
listName | string | The name of the checklist list for which the item is to be parsed. |
branchName | undefined | string | The name of the checklist branch for which the item is to be parsed. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type |
---|---|
element | Element |
groupName | string |
listName | string |
branchName | undefined | string |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type |
---|---|
element | Element |
groupName | string |
listName | string |
branchName | undefined | string |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type |
---|---|
element | Element |
groupName | string |
listName | string |
branchName | undefined | string |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
itemArray | readonly ChecklistItemDef <I >[] | An array of item definitions that precede the item to resolve and validate. |
item | GarminChecklistBranchItemLinkItemDef | The item definition to resolve and validate. |
groupName | string | The name of the checklist group for which the item is to be resolved and validated. |
listName | string | The name of the checklist list for which the item is to be resolved and validated. |
branchName | undefined | string | The name of the checklist branch for which the item is to be resolved and validated. |
options | ChecklistDOMParseOptionsToUse <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
Parameter | Type | Description |
---|---|---|
text | string | The 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