There is a js object named "HourHand", but it actually a wrapper of a C++ object, in this case, an ImgElement object. The js object wrapper will be created when loading the gadget, see the Initialize() method in ggadget/gadget.cc (line 210-395), especially line 363:
...
if (!main_view_->scriptable()->InitFromXML(main_xml, kMainXML)) {
LOG("Failed to setup the main view");
main_view_->view()->Alert(StringPrintf(GM_("GADGET_LOAD_FAILURE"),
base_path_.c_str()).c_str());
return false;
}
...
You can find the code of InitFromXML() method in ggadget/scriptable_view.cc (line 155-214). You can read this part to see how the main.xml file is loaded. But if you want to understand how does an element is injected into the javascript context, you need to read more code, especially:
ggadget/scriptable_interface.h
ggadget/scriptable_helper.h
ggadget/scriptable_helper.cc
ggadget/script_context_interface.h
Maybe also a real script runtime implementation, eg:
extensions/smjs_script_runtime/*
Regards
James Su