Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2293 from arian/fix-2289-setproperty-tostring

Fixes #2289 - use '' + value for values passed into setProperty
  • Loading branch information...
commit 74e34796f5f76640cdb98853004650aea1499d69 2 parents b060531 + 330b1d4
@cpojer cpojer authored
Showing with 10 additions and 1 deletion.
  1. +1 −1  Source/Element/Element.js
  2. +9 −0 Specs/1.4client/Element/Element.js
View
2  Source/Element/Element.js
@@ -631,7 +631,7 @@ Element.implement({
if (pollutesGetAttribute) delete attributeWhiteList[name];
/* </ltIE9> */
} else {
- this.setAttribute(name, value);
+ this.setAttribute(name, '' + value);
/* <ltIE9> */
if (pollutesGetAttribute) attributeWhiteList[name] = true;
/* </ltIE9> */
View
9 Specs/1.4client/Element/Element.js
@@ -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(){
Please sign in to comment.
Something went wrong with that request. Please try again.