Loading ...
Sorry, an error occurred while loading the content.

Re: Multiple YUI instances, Y.Node.getDomNode doesn't work

Expand Messages
  • Luke
    You should create modules for your custom Widgets rather than create them inline in a use() callback. YUI3 s module structure is best used by isolating
    Message 1 of 3 , Oct 1, 2009
    • 0 Attachment
      You should create modules for your custom Widgets rather than create them inline in a use() callback. YUI3's module structure is best used by isolating business logic and instantiable classes in custom modules, and limiting the use() callback code to page-specific logic, gluing the YUI and custom modules together for that page.

      Typically, you shouldn't need to create more than one YUI instance. If I understand your description, you are creating class A as a Widget extension in YUI().use(...function (Y1) { /* in here */ }), then attempting to extend A in YUI().use(...function (Y2) { /* in here */ });

      The code in Y1's use callback is not visible outside that callback unless you purposely make it global (which I hope you aren't doing). So in Y2's use() callback, A will be undefined. Your attempt to extend should fail.

      To help clarify this, we'll need to see some of your code. Try creating a gist at http://gist.github.com/ and link the url in this thread or on http://yuilibrary.com/forum.

      Luke

      --- In yui3@yahoogroups.com, "andrew.bialecki" <andrew.bialecki@...> wrote:
      >
      > I'm not sure if this is intended functionality or not. I have a base widget class that extends Y.Widget and this is located in one YUI().use("widget", function (Y) {}) block. Then in another file I have another block like that where I subclass my base widget class. When I then try to use Y.Node.getDOMNode(this.get("contentBox")), it returns null. When I put the same line in the base class, it returns the correct HTMLElement.
      >
      > I think the problem is that since I'm getting a new instance of the YUI global object, Y.Node doesn't reference the same thing as the Y.Node instance that originally created the "contentBox" node. Or something like this. Maybe this is supposed to happen, but I need a way to split out classes between files.
      >
      > Can anyone make sense of this babbling?
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.