elements.d.ts 1.2 KB

123456789101112131415161718192021222324
  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.dev/license
  7. */
  8. /**
  9. * Parses a HTML fragment and traverses all AST nodes in order find elements that
  10. * include the specified attribute.
  11. */
  12. export declare function findElementsWithAttribute(html: string, attributeName: string): import("parse5/dist/tree-adapters/default").Element[];
  13. /**
  14. * Finds elements with explicit tag names that also contain the specified attribute. Returns the
  15. * attribute start offset based on the specified HTML.
  16. */
  17. export declare function findAttributeOnElementWithTag(html: string, name: string, tagNames: string[]): number[];
  18. /**
  19. * Finds elements that contain the given attribute and contain at least one of the other
  20. * specified attributes. Returns the primary attribute's start offset based on the specified HTML.
  21. */
  22. export declare function findAttributeOnElementWithAttrs(html: string, name: string, attrs: string[]): number[];
  23. /** Gets the start offset of the given attribute from a Parse5 element. */
  24. export declare function getStartOffsetOfAttribute(element: any, attributeName: string): number;