Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试将一堆 html 添加到顶部的现有节点集中。它大部分都有效,但样式标签和脚本标签的内容正在被清除。这就是我的意思:
doc.xpath("//head/*[1]").before("<script>var xb=25</script>")
但是如果我尝试显示这个,这就是我得到的:
hdoc.xpath("//head/*[1]") => <script></script>
它会清除脚本和样式标签之间的所有内容,并完全忽略 html 注释。任何想法如何避免这种情况?
当前的 Nokogiri 大师修复了这个问题。