diff --git a/dist/tags/base.d.ts b/dist/tags/base.d.ts index e398ad7..83507cf 100644 --- a/dist/tags/base.d.ts +++ b/dist/tags/base.d.ts @@ -32,6 +32,7 @@ export declare class TagCollection implements TagCollectionType { tags: TagType[]; map: Map; constructor(tags: TagType[]); + getByName(name: string): TagType; getByElementName(element: string): TagType | undefined; } export {}; diff --git a/dist/tags/base.js b/dist/tags/base.js index 4db3609..62b6f44 100644 --- a/dist/tags/base.js +++ b/dist/tags/base.js @@ -143,6 +143,11 @@ class TagCollection { } } } + getByName(name) { + return this.tags.filter(t => { + t.constructor.name == name; + })[0] || undefined; + } getByElementName(element) { const el = element.toUpperCase(); return this.tags.filter(t => { diff --git a/src/ts/tags/base.ts b/src/ts/tags/base.ts index 85a7bb8..be9c6d1 100644 --- a/src/ts/tags/base.ts +++ b/src/ts/tags/base.ts @@ -157,6 +157,12 @@ export class TagCollection implements TagCollectionType { } } + getByName(name: string) { + return this.tags.filter(t => { + t.constructor.name == name + })[0] || undefined; + } + getByElementName(element: string): TagType | undefined { const el = element.toUpperCase(); return this.tags.filter(t => {