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

76 строки
2.3 KiB

  1. import INode from './INode';
  2. import IElement from '../element/IElement';
  3. /**
  4. * Node utility.
  5. */
  6. export default class NodeUtility {
  7. /**
  8. * Returns boolean indicating if nodeB is an inclusive ancestor of nodeA.
  9. *
  10. * Based on:
  11. * https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/helpers/node.js
  12. *
  13. * @see https://dom.spec.whatwg.org/#concept-tree-inclusive-ancestor
  14. * @param ancestorNode Ancestor node.
  15. * @param referenceNode Reference node.
  16. * @returns "true" if following.
  17. */
  18. static isInclusiveAncestor(ancestorNode: INode, referenceNode: INode): boolean;
  19. /**
  20. * Returns boolean indicating if nodeB is following nodeA in the document tree.
  21. *
  22. * Based on:
  23. * https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/helpers/node.js
  24. *
  25. * @see https://dom.spec.whatwg.org/#concept-tree-following
  26. * @param nodeA Node A.
  27. * @param nodeB Node B.
  28. * @returns "true" if following.
  29. */
  30. static isFollowing(nodeA: INode, nodeB: INode): boolean;
  31. /**
  32. * Node length.
  33. *
  34. * Based on:
  35. * https://github.com/jsdom/jsdom/blob/master/lib/jsdom/living/helpers/node.js
  36. *
  37. * @see https://dom.spec.whatwg.org/#concept-node-length
  38. * @param node Node.
  39. * @returns Node length.
  40. */
  41. static getNodeLength(node: INode): number;
  42. /**
  43. * Returns boolean indicating if nodeB is following nodeA in the document tree.
  44. *
  45. * Based on:
  46. * https://github.com/jsdom/js-symbol-tree/blob/master/lib/SymbolTree.js#L220
  47. *
  48. * @param node Node.
  49. * @param [root] Root.
  50. * @returns Following node.
  51. */
  52. static following(node: INode, root?: INode): INode;
  53. /**
  54. * Returns the next sibling or parents sibling.
  55. *
  56. * @param node Node.
  57. * @returns Next decentant node.
  58. */
  59. static nextDecendantNode(node: INode): INode;
  60. /**
  61. * Needed by https://dom.spec.whatwg.org/#concept-node-equals
  62. *
  63. * @param elementA
  64. * @param elementB
  65. */
  66. static attributeListsEqual(elementA: IElement, elementB: IElement): boolean;
  67. /**
  68. * Check if node nodeA equals node nodeB.
  69. * Reference: https://dom.spec.whatwg.org/#concept-node-equals
  70. *
  71. * @param nodeA Node A.
  72. * @param nodeB Node B.
  73. */
  74. static isEqualNode(nodeA: INode, nodeB: INode): boolean;
  75. }