@@ -19,6 +19,7 @@ var upperCaseRegExp = new RegExp('[A-Z]+');
1919
2020// Object pools by component, created upon registration.
2121var objectPools = { } ;
22+ var emptyInitialOldData = Object . freeze ( { } ) ;
2223
2324/**
2425 * Component class definition.
@@ -203,6 +204,7 @@ Component.prototype = {
203204 // If value is an object, copy it to our pooled newAttrValue object to use to update
204205 // the attrValue.
205206 tempObject = this . objectPool . use ( ) ;
207+ utils . objectPool . clearObject ( tempObject ) ;
206208 newAttrValue = utils . extend ( tempObject , value ) ;
207209 } else {
208210 newAttrValue = this . parseAttrValueForCache ( value ) ;
@@ -223,7 +225,7 @@ Component.prototype = {
223225 }
224226 utils . objectPool . clearObject ( this . attrValue ) ;
225227 this . attrValue = extendProperties ( this . attrValue , newAttrValue , this . isObjectBased ) ;
226- utils . objectPool . clearObject ( tempObject ) ;
228+ this . objectPool . recycle ( tempObject ) ;
227229 } ,
228230
229231 /**
@@ -271,7 +273,7 @@ Component.prototype = {
271273 *
272274 * @param {string } attrValue - HTML attribute value.
273275 * If undefined, use the cached attribute value and continue updating properties.
274- * @param {boolean } clobber - The previous component data is overwritten by the atrrValue .
276+ * @param {boolean } clobber - The previous component data is overwritten by the attrValue .
275277 */
276278 updateProperties : function ( attrValue , clobber ) {
277279 var el = this . el ;
@@ -324,9 +326,8 @@ Component.prototype = {
324326
325327 // For oldData, pass empty object to multiple-prop schemas or object single-prop schema.
326328 // Pass undefined to rest of types.
327- initialOldData = this . isObjectBased ? this . objectPool . use ( ) : undefined ;
329+ initialOldData = this . isObjectBased ? emptyInitialOldData : undefined ;
328330 this . update ( initialOldData ) ;
329- if ( this . isObjectBased ) { this . objectPool . recycle ( initialOldData ) ; }
330331
331332 // Play the component if the entity is playing.
332333 if ( el . isPlaying ) { this . play ( ) ; }
0 commit comments