diff --git a/src/htmltojsx.js b/src/htmltojsx.js index 9639256..428945d 100644 --- a/src/htmltojsx.js +++ b/src/htmltojsx.js @@ -367,8 +367,8 @@ HTMLtoJSX.prototype = { } if (tagName === 'textarea') { - // Hax: textareas need their inner text moved to a "value" attribute. - attributes.push('value={' + JSON.stringify(node.value) + '}'); + // Hax: textareas need their inner text moved to a "defaultValue" attribute. + attributes.push('defaultValue={' + JSON.stringify(node.value) + '}'); } if (tagName === 'pre') { this._inPreTag = true; @@ -413,7 +413,7 @@ HTMLtoJSX.prototype = { */ _isSelfClosing: function(node) { // If it has children, it's not self-closing - // Exception: All children of a textarea are moved to a "value" attribute. + // Exception: All children of a textarea are moved to a "defaultValue" attribute. return !node.firstChild || node.tagName.toLowerCase() === 'textarea'; }, @@ -426,7 +426,7 @@ HTMLtoJSX.prototype = { var parentTag = node.parentNode && node.parentNode.tagName.toLowerCase(); if (parentTag === 'textarea') { // Ignore text content of textareas, as it will have already been moved - // to a "value" attribute. + // to a "defaultValue" attribute. return; } diff --git a/test/htmltojsx-test.js b/test/htmltojsx-test.js index d9db064..275c072 100644 --- a/test/htmltojsx-test.js +++ b/test/htmltojsx-test.js @@ -235,10 +235,10 @@ describe('htmltojsx', function() { }); describe('special tags', function() { - it('should use "value" for textareas', function() { + it('should use "defaultValue" for textareas', function() { var converter = new HTMLtoJSX({ createClass: false }); expect(converter.convert('').trim()) - .toBe(''); + .toBe(''); }); it('should do magic voodoo for
', function() {