Fix for Firefox error when calling 'setSelectionRange' on hidden elements