Ticket #442 (closed defect: fixed)
remove alert "Your Document is not well formed..."
| Reported by: | mharrisonline | Owned by: | gogo |
|---|---|---|---|
| Priority: | normal | Milestone: | 0.95 |
| Component: | Xinha Core | Version: | trunk |
| Severity: | normal | Keywords: | stability, interface design |
| Cc: |
Description
I would propose that the current error handling function:
HTMLArea.getHTML = function(root, outputRoot, editor){
try{
return HTMLArea.getHTMLWrapper(root,outputRoot,editor);
}
catch(e){
alert(HTMLArea._lc('Your Document is not well formed. Check JavaScript console for details.'));
return editor._iframe.contentWindow.document.body.innerHTML;
}
}
is far too easy to trigger. It's great that it catches the error, but it presents an annoying alert message the typical Xinha user will understand as:
"Are you the loser that created this page? Well, it really stinks! Now watch, I'm going to completely screw it up as soon as you click ok. Check your coffee writing spaceship control panel if you want to understand anything at all."
Alerts like this are considered poor interface design:
Would you like your harddrive to be reformatted immediately? Check your baltazor 000012 after your C drive is destroyed <OK button>
.. because they are about to do something the user doesn't want, it uses language the user won't understand, there is no cancel option, and we shouldn't bothering the user about this in the first place.
Also, I have never seen the error result in more desireable code. In fact, the best scenario is probably that Xinha should mind its own business, assume the user really wants the code to be that way, and do its job.
It is all too easy and likely for users to be interupted by this error if they are loading legacy HTML into Xinha that was developed in a different editor. The error, especially if they were editing a full HTML document, can result in a disasterous change in the code, eliminating links to stylesheets, etc. that were in the head of the document.
So, I propose that the function work behind the scenes, never send an "alert of death" to the user, and just take care of business:
HTMLArea.getHTML = function(root, outputRoot, editor){
try{
return HTMLArea.getHTMLWrapper(root,outputRoot,editor);
}
catch(e){
return HTMLArea.getHTMLWrapper(root,outputRoot,editor);
}
}
I've been testing this,and it seems to make Xinha more stable. I've never seen any other editor interact with the user the way HTMLArea.getHTML makes Xinha; I think Xinha should just edit the existing code and be quiet about it.
