Embed HTML elements pose some problems:

* they are loaded asynchronously and any attempt to access even the 
simplest DOM property like nodeType through JavaScript raises an 
exception if the object is not fully loaded (closed to 
https://bugzilla.mozilla.org/show_bug.cgi?id=331672 ).

* they can't be fully controlled from JavaScript. The specific plugin 
that handles each of them decides the display and behavior (e.g. 
https://bugzilla.mozilla.org/show_bug.cgi?id=250855 a flash movie might 
auto start in edit mode and, unless you want to see a movie while 
editing, that's not nice).

* they aren't reloaded after they are detached and reattached to the DOM 
tree using JavaScript which means that any DOM manipulation involving 
one of the ancestors of a embed node can lead to the disappearance of 
the embedded object. Sadly, appendChild, insertBefore and replaceChild 
detach the target node before attaching it to the new location. As a 
consequence there's no way to move an embed node inside the DOM tree 
without detaching it.

So I propose we replace the embed HTML elements with static image 
placeholders just after the edited document finishes loading. The 
placeholder will have the same size as the embedded object in view mode.

Note, ckeditor already does this. You can check by copying the HTML from 
http://jira.xwiki.org/jira/browse/XWIKI-3975 to the source of 
http://ckeditor.com/demo .

I'm +1.

Thanks,
Marius
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to