Skip to content
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

Element#getNodeByPath() should expect offsets not indexes #4108

Closed
Reinmar opened this issue Jul 11, 2017 · 2 comments · Fixed by ckeditor/ckeditor5-engine#1043
Closed

Element#getNodeByPath() should expect offsets not indexes #4108

Reinmar opened this issue Jul 11, 2017 · 2 comments · Fixed by ckeditor/ckeditor5-engine#1043
Assignees
Labels
intro Good first ticket. package:engine type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@Reinmar
Copy link
Member

Reinmar commented Jul 11, 2017

Path is an array of offsets (it's defined like this in Position), hence, whenever we accept path we should translate offsets to indexes (if we want to retrieve children).

@Reinmar
Copy link
Member Author

Reinmar commented Jul 11, 2017

The method to use is offsetToIndex() I suppose. And an example where it's used is Position#parent.

@Reinmar
Copy link
Member Author

Reinmar commented Jul 11, 2017

After ckeditor/ckeditor5-engine#1005 this will also require change in DocumentFragment#getNodeByPath().

Reinmar referenced this issue in ckeditor/ckeditor5-engine Jul 28, 2017
Fix: `model.Element#getNodeByPath()` and `model.DocumentFragment#getNodeByPath()` should work with offsets not indexes (because path is an array of offsets). Closes #1009.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the iteration 11 milestone Oct 9, 2019
@mlewand mlewand added intro Good first ticket. module:model type:bug This issue reports a buggy (incorrect) behavior. 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
intro Good first ticket. package:engine type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants