Javascript 如何找出DOM中的所有角度选择器并存储在数组中? 1.html

Javascript 如何找出DOM中的所有角度选择器并存储在数组中? 1.html,javascript,jquery,angular8,Javascript,Jquery,Angular8,如何在dom中找到前缀为的所有选择器 2.html 如何在dom中和类“parent”内找到所有前缀为的选择器 所需的输出是[app container'、“app info'、…] 答案可能是js、jQuery或angular?查询容器中的元素并检查它们的标记名 常量elems=document.querySelectorAll.parent*; elems.forEachel=>{ const tag=el.tagName.toLowerCase if tag.startsWith'app

如何在dom中找到前缀为的所有选择器

2.html 如何在dom中和类“parent”内找到所有前缀为的选择器

所需的输出是[app container'、“app info'、…]


答案可能是js、jQuery或angular?

查询容器中的元素并检查它们的标记名

常量elems=document.querySelectorAll.parent*; elems.forEachel=>{ const tag=el.tagName.toLowerCase if tag.startsWith'app-'{ console.logel; } }
查询容器中的元素并检查它们的标记名

常量elems=document.querySelectorAll.parent*; elems.forEachel=>{ const tag=el.tagName.toLowerCase if tag.startsWith'app-'{ console.logel; } }
我不知道如何使用getElementsByTagName并过滤像elem.tagName.toLowerCase这样的标记名 .filtertagName=>标记名.startsWith'app-' console.logarr oiwdiodw dwww DWWDWD 一些跨度 一些标题
我不知道如何使用getElementsByTagName并过滤像elem.tagName.toLowerCase这样的标记名 .filtertagName=>标记名.startsWith'app-' console.logarr oiwdiodw dwww DWWDWD 一些跨度 一些标题
这里有一个稍微不同的实现:

const tags=Array…document.querySelectorAll'*' .mapel=>el.tagName.toLowerCase .filterselector=>selector.startsWith'app-'; console.logtags
这里有一个稍微不同的实现:

const tags=Array…document.querySelectorAll'*' .mapel=>el.tagName.toLowerCase .filterselector=>selector.startsWith'app-'; console.logtags
它还包含innerHTML。这里只需要选择器名称。更新了问题。所以使用标记名作为选择器,它也包含innerHTML。这里只需要选择器名称。更新了问题。所以使用标记名作为选择器,它也包含innerHTML。这里只需要选择器名称。已更新的问题。@我现在检查它,它也包含innerHTML。这里只需要选择器名称。更新了问题。@Mahi现在检查一下MDN=>中的LocalName此功能已过时。尽管它在某些浏览器中仍然可以工作,但不鼓励使用它,因为它可以随时删除。尽量避免使用它。另外,这是从页面中选择所有元素。不仅仅是来自父类元素的选择器,问题是这样的:如何在类“parent”中找到dom***和***中前缀为的所有选择器?嗯,很多问题都不清楚。但他也指定了预期的输出“[app container”,“app info”,“….];”。有时候,你只需要在字里行间阅读:当涉及到问题时。MDN=>中的localName这个功能已经过时了。尽管它在某些浏览器中仍然可以工作,但不鼓励使用它,因为它可以随时删除。尽量避免使用它。另外,这是从页面中选择所有元素。不仅仅是来自父类元素的选择器,问题是这样的:如何在类“parent”中找到dom***和***中前缀为的所有选择器?嗯,很多问题都不清楚。但他也指定了预期的输出“[app container”,“app info”,“….];”。有时候你只需要读字里行间的话:当涉及到问题时。
<app-root>
<app-header>
dwkjdwjkwd
</app-header>
<app-container>daaddadadad</app-container>
<app-info>diwduiwuwd</app-info>
</app-root>
<app-root>
<app-header>
</app-header>

<div class="parent">
 oiwdiodw
<app-container>dwww</app-container>
<app-info>dwwdwdwd</app-info>
</div>

</app-root>