版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 
 

74 строки
2.8 KiB

  1. import IDocumentFragment from '../document-fragment/IDocumentFragment';
  2. import IDocument from '../document/IDocument';
  3. import IElement from '../element/IElement';
  4. import IHTMLCollection from '../element/IHTMLCollection';
  5. import INode from '../node/INode';
  6. /**
  7. * Parent node utility.
  8. */
  9. export default class ParentNodeUtility {
  10. /**
  11. * Inserts a set of Node objects or DOMString objects after the last child of the ParentNode. DOMString objects are inserted as equivalent Text nodes.
  12. *
  13. * @param parentNode Parent node.
  14. * @param nodes List of Node or DOMString.
  15. */
  16. static append(parentNode: INode, ...nodes: (INode | string)[]): void;
  17. /**
  18. * Inserts a set of Node objects or DOMString objects before the first child of the ParentNode. DOMString objects are inserted as equivalent Text nodes.
  19. *
  20. * @param parentNode Parent node.
  21. * @param nodes List of Node or DOMString.
  22. */
  23. static prepend(parentNode: INode, ...nodes: (string | INode)[]): void;
  24. /**
  25. * Replaces the existing children of a ParentNode with a specified new set of children.
  26. *
  27. * @param parentNode Parent node.
  28. * @param nodes List of Node or DOMString.
  29. */
  30. static replaceChildren(parentNode: INode, ...nodes: (string | INode)[]): void;
  31. /**
  32. * Returns an elements by class name.
  33. *
  34. * @param parentNode Parent node.
  35. * @param className Tag name.
  36. * @returns Matching element.
  37. */
  38. static getElementsByClassName(parentNode: INode, className: string): IHTMLCollection<IElement>;
  39. /**
  40. * Returns an elements by tag name.
  41. *
  42. * @param parentNode Parent node.
  43. * @param tagName Tag name.
  44. * @returns Matching element.
  45. */
  46. static getElementsByTagName(parentNode: IElement | IDocumentFragment | IDocument, tagName: string): IHTMLCollection<IElement>;
  47. /**
  48. * Returns an elements by tag name and namespace.
  49. *
  50. * @param parentNode Parent node.
  51. * @param namespaceURI Namespace URI.
  52. * @param tagName Tag name.
  53. * @returns Matching element.
  54. */
  55. static getElementsByTagNameNS(parentNode: IElement | IDocumentFragment | IDocument, namespaceURI: string, tagName: string): IHTMLCollection<IElement>;
  56. /**
  57. * Returns the first element matching a tag name.
  58. * This is not part of the browser standard and is only used internally in the document.
  59. *
  60. * @param parentNode Parent node.
  61. * @param tagName Tag name.
  62. * @returns Matching element.
  63. */
  64. static getElementByTagName(parentNode: IElement | IDocumentFragment | IDocument, tagName: string): IElement;
  65. /**
  66. * Returns an element by ID.
  67. *
  68. * @param parentNode Parent node.
  69. * @param id ID.
  70. * @returns Matching element.
  71. */
  72. static getElementById(parentNode: IElement | IDocumentFragment | IDocument, id: string): IElement;
  73. }