-
-
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
DomConverter throws an error when found <!-- comment --> #3860
Comments
Let's not forget to revert this: https://github.com/ckeditor/ckeditor5-engine/pull/662/files#diff-d10955305069dfc2088d6406b09b3447R17 |
What do we actually want to do with this? Do we want to convert comments to view? I guess we'll need to support comments in the view cause otherwise you wouldn't be able to easily produce data with comments. However, if we'd need to work on converting comments to the model and back... that would be crazy. Of course, we're not going to introduce comments in the model, but one might want to convert comments to some elements or attrs. This would be quite a lot of work. |
cc @pjasiun @szymonkups could this method return |
I agree with both: we should, at some point, handle comments conversion, to stop trimming all comments (I already see these SO issues: "CKE5 remove my comments!"). But that's also true that it will be some work to be done: view element, model element, converters, both tree walkers improvements and all function which use tree walkers. For now, returning null should work fine. We need to handle null anyways for empty text nodes which have no view representation, so it should work for comments too. |
Maybe it would be most safe to convert comments to collapsed markers? There are a lot of advantages to it. |
In the future, this may be some idea. But I'd just ignore comments now. |
Fix: `DomConverter#domToView()` will not throw when converting a comment. Closes #647.
This line throws an error:
Uncaught TypeError: Cannot read property 'toLowerCase' of undefined
whendomNode
is aComment
.I figured out it during our new testing environment (Karma & Webpack). Karma inserts a comment to
body
tag.DomConverter
assumes that founddomNode
is an instance ofHTMLElement
.For the first iteration,
domNode
is adocument.body
. For the second iteration,domNode
is an instance ofComment
.I also reproduced this error in Bender.
Steps to reproduce:
tests/view/observer/__template__.html
- some HTML comment:<!-- some comment -->
tests/engine/view/observer/domeventdata
I know this issue is like "edge case" but we should prevent it.
The text was updated successfully, but these errors were encountered: