-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validate position.parent's output #4531
Labels
package:engine
status:discussion
type:improvement
This issue reports a possible enhancement of an existing feature.
Milestone
Comments
I'll start with the first option to check what will actually happen with our tests. |
I'd go with all three. If they throw, they throw right now, so additional throwing should not change anything (except for the case when we have a silent error with a position in a text node but it worked for some reason... I wouldn't expect a lot of that, though). |
OK, it looks very promising:
|
jodator
referenced
this issue
in ckeditor/ckeditor5-engine
Aug 12, 2019
Other: Position getters (such as `#parent` or `#index`) will throw when position points at an incorrect place in its root. Closes #1776.
mlewand
added
status:discussion
type:improvement
This issue reports a possible enhancement of an existing feature.
package:engine
labels
Oct 9, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
package:engine
status:discussion
type:improvement
This issue reports a possible enhancement of an existing feature.
Positions and the tree to which they point are independent. It is possible to create and work with positions which point to non-existent places. This is mainly required by OT which works on a virtual states.
However, there's a set of position's properties/methods which do access the model structure. This is mainly done via reading
position.parent
(which is a getter) which, if the position is incorrect will either crash or return a text node. The first scenario is fairly easy to track and understand. The latter is harder because it fails later, when a text node reaches a code which expects an element.Therefore, I propose to add validation for positions:
position.parent
that the returned object is really an element and not a text node,position.parent
– e.g. when you have offsets out of boundariesposition.parent
and may throw anyway.cc @scofalik @pjasiun
The text was updated successfully, but these errors were encountered: