版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

115 lines
3.1 KiB

  1. import Node from '../node/Node';
  2. import IElement from '../element/IElement';
  3. import IDocumentFragment from './IDocumentFragment';
  4. import INode from '../node/INode';
  5. import IHTMLCollection from '../element/IHTMLCollection';
  6. /**
  7. * DocumentFragment.
  8. */
  9. export default class DocumentFragment extends Node implements IDocumentFragment {
  10. nodeType: import("../node/NodeTypeEnum").default;
  11. readonly children: IHTMLCollection<IElement>;
  12. _rootNode: INode;
  13. /**
  14. * Last element child.
  15. *
  16. * @returns Element.
  17. */
  18. get childElementCount(): number;
  19. /**
  20. * First element child.
  21. *
  22. * @returns Element.
  23. */
  24. get firstElementChild(): IElement;
  25. /**
  26. * Last element child.
  27. *
  28. * @returns Element.
  29. */
  30. get lastElementChild(): IElement;
  31. /**
  32. * Get text value of children.
  33. *
  34. * @returns Text content.
  35. */
  36. get textContent(): string;
  37. /**
  38. * Sets text content.
  39. *
  40. * @param textContent Text content.
  41. */
  42. set textContent(textContent: string);
  43. /**
  44. * Inserts a set of Node objects or DOMString objects after the last child of the ParentNode. DOMString objects are inserted as equivalent Text nodes.
  45. *
  46. * @param nodes List of Node or DOMString.
  47. */
  48. append(...nodes: (INode | string)[]): void;
  49. /**
  50. * Inserts a set of Node objects or DOMString objects before the first child of the ParentNode. DOMString objects are inserted as equivalent Text nodes.
  51. *
  52. * @param nodes List of Node or DOMString.
  53. */
  54. prepend(...nodes: (INode | string)[]): void;
  55. /**
  56. * Replaces the existing children of a node with a specified new set of children.
  57. *
  58. * @param nodes List of Node or DOMString.
  59. */
  60. replaceChildren(...nodes: (INode | string)[]): void;
  61. /**
  62. * Query CSS selector to find matching nodes.
  63. *
  64. * @param selector CSS selector.
  65. * @returns Matching elements.
  66. */
  67. querySelectorAll(selector: string): IElement[];
  68. /**
  69. * Query CSS Selector to find matching node.
  70. *
  71. * @param selector CSS selector.
  72. * @returns Matching element.
  73. */
  74. querySelector(selector: string): IElement;
  75. /**
  76. * Returns an element by ID.
  77. *
  78. * @param id ID.
  79. * @returns Matching element.
  80. */
  81. getElementById(id: string): IElement;
  82. /**
  83. * Clones a node.
  84. *
  85. * @override
  86. * @param [deep=false] "true" to clone deep.
  87. * @returns Cloned node.
  88. */
  89. cloneNode(deep?: boolean): IDocumentFragment;
  90. /**
  91. * Append a child node to childNodes.
  92. *
  93. * @override
  94. * @param node Node to append.
  95. * @returns Appended node.
  96. */
  97. appendChild(node: INode): INode;
  98. /**
  99. * Remove Child element from childNodes array.
  100. *
  101. * @override
  102. * @param node Node to remove.
  103. */
  104. removeChild(node: INode): INode;
  105. /**
  106. * Inserts a node before another.
  107. *
  108. * @override
  109. * @param newNode Node to insert.
  110. * @param [referenceNode] Node to insert before.
  111. * @returns Inserted node.
  112. */
  113. insertBefore(newNode: INode, referenceNode?: INode): INode;
  114. }