/**1* Copyright 2013-2015, Facebook, Inc.2* All rights reserved.3*4* This source code is licensed under the BSD-style license found in the5* LICENSE file in the root directory of this source tree. An additional grant6* of patent rights can be found in the PATENTS file in the same directory.7*8* @providesModule ReactDOMForm9*/1011'use strict';1213var EventConstants = require("./EventConstants");14var LocalEventTrapMixin = require("./LocalEventTrapMixin");15var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");16var ReactClass = require("./ReactClass");17var ReactElement = require("./ReactElement");1819var form = ReactElement.createFactory('form');2021/**22* Since onSubmit doesn't bubble OR capture on the top level in IE8, we need23* to capture it on the <form> element itself. There are lots of hacks we could24* do to accomplish this, but the most reliable is to make <form> a25* composite component and use `componentDidMount` to attach the event handlers.26*/27var ReactDOMForm = ReactClass.createClass({28displayName: 'ReactDOMForm',29tagName: 'FORM',3031mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],3233render: function() {34// TODO: Instead of using `ReactDOM` directly, we should use JSX. However,35// `jshint` fails to parse JSX so in order for linting to work in the open36// source repo, we need to just use `ReactDOM.form`.37return form(this.props);38},3940componentDidMount: function() {41this.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset');42this.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit');43}44});4546module.exports = ReactDOMForm;474849