diff --git a/envjs/css.js b/envjs/css.js index f5bd5fb0..d36deac4 100644 --- a/envjs/css.js +++ b/envjs/css.js @@ -140,7 +140,7 @@ Envjs.once('tick', function(){ exports.CSS2Properties = CSS2Properties = function(element){ //console.log('css2properties %s', __cssproperties__++); - this.styleIndex = __supportedStyles__;//non-standard + this.styleIndex = __extend__({}, __supportedStyles__);//non-standard this.type = element.tagName;//non-standard __setArray__(this, []); __cssTextToStyles__(this, element.cssText || ''); diff --git a/specs/css/spec.js b/specs/css/spec.js index 8383924b..a3593eae 100644 --- a/specs/css/spec.js +++ b/specs/css/spec.js @@ -94,6 +94,16 @@ test('CSS2Properties', function(){ equals(div.style.cssText, 'display: block; height: 300px; width: 400px; opacity: 0.5; position: absolute;', '.style.cssText'); }); +test('CSS2Properties uniqueness', function(){ + var div = document.createElement('div'); + var div2 = document.createElement('div'); + div.setAttribute('style', 'top:5px;'); + div2.setAttribute('style', 'top:10px;'); + + equals(div.style.top, '5px'); + equals(div2.style.top, '10px'); +}); + test('document.styleSheets', function() { ok(document.styleSheets, 'document.styleSheets exists'); equals(document.styleSheets.toString(), '[object StyleSheetList]', 'StyleSheetsList.toString()'); diff --git a/src/css/properties.js b/src/css/properties.js index 4c30ac8e..202ba448 100644 --- a/src/css/properties.js +++ b/src/css/properties.js @@ -35,7 +35,7 @@ Envjs.once('tick', function(){ exports.CSS2Properties = CSS2Properties = function(element){ //console.log('css2properties %s', __cssproperties__++); - this.styleIndex = __supportedStyles__;//non-standard + this.styleIndex = __extend__({}, __supportedStyles__);//non-standard this.type = element.tagName;//non-standard __setArray__(this, []); __cssTextToStyles__(this, element.cssText || '');