简体   繁体   English

如何从html中删除#shadow-root(user-agent)

[英]how to remove #shadow-root (user-agent) from html

What is #shadow-root (user-agent)? 什么是#shadow-root(用户代理)? how to remove it from text boxes? 如何从文本框中删除它?

In Detail 详细
This is my code: 这是我的代码:

<input type="text" name="pincode" class="form-control frm_pincode" value="" />

But when I inspect it I see like 但是当我检查它时,我看到了

<input type="text" name="pincode" class="form-control frm_pincode" value="">
  #shadow-root (user-agent)
  <div id="inner-editor"></div>
</input>

Essentially it encapsulates code, making it more manageable. 从本质上讲,它封装了代码,使其更易于管理。 It's not necessarily something you're going to want to remove without making the functionality of the code you did generate unusable. 如果不使您生成的代码功能无法使用,那么您不一定要删除它。

The following is code is hidden from you by the library you're using so you don't have to worry about coding certain objects. 以下是您正在使用的库隐藏的代码,因此您不必担心编码某些对象。 Chrome allows you to see where those #shadow Doms are located in the code. Chrome允许您查看代码中#shadow Doms的位置。

  #shadow-root (user-agent)
  <div id="inner-editor"></div>

Check out this explanation from the link below: 从以下链接查看此说明:

"In a nutshell Shadow DOM is a new part of the HTML spec which allows developers to encapsulate their HTML markup, CSS styles and JavaScript. Shadow DOM, along with a few other technologies which we'll cover later, gives developers the ability to build their own 1st class tags and APIs just like the or tag. Collectively, these new tags and APIs are referred to as Web Components." “简而言之,Shadow DOM是HTML规范的一个新部分,它允许开发人员封装他们的HTML标记,CSS样式和JavaScript。Shadow DOM以及我们稍后将介绍的一些其他技术使开发人员能够构建他们自己的第一类标签和API就像or标签一样。这些新的标签和API统称为Web组件。“

The link below was key in helping understanding shadow DOM: 以下链接是帮助理解影子DOM的关键:
http://robdodson.me/blog/2013/08/26/shadow-dom-introduction/ http://robdodson.me/blog/2013/08/26/shadow-dom-introduction/

This makes use of the shadow DOM to make creating custom tags possible: 这样可以使用shadow DOM来创建自定义标记:
https://www.polymer-project.org/ https://www.polymer-project.org/

Finally, there's also an option under Chrome Dev Tools Options to "Show user agent shadow DOM" 最后,Chrome开发工具选项下还有一个选项“显示用户代理阴影DOM”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM