|
96 | 96 | // legacy
|
97 | 97 | options.upload(options, _this);
|
98 | 98 |
|
99 |
| - xhr = document.createElement('div'); |
100 |
| - xhr.innerHTML = '<form target="'+ uid +'" action="'+ url +'" method="POST" enctype="multipart/form-data" style="position: absolute; top: -1000px; overflow: hidden; width: 1px; height: 1px;">' |
101 |
| - + '<iframe name="'+ uid +'" src="javascript:false;" onload="' + onloadFuncName + '()"></iframe>' |
102 |
| - + (jsonp && (options.url.indexOf('=?') < 0) ? '<input value="'+ uid +'" name="'+jsonp+'" type="hidden"/>' : '') |
103 |
| - + '</form>' |
104 |
| - ; |
105 |
| - |
106 |
| - // get form-data & transport |
107 |
| - var |
108 |
| - form = xhr.getElementsByTagName('form')[0] |
109 |
| - , transport = xhr.getElementsByTagName('iframe')[0] |
110 |
| - ; |
111 |
| - |
112 |
| - form.appendChild(data); |
113 |
| - |
114 |
| - api.log(form.parentNode.innerHTML); |
115 |
| - |
116 |
| - // append to DOM |
117 |
| - document.body.appendChild(xhr); |
118 |
| - |
119 |
| - // keep a reference to node-transport |
120 |
| - _this.xhr.node = xhr; |
121 |
| - |
122 | 99 | var
|
123 | 100 | onPostMessage = function (evt){
|
124 | 101 | if( ~url.indexOf(evt.origin) ){
|
|
169 | 146 | }
|
170 | 147 | };
|
171 | 148 |
|
| 149 | + xhr = document.createElement('div'); |
| 150 | + xhr.innerHTML = '<form target="'+ uid +'" action="'+ url +'" method="POST" enctype="multipart/form-data" style="position: absolute; top: -1000px; overflow: hidden; width: 1px; height: 1px;">' |
| 151 | + + '<iframe name="'+ uid +'" src="javascript:false;" onload="' + onloadFuncName + '()"></iframe>' |
| 152 | + + (jsonp && (options.url.indexOf('=?') < 0) ? '<input value="'+ uid +'" name="'+jsonp+'" type="hidden"/>' : '') |
| 153 | + + '</form>' |
| 154 | + ; |
| 155 | + |
| 156 | + // get form-data & transport |
| 157 | + var |
| 158 | + form = xhr.getElementsByTagName('form')[0] |
| 159 | + , transport = xhr.getElementsByTagName('iframe')[0] |
| 160 | + ; |
| 161 | + |
| 162 | + form.appendChild(data); |
| 163 | + |
| 164 | + api.log(form.parentNode.innerHTML); |
| 165 | + |
| 166 | + // append to DOM |
| 167 | + document.body.appendChild(xhr); |
| 168 | + |
| 169 | + // keep a reference to node-transport |
| 170 | + _this.xhr.node = xhr; |
| 171 | + |
172 | 172 | // send
|
173 | 173 | _this.readyState = 2; // loaded
|
174 | 174 | form.submit();
|
|
0 commit comments