Permalink
Browse files

Land: setting textarea.value to markup should not be parsed (Andreas …

…Lind Petersen)
  • Loading branch information...
2 parents 41b4664 + d41a58f commit 985d03f670e2c420011d36114f9c5713360c5339 @tmpvar committed Nov 20, 2011
Showing with 10 additions and 4 deletions.
  1. +3 −3 lib/jsdom/level2/html.js
  2. +7 −1 test/jsdom/index.js
View
@@ -907,7 +907,7 @@ define('HTMLTextAreaElement', {
proto: {
_initDefaultValue: function() {
if (this._defaultValue === undefined) {
- this._defaultValue = this.innerHTML;
+ this._defaultValue = this.textContent;
}
return this._defaultValue;
},
@@ -918,11 +918,11 @@ define('HTMLTextAreaElement', {
return this._initDefaultValue();
},
get value() {
- return this.innerHTML;
+ return this.textContent;
},
set value(val) {
this._initDefaultValue();
- this.innerHTML = val;
+ this.textContent = val;
},
get type() {
return 'textarea';
View
@@ -1184,7 +1184,13 @@ document.write("<SCR"+"IPT TYPE=\'text/javascript\' SRC=\'...\'><\/SCR"+"IPT>");
test.equal(e, null);
test.done();
});
- }
+ },
+ issue_361_textarea_value_property: function (test) {
+ var doc = jsdom.html('<html><body><textarea id="mytextarea"></textarea></body></html>');
+ doc.getElementById('mytextarea').value = '<foo>';
+ test.equal(doc.getElementById('mytextarea').value, '<foo>');
+ test.done();
+ }
};

0 comments on commit 985d03f

Please sign in to comment.