Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80517 views
1
/**
2
* Copyright 2013-2015, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
* @providesModule ReactDOMIframe
10
*/
11
12
'use strict';
13
14
var EventConstants = require("./EventConstants");
15
var LocalEventTrapMixin = require("./LocalEventTrapMixin");
16
var ReactBrowserComponentMixin = require("./ReactBrowserComponentMixin");
17
var ReactClass = require("./ReactClass");
18
var ReactElement = require("./ReactElement");
19
20
var iframe = ReactElement.createFactory('iframe');
21
22
/**
23
* Since onLoad doesn't bubble OR capture on the top level in IE8, we need to
24
* capture it on the <iframe> element itself. There are lots of hacks we could
25
* do to accomplish this, but the most reliable is to make <iframe> a composite
26
* component and use `componentDidMount` to attach the event handlers.
27
*/
28
var ReactDOMIframe = ReactClass.createClass({
29
displayName: 'ReactDOMIframe',
30
tagName: 'IFRAME',
31
32
mixins: [ReactBrowserComponentMixin, LocalEventTrapMixin],
33
34
render: function() {
35
return iframe(this.props);
36
},
37
38
componentDidMount: function() {
39
this.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load');
40
}
41
});
42
43
module.exports = ReactDOMIframe;
44
45