mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
In an effort to break the DOMy parts of React away from the non-DOMy parts, I'm renaming this.
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
/**
|
|
* 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 ReactDOMOption
|
|
*/
|
|
|
|
"use strict";
|
|
|
|
var ReactCompositeComponent = require('ReactCompositeComponent');
|
|
var ReactDOM = require('ReactDOM');
|
|
|
|
// Store a reference to the <option> `ReactDOMComponent`.
|
|
var option = ReactDOM.option;
|
|
|
|
/**
|
|
* Implements an <option> native component that warns when `selected` is set.
|
|
*/
|
|
var ReactDOMOption = ReactCompositeComponent.createClass({
|
|
|
|
componentWillMount: function() {
|
|
// TODO (yungsters): Remove support for `selected` in <option>.
|
|
if (this.props.selected != null) {
|
|
if (__DEV__) {
|
|
console.warn(
|
|
'Use the `defaultValue` or `value` props on <select> instead of ' +
|
|
'setting `selected` on <option>.'
|
|
);
|
|
}
|
|
}
|
|
},
|
|
|
|
render: function() {
|
|
return option(this.props, this.props.children);
|
|
}
|
|
|
|
});
|
|
|
|
module.exports = ReactDOMOption;
|