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

Mutation observer should filter out empty child list mutations #4121

Closed
Reinmar opened this issue Jul 20, 2017 · 2 comments · Fixed by ckeditor/ckeditor5-engine#1039
Closed
Assignees
Labels
package:engine type:bug This issue reports a buggy (incorrect) behavior.
Milestone

Comments

@Reinmar
Copy link
Member

Reinmar commented Jul 20, 2017

  1. Load: <p><strong>Buold</strong> xxx</p>.
  2. Try to use a spellchecker to correct "Buold" to "Bold".

You get the following mutations:

image

The first one is the change of the <p>'s children. This is fine.

However, the second one is a change of the root's children and it contains the same list of children.

Issue encountered in: ckeditor/ckeditor5-typing#110.

@Reinmar
Copy link
Member Author

Reinmar commented Jul 20, 2017

I can see on the list of native mutations that there are only two which touch the root:

image

And if we look closer it turns out that one adds a text node while the other removes it:

image

And that the text node is empty.

So, my guess is that spellchecker behaves a bit like a IME. It does some operations on the DOM but those operations are handled by some generic algorithms like "remove text", "insert text". Once they get a range at a block boundary they leak out of that block.

@Reinmar
Copy link
Member Author

Reinmar commented Jul 20, 2017

I pushed a branch t/1031 and it fixes cases mentioned in ckeditor/ckeditor5-typing#110.

@Reinmar Reinmar self-assigned this Jul 24, 2017
pjasiun referenced this issue in ckeditor/ckeditor5-engine Jul 25, 2017
Fix: Mutation observer will ignore children mutations if as a result of several native mutations the element's children haven't changed. Closes #1031.
@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 module:view 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
package:engine type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants