You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the specification of the collapse method there is a step that says that the method must throw IndexSizeError if offset is longer than the node’s length. This check is also done as part of creating newRange in subsequent steps. So the IndexSizeError exception will be thrown in either case. However, because the specification explicitly calls for doing this before checking the node’s root, this difference is observable in obscure cases.
I suggest we remove the explicit IndexSizeError step. Better for consistency with other operations in the Selection API that don't explicitly specify an IndexSizeError check. I think it’s likely this is not already needed for web compatibility, so it’s not too late to fix this.
These same considerations apply to the setBaseAndExtent method. And I suggest the same change, removing the explicit IndexSizeError step.
The text was updated successfully, but these errors were encountered:
darinadler
changed the title
Selection API collapse and setBaseAndExtent algorithms contain redundant checks of offset
collapse and setBaseAndExtent methods contain redundant checks of offset
Sep 19, 2020
The WPT tests for collapse and setPosition expect the IndexSizeError check to be done before the document.contains check. The WPT test for setBaseAndExtent is does not cover the case where there is both IndexSizeError and a document.contains violation and so does not detect if the check is done before or after the document.contains check.
In the specification of the collapse method there is a step that says that the method must throw
IndexSizeError
ifoffset
is longer than the node’slength
. This check is also done as part of creating newRange in subsequent steps. So theIndexSizeError
exception will be thrown in either case. However, because the specification explicitly calls for doing this before checking the node’s root, this difference is observable in obscure cases.I suggest we remove the explicit
IndexSizeError
step. Better for consistency with other operations in the Selection API that don't explicitly specify anIndexSizeError
check. I think it’s likely this is not already needed for web compatibility, so it’s not too late to fix this.These same considerations apply to the setBaseAndExtent method. And I suggest the same change, removing the explicit
IndexSizeError
step.The text was updated successfully, but these errors were encountered: