【问题标题】:What are these `dot` tags parallel to `svg` tag?这些与 svg 标签平行的 dot 标签是什么?
【发布时间】:2020-12-11 15:42:47
【问题描述】:

我查看了example of UDNZTimeline widget 并在Chrome 开发人员工具中看到了

除了svg 标签还有一个div 标签,包含dot 标签。我还在UDNZTimeline 示例中的某处看到了pole 标签。我在SVG reference 中看不到这些标签,尽管Chrome 在悬停这些标签时会突出显示视觉元素。

结构如下:

<svg>
    <line ...>
    and other SVG tags
</svg>
<div>
    <dot ....>
    <pole ....>
    and other non-svg tags which are visualized nevertheless
</div>

这些标签是什么?如何了解它们的含义?

【问题讨论】:

标签: javascript html svg


【解决方案1】:

您现在可以在大多数浏览器中define custom elementscustomElements.define(name, constructor, options);

但仔细一看,dot 似乎没有定义自定义元素(customElements.get('dot'); 返回undefined)。

所以看起来开发人员刚刚创建了带有名称的元素(请参阅源代码 herehere)。

浏览器似乎没有问题,因为它回退到HTMLUnknownElement,请参阅讨论here

如果你想了解更多,这里是the link to the main script

【讨论】:

  • 如果这些是未知元素,那么浏览器如何知道如何绘制它们以及它们的位置?
  • @Dims 这是 CSS 样式(position: absolute; left: 163.44px; top: 125px; 等等)。编辑:未知元素仍保留在 DOM 中。
  • 自定义元素(可以在所有浏览器中创建,但 IE)总是在节点名称中有一个连字符,如果你没有看到,它永远不是自定义元素,如果您看到它不一定是自定义元素。
猜你喜欢
  • 2012-09-27
  • 2023-03-03
  • 2022-01-24
  • 1970-01-01
  • 2015-01-23
  • 2010-10-16
  • 2014-05-31
  • 2011-11-30
  • 1970-01-01
相关资源
最近更新 更多