Hi
I wrote code in one of the entry point class as:
if(RootPanel.get("fb-root") != null)
form = new BloodDonorForm(Constants.INSERT, null, Constants.FACEBOOK, Constants.BLOOD_DONOR_REGISTER_FORM);
else
form = new BloodDonorForm(Constants.INSERT, null, null, Constants.BLOOD_DONOR_REGISTER_FORM);
This used to work fine sometime back for sure (don’t remember when I checked this last time). But now when I run the page in Firefox with firebug enabled I see the message like:
The "fb-root" div has not been created, auto-creating
So why is this done if it does not exist? I am sure I have tested this in past and this was not happening earlier.
This may be a change in GWT itself. That said, this isn’t the best way to check for a dom element existing.
Instead, use
Document.get().getElementById(String)to check for an element by id, and compare that with null. This will compile down to something very simple (probably just$doc.getElementById(id)), and won’t create a widget yet (RootPanel is a widget) and the overhead that comes with that.