Re: Please re-review changebundle for focus tag

From: Jim Driscoll <Jim.Driscoll_at_Sun.COM>
Date: Wed, 09 Apr 2008 16:12:19 -0700

> I think this code may be problematic:
> UIComponent parentComponent = component.getParent();
> String parentID = parentComponent.getClientId(context);
> String targetID = parentID+":"+forID;
> That assumes that the component's parent is the form, but it may not
> be. While it may not make sense to nest this in something other than
> h:form, someone's bound to do it, and the "failure" of the component
> won't have an obvious cause.

Hrm. That's true. Let me run some tests and see what to do... I guess
I can always change it to just require the "formID:componentID" format,
but I was hoping to not have to. Other components seem to avoid that.

> I think it would be better, also, to add a type="text/javascript"
> attribute to the tag.

Ah, yes. That'll work in all current browsers (IIRC), but it's
incorrect html. I'll fix it.

> In the JS, you call the method before you declare
> it. Does that work? Doesn't seem like it would, but JS engines are
> kinda strange, so I could be wrong. :P

AFAIK, it works fine (Firefox 3) - I've yet to test it in IE - I was
waiting to put it back to do that, since I'm coding on Ubuntu.
In general, if it's going to break anywhere, it'll break on IE, so I
won't consider any JS stuff fully tested until it runs there.... I
didn't see the call order as weird, since I call methods before I
declare them all the time in Java :-) My (limited) understanding of the
JS engine is that once you hit a <script> tag, it reads all the code,
including called files to build an execution space before executing the
first line of code.