You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a plugin instance is created, it is stored on the original DOM element using jQuery.data, with the plugin name as the key
That vaguely suggests that the plugin name is used as the key, and one may wonder whether the namespace is included, and how it is joined to the plugin name
The code example seems to clear any possible dubt:
var bar = $( "<div />")
.appendTo( "body" )
.progressbar()
.data( "progressbar" );
The namespace is omitted. And that's wrong. That will never work.
The example was so clear and unambiguous (but wrong) that it led me to think that there was an actual bug in the software, which I wrongly reported. http://bugs.jqueryui.com/ticket/10123#comment:2
The namespace is infact needed, and it must be joined to the plugin name with a hyphen.
That should be stated explicitely, and the example code fixed:
var bar = $( "<div />")
.appendTo( "body" )
.progressbar()
.data( "nmk-progressbar" );
The text was updated successfully, but these errors were encountered:
The part about retrieving the plugin instance from the dom element using .data() was vague about the key used: it said "the plugin name" without mentioning that the full name is needed, including the namespace and a hyphen as a separator. The code example was plain wrong, using only the bare plugin name, which would not work.
Fixesjquery#515Closesjquery#516
I think the example given is still misleading even with the namespace clarified, i.e. nmk-progressbar.
The issue is that .progressbar() actually creates an instance of the Progressbar Widget of jQuery UI (https://api.jqueryui.com/progressbar/#quick-nav ) rather than one of the nmk-progressbar built
with Widget Factory.
The code snippet happens to make it being able to access the plugin instance of nmk-progressbar
by using the key "nmk-progressbar", which does run successfully but incorrect in meaning. var bar = $( "<div />") .appendTo( "body" ) .progressbar() .data( "nmk-progressbar" );
As considering the context in the article is with jQuery UI Widget Factory, this suggests audiences
that it is a way, using .progressbar(), to make an instance of the plugin nmk-progressbar.
I hope I am not wrong and expect for comments from anyone experienced.
Thanks ^_^
http://learn.jquery.com/plugins/stateful-plugins-with-widget-factory/#the-widget-factory-under-the-hood
That vaguely suggests that the plugin name is used as the key, and one may wonder whether the namespace is included, and how it is joined to the plugin name
The code example seems to clear any possible dubt:
The namespace is omitted. And that's wrong. That will never work.
The example was so clear and unambiguous (but wrong) that it led me to think that there was an actual bug in the software, which I wrongly reported.
http://bugs.jqueryui.com/ticket/10123#comment:2
The namespace is infact needed, and it must be joined to the plugin name with a hyphen.
That should be stated explicitely, and the example code fixed:
The text was updated successfully, but these errors were encountered: