Skip to content

Commit

Permalink
Merge pull request #2293 from arian/fix-2289-setproperty-tostring
Browse files Browse the repository at this point in the history
Fixes #2289 - use '' + value for values passed into setProperty
  • Loading branch information
cpojer committed Feb 16, 2012
2 parents b060531 + 330b1d4 commit 74e3479
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Element/Element.js
Expand Up @@ -631,7 +631,7 @@ Element.implement({
if (pollutesGetAttribute) delete attributeWhiteList[name]; if (pollutesGetAttribute) delete attributeWhiteList[name];
/* </ltIE9> */ /* </ltIE9> */
} else { } else {
this.setAttribute(name, value); this.setAttribute(name, '' + value);
/* <ltIE9> */ /* <ltIE9> */
if (pollutesGetAttribute) attributeWhiteList[name] = true; if (pollutesGetAttribute) attributeWhiteList[name] = true;
/* </ltIE9> */ /* </ltIE9> */
Expand Down
9 changes: 9 additions & 0 deletions Specs/1.4client/Element/Element.js
Expand Up @@ -79,6 +79,15 @@ describe('Element', function(){


}); });


describe('value as object with toString()', function(){

it('should call the toString() method of a passed object', function(){
var a = new Element('a').set('href', {toString: function(){ return '1'; }});
expect(a.get('href')).toEqual('1');
});

});

}); });


describe("Element.setProperty('type')", function(){ describe("Element.setProperty('type')", function(){
Expand Down

0 comments on commit 74e3479

Please sign in to comment.