Opened 8 years ago

Closed 7 years ago

#14546 closed New Feature (expired)

Widget code should be more resilient about changes in DOM

Reported by: Alfonso Martínez de Lizarrondo Owned by:
Priority: Normal Milestone:
Component: UI : Widgets Version:
Keywords: Cc:

Description

Load http://ckeditor.com/demo#widgets, go to the image2 demo and with the dev tools, select the img element and delete it. Now trying to show the HTML (or save the data) fails because the widget code expects that everything is in perfect shape and it can't find the image.

The code should have some safety checks so it doesn't throw an exception and instead it just is able to handle the rest of the code, removing all the conflicting data about the broken widget (there's no need to try to recover, this is an exceptional thing and the only important thing is to don't crash). eg:

if ( widgetElement.attributes --> if ( widgetElement && widgetElement.attributes

if (!el)
return;

etc...

Change History (2)

comment:1 Changed 8 years ago by Jakub Ś

Status: newpending
Version: 4.5.7

@alfonsoml I really have mixed feelings here. Is there any real life use case for breaking the widget except for deleting img with dev-tools? I have tried working with image removed from server hoping that it will give same results. There were no errors thrown however and "missing image" was shown instead.
I'm also unsure whether widget should delete itself or rather insert some "missing image" replacement.

Anyway the widget is getting into very unusual situation - everything was created correctly and suddenly part of the widget is missing. If it was possible to do with real life scenario then this would be a bug. Breaking widget with dev-tools is too far-fetched IMHO.


Error:
TypeError: this.previous is null
previous = node.previous = this.previous,
node.js

comment:2 Changed 7 years ago by Jakub Ś

Resolution: expired
Status: pendingclosed
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy