elements.d.ts 1.2 KB

12345678910111213141516171819202122232425
  1. /**
  2. * @license
  3. * Copyright Google LLC All Rights Reserved.
  4. *
  5. * Use of this source code is governed by an MIT-style license that can be
  6. * found in the LICENSE file at https://angular.io/license
  7. */
  8. import { DefaultTreeElement } from 'parse5';
  9. /**
  10. * Parses a HTML fragment and traverses all AST nodes in order find elements that
  11. * include the specified attribute.
  12. */
  13. export declare function findElementsWithAttribute(html: string, attributeName: string): DefaultTreeElement[];
  14. /**
  15. * Finds elements with explicit tag names that also contain the specified attribute. Returns the
  16. * attribute start offset based on the specified HTML.
  17. */
  18. export declare function findAttributeOnElementWithTag(html: string, name: string, tagNames: string[]): number[];
  19. /**
  20. * Finds elements that contain the given attribute and contain at least one of the other
  21. * specified attributes. Returns the primary attribute's start offset based on the specified HTML.
  22. */
  23. export declare function findAttributeOnElementWithAttrs(html: string, name: string, attrs: string[]): number[];
  24. /** Gets the start offset of the given attribute from a Parse5 element. */
  25. export declare function getStartOffsetOfAttribute(element: any, attributeName: string): number;