http://helma.org/bugs/show_bug.cgi?id=618 Summary: Scope problem
Product: Helma
Version: 1.6.2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P1
Component: Prototype/Script Management
AssignedTo:
helma-dev@...
ReportedBy:
robert@...
I discovered a weird scope problem in Helma when using a property of a
HopObject constructor method. What i did is basically this (in Root/Root.js):
Root.obj = {
render: function(skinName) {
renderSkin(skinName);
return;
}
}
The weird thing (to me) is that calling the method Root.obj.render("test")
doesn't render the skin "test" of Global, but of Root prototype. Inspecting
renderSkin.__parent__ reveals that the parent of the renderSkin method is not
the global object (as i would have expected), but the HopObject prototype.
Furthermore i have no explanation why renderSkin still finds the skin defined
in the Root directory (i would have expected it to search for the skin in the
HopObject directory).
The obvious solution/workaround is to explicitly call global.renderSkin(),
nevertheless i was wondering if it's a bug or if there's an explanation for
this behaviour. Btw.: this behaviour however does not occur if i omit the
object "obj" and instead define the function as Root.render =
function(skinName) {...}
I'll attach a test application.
--
Configure bugmail:
http://helma.org/bugs/userprefs.cgi?tab=email------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
_______________________________________________
Helma-dev mailing list
Helma-dev@...
http://helma.org/mailman/listinfo/helma-dev