Thursday, 12 July 2012

com.google.gwt.core.client.JavaScriptException: (TypeError): Object [object Window] has no method 'removeAttribute'


I got following error in my gwt project. The error sounds cool.


10:29:17.381 [ERROR] [projectname] Uncaught exception escaped
com.google.gwt.core.client.JavaScriptException: (TypeError): Object [object Window] has no method 'removeAttribute'
    at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:248)
    at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
    at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
    at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
    at com.google.gwt.dom.client.Element$.removeAttribute$(Element.java)
    at com.google.gwt.user.cellview.client.AbstractHasData.setFocusable(AbstractHasData.java:887)
    at com.google.gwt.user.cellview.client.AbstractCellTable.setKeyboardSelected(AbstractCellTable.java:1366)
    at com.google.gwt.user.cellview.client.AbstractHasData$View.setKeyboardSelected(AbstractHasData.java:125)
    at com.google.gwt.user.cellview.client.HasDataPresenter.resolvePendingState(HasDataPresenter.java:1417)
    at com.google.gwt.user.cellview.client.HasDataPresenter.access$3(HasDataPresenter.java:1130)
    at com.google.gwt.user.cellview.client.HasDataPresenter$2.execute(HasDataPresenter.java:1055)
    at com.google.gwt.core.client.impl.SchedulerImpl$Task$.executeScheduled$(SchedulerImpl.java:50)
    at com.google.gwt.core.client.impl.SchedulerImpl.runScheduledTasks(SchedulerImpl.java:228)
    at com.google.gwt.core.client.impl.SchedulerImpl.flushFinallyCommands(SchedulerImpl.java:327)
    at com.google.gwt.core.client.impl.Impl.exit(Impl.java:237)
    at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:228)
    at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
    at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
    at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
    at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    at java.lang.Thread.run(Thread.java:722)


As posted at Issue 7348: http://code.google.com/p/google-web-toolkit/issues/detail?id=7348 which mentions Without ui:field attribute, everything is fine.




SOLUTION
Here is what JavaScript removeAttribute does http://www.w3schools.com/jsref/met_element_removeattribute.asp