open-element-stack.d.ts 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { TAG_ID as $ } from '../common/html.js';
  2. import type { TreeAdapter, TreeAdapterTypeMap } from '../tree-adapters/interface.js';
  3. export interface StackHandler<T extends TreeAdapterTypeMap> {
  4. onItemPush: (node: T['parentNode'], tid: number, isTop: boolean) => void;
  5. onItemPop: (node: T['parentNode'], isTop: boolean) => void;
  6. }
  7. export declare class OpenElementStack<T extends TreeAdapterTypeMap> {
  8. private treeAdapter;
  9. private handler;
  10. items: T['parentNode'][];
  11. tagIDs: $[];
  12. current: T['parentNode'];
  13. stackTop: number;
  14. tmplCount: number;
  15. currentTagId: $;
  16. get currentTmplContentOrNode(): T['parentNode'];
  17. constructor(document: T['document'], treeAdapter: TreeAdapter<T>, handler: StackHandler<T>);
  18. private _indexOf;
  19. private _isInTemplate;
  20. private _updateCurrentElement;
  21. push(element: T['element'], tagID: $): void;
  22. pop(): void;
  23. replace(oldElement: T['element'], newElement: T['element']): void;
  24. insertAfter(referenceElement: T['element'], newElement: T['element'], newElementID: $): void;
  25. popUntilTagNamePopped(tagName: $): void;
  26. shortenToLength(idx: number): void;
  27. popUntilElementPopped(element: T['element']): void;
  28. private popUntilPopped;
  29. popUntilNumberedHeaderPopped(): void;
  30. popUntilTableCellPopped(): void;
  31. popAllUpToHtmlElement(): void;
  32. private _indexOfTagNames;
  33. private clearBackTo;
  34. clearBackToTableContext(): void;
  35. clearBackToTableBodyContext(): void;
  36. clearBackToTableRowContext(): void;
  37. remove(element: T['element']): void;
  38. tryPeekProperlyNestedBodyElement(): T['element'] | null;
  39. contains(element: T['element']): boolean;
  40. getCommonAncestor(element: T['element']): T['element'] | null;
  41. isRootHtmlElementCurrent(): boolean;
  42. private hasInDynamicScope;
  43. hasInScope(tagName: $): boolean;
  44. hasInListItemScope(tagName: $): boolean;
  45. hasInButtonScope(tagName: $): boolean;
  46. hasNumberedHeaderInScope(): boolean;
  47. hasInTableScope(tagName: $): boolean;
  48. hasTableBodyContextInTableScope(): boolean;
  49. hasInSelectScope(tagName: $): boolean;
  50. generateImpliedEndTags(): void;
  51. generateImpliedEndTagsThoroughly(): void;
  52. generateImpliedEndTagsWithExclusion(exclusionId: $): void;
  53. }