What is the this.widget() method supposed to return from a Widget Factory widget?
Hi folks,
I have been exploring the latest version of the Widget Factory as described in the
upgrade doc. There is a section about the new widget() method that says
A new common method has been added, called
widget
. This method will return the
.ui-{pluginname}
element. Depending on the plugin, in many cases this is different than the original element, otherwise it will return the original element.
But it didn't behave as I expected when I experimented with it.
I have a widget that I am creating a new element in. To this.element I am adding a class this.widgetBaseClass + "-source" and to my new spawned element I am giving the class this.widgetBaseClass.
According to the documentation, then, when I try alert(this.widget().attr("class")) I would expect to see this.widgetBaseClass but I am getting back this.widgetBaseClass + "-source".
I got the latest version of jquery.gd.widget.js to see what it is doing and the widget method looks like this:
- widget: function() {
- return this.element;
- }
So what is going on? Are the upgrade notes just mistaken? That just returns the same as this.element, not the element decorated with the baseClass. I would love for it to work as described, but the source looks like it's not actually implemented.
Any enlightenment appreciated!
Thanks.