Widget assumes a flat namespace for options with, apparently, no easy way out.

Widget assumes a flat namespace for options with, apparently, no easy way out.

I'm having an issue with widget options.

Problem : Widget options are assumed to have a flat namespace.

Example: jQuery-UI 1.8 widget factory explicitly assumes something like this:

  1. myOptions = {
      classesWidget: "foo1 foo2",
      classesTitle: "foo3 foo4",
      classesHeader: "foo5 foo6 foo7",
      classesContent: "foo8",
    }






Factors to consider : With more complex widgets comes the tendency to offer more involved configuration. Sometimes this configuration is better classified in a nested fashion.   In other words, widget explicitly rules-out this more appropriate structure if we want to retain defaults for the classes option.
  1. myOptions = {
      classes: {
        widget: "foo1 foo2",
        title: "foo3 foo4",
        header: "foo5 foo6 foo7",
        content: "foo8"
      }
    }








This simply cannot be done because the options $.extend() is hard-wired to the simplest case inside the _createWidget function definition. Double-bummer because we cannot override _createWidget in our widget definition (or can we?). More to the point, why should we?

THEREFORE unless someone has any suggestions, for the next release of the widget factory, how about opening-up how options are to be mapped?  This could be done with a hook early in $.Widget._createWidget()

**--**  Steve