Skip to content

Commit

Permalink
Don't use uniqueID in PIE.Util.getUID to avoid the check on non-eleme…
Browse files Browse the repository at this point in the history
…nts. Make getUID for objects only.
  • Loading branch information
Jason Johnston committed Nov 25, 2011
1 parent 887a062 commit 576790b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions sources/Element.js
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,12 @@ PIE.Element = (function() {
}

Element.getInstance = function( el ) {
var id = PIE.Util.getUID( el );
var id = el[ 'uniqueID' ];
return wrappers[ id ] || ( wrappers[ id ] = new Element( el ) );
};

Element.destroy = function( el ) {
var id = PIE.Util.getUID( el ),
var id = el[ 'uniqueID' ],
wrapper = wrappers[ id ];
if( wrapper ) {
wrapper.destroy();
Expand Down
5 changes: 3 additions & 2 deletions sources/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

/**
* Generate and return a unique ID for a given object. The generated ID is stored
* as a property of the object for future reuse. DOM Elements use the builtin uniqueID property.
* as a property of the object for future reuse. For DOM Elements, don't use this
* but use the IE-native uniqueID property instead.
* @param {Object} obj
*/
getUID: function( obj ) {
return obj && obj[ 'uniqueID' ] || obj[ '_pieId' ] || ( obj[ '_pieId' ] = '_' + idNum++ );
return obj && obj[ '_pieId' ] || ( obj[ '_pieId' ] = '_' + idNum++ );
},


Expand Down

0 comments on commit 576790b

Please sign in to comment.