- objective-c - iOS 5 : Can you override UIAppearance customisations in specific classes?
- iphone - 如何将 CGFontRef 转换为 UIFont?
- ios - 以编程方式关闭标记的信息窗口 google maps iOS
- ios - Xcode 5 - 尝试验证存档时出现 "No application records were found"
我这里有一个 jsfiddle - http://jsfiddle.net/stevea/QpNbu/3/ - 为所有具有 class='active'
的元素收集 outerHTML
。令我吃惊的是,即使我注释掉了一些 HTML,如:
<!-- <div>'Some inner text'</div> -->
outerHTML
仍然把它带回来!这不可能仍然在 DOM 中,所以我想知道 outerHTML
在哪里。
感谢您的任何见解。
最佳答案
HTML 中的注释令人惊讶,事实上,它是 DOM 的一部分!如果您在此处查看此屏幕截图:
您会看到 google chrome web inspector 将其呈现为 DOM 的一部分(请注意底部栏如何将其显示为 div#box1.active
的子项。)
有关更具体的文档,如果您查看 DOM 节点可能的 Node.nodeType
on MDN ,您会看到 COMMENT_NODE
是有效类型之一。
COMMENT_NODE 8
W3还为 DOM 定义了 Comment 接口(interface):
This interface inherits from CharacterData and represents the content of a comment, i.e., all the characters between the starting '<!--' and ending '-->'. Note that this is the definition of a comment in XML, and, in practice, HTML, although some HTML tools may implement the full SGML comment structure.
关于javascript - 为什么 outerHTML 会带回 <!- - --> 评论?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17626273/
这个问题在这里已经有了答案: Call native javascript function that has been "erased" by the web page (1 个回答) 关闭 4
我有一个 UITableViewController。 但是当我滚动到顶部时,可以在状态栏上看到表格数据,如下所示: 我怎样才能绕过这个时刻? 最佳答案 您可以使用下一个代码段隐藏状态栏: overr
我想让一个 View 显示在另一个 View 的顶部。 这是我的 View 层次结构: 基本上我想把按钮(重新开始)放在属于 PageViewController 的 UIImageView 前面。所
这是一个代码片段 tips = sns.load_dataset("tips") g = sns.FacetGrid(tips, col = 'time') g = g.map(plt.hist, "
下面的 php 数据库查询(来自 phpMyAdmin)只将一个值(第一个或最旧的)带回 amcharts: set_no_cache(); // do whatever you wa
我正在使用 mootools 从一个元素中获取 id,但它不起作用,它返回了 id 和 null。 $$(".obj").addEvent("click",function(){ var o
从内存中,微软拿了 AppDomain离开了,这个机制已经被关闭了。 现在突然发现AppDomain回来了: Assembly System.Runtime.Extensions, Version=4
我是一名优秀的程序员,十分优秀!