Skip to content

Commit

Permalink
Solved bug, calling plugin once creates a new instance
Browse files Browse the repository at this point in the history
  • Loading branch information
josex2r committed Nov 6, 2014
1 parent a01f26a commit d53a701
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions dist/jquery.slotmachine.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! SlotMachine - v2.0.6 - 2014-10-16
/*! SlotMachine - v2.0.6 - 2014-11-06
* https://github.com/josex2r/jQuery-SlotMachine
* Copyright (c) 2014 Jose Luis Represa; Licensed MIT */
;(function($, window, document, undefined){
Expand Down Expand Up @@ -535,17 +535,17 @@
*/
function _getInstance(element, options){
var machine;
if ( !$.data(element, 'plugin_' + pluginName) ){
if ( !$.data(element[0], 'plugin_' + pluginName) ){
machine = new SlotMachine(element, options);
var publicObject = {};
for(var name in machine){
if(!name.match(/^_.+$/)){
publicObject[name] = machine[name];
}
}
$.data(element, 'plugin_' + pluginName, publicObject);
$.data(element[0], 'plugin_' + pluginName, publicObject);
}else{
machine = $.data(element, 'plugin_' + pluginName);
machine = $.data(element[0], 'plugin_' + pluginName);
}
return machine;
}
Expand Down
4 changes: 2 additions & 2 deletions dist/jquery.slotmachine.min.js

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

6 changes: 3 additions & 3 deletions src/jquery.slotmachine.js
Original file line number Diff line number Diff line change
Expand Up @@ -539,17 +539,17 @@
*/
function _getInstance(element, options){
var machine;
if ( !$.data(element, 'plugin_' + pluginName) ){
if ( !$.data(element[0], 'plugin_' + pluginName) ){
machine = new SlotMachine(element, options);
var publicObject = {};
for(var name in machine){
if(!name.match(/^_.+$/)){
publicObject[name] = machine[name];
}
}
$.data(element, 'plugin_' + pluginName, publicObject);
$.data(element[0], 'plugin_' + pluginName, publicObject);
}else{
machine = $.data(element, 'plugin_' + pluginName);
machine = $.data(element[0], 'plugin_' + pluginName);
}
return machine;
}
Expand Down

0 comments on commit d53a701

Please sign in to comment.