[csswg-drafts] Should Range.getClientRects return an empty sequence when Range is collapsed?

galmacky has just created a new issue for https://github.com/w3c/csswg-drafts:

== Should Range.getClientRects return an empty sequence when Range is collapsed? ==
https://drafts.csswg.org/cssom-view/#extensions-to-the-range-interface

In the above spec, it is somewhat unclear whether Range.getClientRects() should return an empty sequence, or return a sequence containing a ClientRect that has either width of 0 or height of 0, if the Range is collapsed. At a glance, it looks like an empty sequence must be returned only if the range is not in the document, but there was confusion among people in the discussion (linked at the end of this posting), so hereby requesting clarification, preferably in the form of test. FYI, a draft version of this test is uploaded at  https://jsbin.com/jodiharuni/edit?html,output [courtesy of foolip@chromium.org].

Also behavior differs from browser to browser, when observed on DIV contenteditable.

Chrome/Safari
a) DIV is empty: it returns a sequence of ClientRect that has a width of 0.
b) DIV is \n\n: it returns an empty sequence
c) Start with \n\n, type 'a', and delete 'a': it returns a sequence of ClientRect that has a width of the container.

FireFox
a) DIV is empty: not focusable, therefore not testable
b) DIV is \n\n: not focusable, therefore not testable
c) Start with 'a', and delete 'a': it returns an empty sequence

Edge / IE11
a) DIV is empty: it returns a sequence of ClientRect that has a width of 0.
b) DIV is \n\n: it returns a sequence of ClientRect that has a width of 0.
c) Start with \n\n, type 'a', and delete 'a': it returns a sequence of ClientRect that has a width of 0.

For more discussion around this: https://crbug.com/698752


Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/1156 using your GitHub account

Received on Saturday, 1 April 2017 00:23:05 UTC