Skip to content

Commit

Permalink
Fixed #1 - Calling API methods by passing a string to the plugin cons…
Browse files Browse the repository at this point in the history
…tructor method
  • Loading branch information
gfranko committed Aug 1, 2013
1 parent 997f7f4 commit 152cd02
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/jqfactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@
};
}
setup = function() {
var firstArg = arguments[0],
var args = slice.call(arguments),
firstArg = args[0],
options = $.isPlainObject(firstArg) ? firstArg : {},
existingElem = props.element,
callingElement = this,
Expand All @@ -82,7 +83,10 @@
rendered;
if (existingInstance) {
existingInstance._init.apply(existingInstance, arguments);
existingInstance._superMethod.apply(existingInstance, arguments);
if($.type(firstArg) === 'string') {
args.shift();
existingInstance[firstArg].apply(existingInstance, args);
}
return;
}
widget = new Plugin(instanceProps);
Expand Down
4 changes: 2 additions & 2 deletions src/jqfactory.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 152cd02

Please sign in to comment.