-
-
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
Improve 'sameNodes' comparator inside 'renderer._updateChildren' #4296
Comments
The diff is based on a simple instance comparison. I agree that it'd be perfect if it was smart enough to know that it should not change the DOM when the expected child is identical. However, this is really tricky. One issue that we'd need to solve is updating the bindings. We maintain a However, you may also ask why does the view document contain new view element instances? Because conversion from model to view does not care about such things. It purges whatever it needs. And that's fine. During conversion, the entire view should change freely. The smart rendering should be hidden inside the renderer. Which means that we'll need to make this change one day. Renderer must be smart. Renderer must avoid doing DOM changes. However, even if we'd land this there's a big chance that IME would be still broken in some cases. E.g. by inline and block filler removal and small selection fixes which will frequently happen on inline element boundaries. That's why those are first two points in #802 (comment). |
I mentioned it because of two things I encountered while working on blocking selection during composition: First one is the fact that even if we stop selection manipulation during composition, it may be affected by reinserting the DOM elements - I described it in more details in https://github.com/ckeditor/ckeditor5-engine/issues/460#issuecomment-370736424. I also checked if preventing only selection manipulation during composition will solve any of the reported issue (from #802) and it seems that non of this issues can be solved by only this change (unless my validation method was invalid). In most cases both selection and element rerendering is the cause. |
Fix: Renderer should avoid doing unnecessary DOM structure changes. Ensuring that the DOM gets updated less frequently fixes many issues with text composition. Closes #1417. Closes #1409. Closes #1349. Closes #1334. Closes #898. Closes ckeditor/ckeditor5-typing#129. Closes ckeditor/ckeditor5-typing#89. Closes #1427.
Stumbled upon when debugging composition:
<strong>^Bold</strong>
:The
renderer._updateChildren
method checks diff betweenactualDomChildren
andexpectedDomChildren
returning[ 'insert', 'delete' ]
set of operations, while bothactualDomChildren
andexpectedDomChildren
represents exactly same HTML -<strong>aBold</strong>
.If the
sameNodes
comparator would be able to handle such situations we would be able to skip reinserting same nodes (should also help with composition). Preventing situations like (the intermediate state afterinsert
and beforedelete
):Checked on
ckeditor5-core/tests/manual/article.html
manual test with Chrome 64.0.3282.167.If this issue was already discussed in the past somewhere just point me to the right direction, but I haven't found any similar ones. Could help with #802
The text was updated successfully, but these errors were encountered: