|
| 1 | +/* istanbul ignore file */ |
1 | 2 | import React from 'react';
|
2 | 3 | import PropTypes from 'prop-types';
|
3 | 4 | import ReactDOM from 'react-dom';
|
@@ -46,10 +47,7 @@ class IframeUploader extends React.Component {
|
46 | 47 |
|
47 | 48 | constructor(props) {
|
48 | 49 | super(props);
|
49 |
| - this.domain = |
50 |
| - typeof document !== 'undefined' && document.domain |
51 |
| - ? document.domain |
52 |
| - : ''; |
| 50 | + this.domain = typeof document !== 'undefined' && document.domain ? document.domain : ''; |
53 | 51 | this.uid = uid();
|
54 | 52 | }
|
55 | 53 |
|
@@ -83,9 +81,7 @@ class IframeUploader extends React.Component {
|
83 | 81 | response = doc.body.innerHTML;
|
84 | 82 | props.onSuccess(response, file);
|
85 | 83 | } catch (err) {
|
86 |
| - log.warning( |
87 |
| - 'cross domain error for Upload. Maybe server should return document.domain script.' |
88 |
| - ); |
| 84 | + log.warning('cross domain error for Upload. Maybe server should return document.domain script.'); |
89 | 85 | response = 'cross-domain';
|
90 | 86 | props.onError(err, null, file);
|
91 | 87 | }
|
@@ -222,14 +218,7 @@ class IframeUploader extends React.Component {
|
222 | 218 | };
|
223 | 219 |
|
224 | 220 | render() {
|
225 |
| - const { |
226 |
| - disabled, |
227 |
| - className, |
228 |
| - children, |
229 |
| - accept, |
230 |
| - name, |
231 |
| - style, |
232 |
| - } = this.props; |
| 221 | + const { disabled, className, children, accept, name, style } = this.props; |
233 | 222 | const { uid } = this;
|
234 | 223 | const iframeName = `${name}-${uid}-iframe`;
|
235 | 224 |
|
@@ -258,11 +247,7 @@ class IframeUploader extends React.Component {
|
258 | 247 | encType="multipart/form-data"
|
259 | 248 | target={iframeName}
|
260 | 249 | >
|
261 |
| - <input |
262 |
| - name="_documentDomain" |
263 |
| - value={this.domain} |
264 |
| - type="hidden" |
265 |
| - /> |
| 250 | + <input name="_documentDomain" value={this.domain} type="hidden" /> |
266 | 251 | <span ref={this.saveDataRef} />
|
267 | 252 | <input
|
268 | 253 | ref={this.saveInputRef}
|
|
0 commit comments