Reviewers: jgw, Description: Description: =========== Using almost any method in the Basic or Extended formatter when the RichTextArea is detached results in a JS exception on all browsers. Even after it is attached, a JS exception occurs in some browsers if the area is not initialized or if it is *hidden*. The formatters were originally designed to work based on user interaction.
Fix: ==== We now assert that the RichTextArea is ready (attached and initialized) before performing any actions. We also wrap commands in a try/catch block to catch errors associated with a *hidden* RichTextArea. Since errors vary across browsers, I added some JavaDoc explaining that the formatters should only be used if the RichTextArea is attached, visible, and has been focused at least once. Essentially, this means that the user is or was interacting with it. Testing: ======= I manually tested the change on all browsers and added some unit tests to catch some of the error states. Please review this at http://gwt-code-reviews.appspot.com/49801 Affected files: user/src/com/google/gwt/user/client/ui/RichTextArea.java user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplIE6.java user/src/com/google/gwt/user/client/ui/impl/RichTextAreaImplStandard.java user/test/com/google/gwt/user/client/ui/RichTextAreaTest.java --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---