5

I have been noticing this warning and error message in my console after updating Chrome to 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

Other javascript/jquery plugins (wysihtml5, rangy) have also been affected, any solutions?

Chandrew
  • 16,987
  • 4
  • 24
  • 40
  • Remove calls to `Range.detach`. Also, that’s probably a warning, not an error. – Ry- Jul 29 '14 at 16:54
  • Rangy was fixed with [this commit](https://github.com/timdown/rangy/commit/601b80c2bcc8f0c65bf233660f9e3bff5bbe9c18). – esqew Jul 29 '14 at 16:57
  • @esqew Interesting, I gave rangy an update. In his comments, looks like the error cannot be suppressed '// Next line causes Chrome 36 to print a console error of' ... (https://code.google.com/p/chromium/issues/detail?id=353069#c4) – Chandrew Jul 29 '14 at 17:13

1 Answers1

5

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.

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.

Update

I added a horrible browser sniff to Rangy and the error no longer appears.

Tim Down
  • 318,141
  • 75
  • 454
  • 536
  • Could you please post code on how to fix this? I am using textAngular for a rich text editor which has the dependency on Rangy. I don't want to upgrade the version of Rangy in case it breaks. Is it something I can fix in the script? – Asher Mar 25 '15 at 12:11
  • 1
    @Asher: Upgrading Rangy shouldn't break anything because it retains backwards compatibility. However, if you want to edit Rangy yourself, you can see the fix here: https://github.com/timdown/rangy/blob/master/src/core/wrappedselection.js#L164 – Tim Down Mar 25 '15 at 12:59