diff --git a/src/core/ReactDOM.js b/src/core/ReactDOM.js index 0b7c4e3907..2a9749c9be 100644 --- a/src/core/ReactDOM.js +++ b/src/core/ReactDOM.js @@ -80,8 +80,7 @@ var ReactDOM = objMapKeyVal({ embed: true, fieldset: false, footer: false, - // Danger: this gets monkeypatched! See ReactDOMForm for more info. - form: false, + form: false, // NOTE: Injected, see `ReactDOMForm`. h1: false, h2: false, h3: false, @@ -116,8 +115,7 @@ var ReactDOM = objMapKeyVal({ table: false, tbody: false, td: false, - // Danger: this gets monkeypatched! See ReactDOMTextarea for more info. - textarea: false, + textarea: false, // NOTE: Injected, see `ReactDOMTextarea`. tfoot: false, th: false, thead: false, diff --git a/src/core/ReactDOMTextarea.js b/src/core/ReactDOMTextarea.js deleted file mode 100644 index a9f22e0b65..0000000000 --- a/src/core/ReactDOMTextarea.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright 2013 Facebook, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * @providesModule ReactDOMTextarea - */ - -"use strict"; - -var ReactCompositeComponent = require('ReactCompositeComponent'); -var ReactDOM = require('ReactDOM'); - -var invariant = require('invariant'); - -// Store a reference to the ); - var node = stub.getDOMNode(); - - expect(node.value).toEqual('giraffe'); - - stub.replaceProps({ children: 'gorilla' }); - expect(node.value).toEqual('gorilla'); - - stub.replaceProps({ children: 17 }); - expect(node.value).toEqual('17'); - - stub.replaceProps({ children: [42] }); - expect(node.value).toEqual('42'); - - stub.replaceProps({ children: null }); - expect(node.value).toEqual(''); - - stub.replaceProps({ content: 'eggplant' }); - expect(node.value).toEqual('eggplant'); - }); - - it("should throw with multiple or invalid children", function() { - expect(function() { - ReactTestUtils.renderIntoDocument( - - ); - }).toThrow(); - - expect(function() { - ReactTestUtils.renderIntoDocument( - - ); - }).toThrow(); - }); -}); diff --git a/src/dom/components/ReactDOMTextarea.js b/src/dom/components/ReactDOMTextarea.js new file mode 100644 index 0000000000..ddba826a23 --- /dev/null +++ b/src/dom/components/ReactDOMTextarea.js @@ -0,0 +1,129 @@ +/** + * Copyright 2013 Facebook, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * @providesModule ReactDOMTextarea + */ + +"use strict"; + +var DOMPropertyOperations = require('DOMPropertyOperations'); +var ReactCompositeComponent = require('ReactCompositeComponent'); +var ReactDOM = require('ReactDOM'); + +var invariant = require('invariant'); +var merge = require('merge'); + +// Store a reference to the ; + var node = renderTextarea(stub); + + expect(node.value).toBe('giraffe'); + + // Changing children should do nothing, it functions like `defaultValue`. + stub.replaceProps({children: 'gorilla'}); + expect(node.value).toEqual('giraffe'); + }); + + it('should allow numbers as children', function() { + var node = renderTextarea(); + expect(node.value).toBe('17'); + }); + + it("should throw with multiple or invalid children", function() { + expect(function() { + ReactTestUtils.renderIntoDocument( + + ); + }).toThrow(); + + expect(function() { + ReactTestUtils.renderIntoDocument( + + ); + }).toThrow(); + }); +});