The problem is, we can't assert that the element isn't visible because that isn't an efficient or reliable thing to check, and we don't really want to throw an exception at runtime in FF if somebody is developing in IE and may not test FF thoroughly. So, I think its better to fail cleanly. If you notice the other methods getCursorPos() and getSelectionLength(), we already silently fail those cases for FF. Thanks, John LaBanca [EMAIL PROTECTED]
On Thu, Sep 18, 2008 at 2:44 PM, Emily Crutcher <[EMAIL PROTECTED]> wrote: > The setSelectionRange() method silently failing seems like a bad idea to > me. If we cannot support it on Firefox, wouldn't it be better to alert the > user of that with a java exception? > > > > On Thu, Sep 18, 2008 at 2:43 PM, John LaBanca <[EMAIL PROTECTED]> wrote: > >> +gwtContrib >> Thanks, >> John LaBanca >> [EMAIL PROTECTED] >> >> >> On Thu, Sep 18, 2008 at 2:21 PM, John LaBanca <[EMAIL PROTECTED]>wrote: >> >>> Emily - >>> Please do a code review on this two-for patch for TextBox. >>> >>> Description: >>> ======== >>> Calling TextBoxBase.setSelectionRange(elem, int, int) throws an exception >>> in FF if the element is either unattached or not visible (ie. display:none). >>> Also, getSelectedText() can throw an exception if the cursorPos is reported >>> as -1, which it can be in IE. >>> >>> Fix: >>> ==== >>> TextBoxBase.setSelectionRange() now checks if an exception occurs and >>> ignores it. getSelectedText() now checks if the cursorPos is -1. >>> >>> Testing: >>> ====== >>> Created unit test for the setSelectionRage() case, and verified the >>> following methods on all main browsers (IE versions of them): >>> selectAll() >>> getSelectionLength() >>> getSelectedText() >>> getCursorPos() >>> setCursorPos() >>> >>> >>> Thanks, >>> John LaBanca >>> [EMAIL PROTECTED] >>> >> >> > > > -- > "There are only 10 types of people in the world: Those who understand > binary, and those who don't" > --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
