1 | import * as ts from 'typescript';
|
2 | import { isJsxElement } from '../TypeGuard';
|
3 |
|
4 | /**
|
5 | * @Returns the implicit role for an li tag.
|
6 | */
|
7 | function getImplicitRoleForLi(node: ts.Node): string {
|
8 | const parentNode: ts.Node = node.parent;
|
9 | let parentTagName: string;
|
10 |
|
11 | if (isJsxElement(parentNode)) {
|
12 | parentTagName = parentNode.openingElement.tagName.getText();
|
13 | }
|
14 | return parentTagName === 'ol' || parentTagName === 'ul' ? 'listitem' : undefined;
|
15 | }
|
16 |
|
17 | export { getImplicitRoleForLi as li };
|