Browser compatibility of GWT

1 view
Skip to first unread message

Neeraj Upreti

unread,
Jun 6, 2007, 9:50:23 AM6/6/07
to Google Web Toolkit
Hi all,

I want to discuss a particular code snippet :

HTML html = new HTML(" ");
if (" ".equals(html.getText))
{
Window.alert("Hello");
}

This condition holds true in Internet Explorer but fails in FireFox.

Also I am not able to identify what firefox returns for getText
method.

Anyone can verify this and please tell me why it is happening.

Thanks in advance,
neeraj Upreti

AthlonRob

unread,
Jun 6, 2007, 10:15:18 AM6/6/07
to Google Web Toolkit
Label label = new Label(html.getText()) perhaps?

krispy

unread,
Jun 6, 2007, 10:34:42 AM6/6/07
to Google Web Toolkit
Yeah - you can't call getText() and expect to get what you put into
the HTML constructor. The HTML constructor sets the "innerHTML",
whereas the Label getText() (since HTML extends Label) pulls data from
the DOM.getInnerText() call. If you want to see what you put in the
HTML widget, call html.getHTML().

HTML html = new HTML(" ");

if (" ".equals(html.getHTML()))
{
Window.alert("Hello");
}

Hopefully, that's more consistent.

-krispy

Neeraj Upreti

unread,
Jun 7, 2007, 1:06:13 AM6/7/07
to Google Web Toolkit
Thanks Krispy,

getHTML gave correct result where that particular code snippet was
used ... " " was returned from the getHTML method and this
value was actually required (ie the value by which the HTML object was
initialized).

Best Regards,
Neeraj Upreti

Reply all
Reply to author
Forward
0 new messages