javascript 根据 DOM,“Range.detach”现在是空操作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25020816/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
'Range.detach' is now a no-op, as per DOM
提问by Chandrew
I have been noticing this warning and error message in my console after updating Chrome to 36.0.1985.125.
将 Chrome 更新到 36.0.1985.125 后,我一直在控制台中注意到此警告和错误消息。
Warning:
警告:
'Range.detach' is now a no-op, as per DOM (http://dom.spec.whatwg.org/#dom-range-detach).
Error:
错误:
Discontiguous selection is not supported.
Can be seen: http://rangy.googlecode.com/svn/trunk/demos/cssclassapplier.html
可见:http: //rangy.googlecode.com/svn/trunk/demos/cssclassapplier.html
Other javascript/jquery plugins (wysihtml5, rangy) have also been affected, any solutions?
其他javascript/jquery插件(wysihtml5,rangy)也受到了影响,有什么解决办法吗?
回答by Tim Down
I'm still trying to decide what to do about this. See this Rangy issue(migration to GitHub not quite complete, sorry). I think it's unhelpful behaviour on the part of Chrome and would like it removed.
我仍在努力决定如何处理这个问题。看到这个 Rangy 问题(迁移到 GitHub 不是很完整,抱歉)。我认为这对 Chrome 来说是无益的行为,并希望将其删除。
The offending code in Rangy is in a feature test that determines whether the browser supports multiple ranges within a selection (of the current mainstream browsers, only Firefox does). Since this doesn't seem to be going away I think I'm going to have to suck it up and add a browser sniff, which makes me sad.
Rangy 中的违规代码正在一项功能测试中,用于确定浏览器是否支持选择范围内的多个范围(当前主流浏览器中,只有 Firefox 支持)。由于这似乎并没有消失,我想我将不得不吸吮它并添加浏览器嗅探,这让我感到难过。
Update
更新
I added a horrible browser sniff to Rangy and the error no longer appears.
我向 Rangy 添加了一个可怕的浏览器嗅探,错误不再出现。