| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 @license | 2 @license |
| 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
| 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt | 4 This code may only be used under the BSD style license found at http://polymer.g
ithub.io/LICENSE.txt |
| 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt | 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
| 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt | 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI
BUTORS.txt |
| 7 Code distributed by Google as part of the polymer project is also | 7 Code distributed by Google as part of the polymer project is also |
| 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt | 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN
TS.txt |
| 9 --> | 9 --> |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 type: Boolean, | 69 type: Boolean, |
| 70 value: false | 70 value: false |
| 71 }, | 71 }, |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * Set the withCredentials flag when sending data. | 74 * Set the withCredentials flag when sending data. |
| 75 */ | 75 */ |
| 76 withCredentials: { | 76 withCredentials: { |
| 77 type: Boolean, | 77 type: Boolean, |
| 78 value: false | 78 value: false |
| 79 }, |
| 80 |
| 81 /** |
| 82 * HTTP request headers to send |
| 83 * |
| 84 * Note: setting a `Content-Type` header here will override the value |
| 85 * specified by the `contentType` property of this element. |
| 86 */ |
| 87 headers: { |
| 88 type: Object, |
| 89 value: function() { |
| 90 return {}; |
| 91 } |
| 79 } | 92 } |
| 80 }, | 93 }, |
| 81 /** | 94 /** |
| 82 * Fired if the form cannot be submitted because it's invalid. | 95 * Fired if the form cannot be submitted because it's invalid. |
| 83 * | 96 * |
| 84 * @event iron-form-invalid | 97 * @event iron-form-invalid |
| 85 */ | 98 */ |
| 86 | 99 |
| 87 /** | 100 /** |
| 88 * Fired after the form is submitted. | 101 * Fired after the form is submitted. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 this.fire('iron-form-invalid'); | 143 this.fire('iron-form-invalid'); |
| 131 return; | 144 return; |
| 132 } | 145 } |
| 133 | 146 |
| 134 var json = this.serialize(); | 147 var json = this.serialize(); |
| 135 | 148 |
| 136 this._requestBot.url = this.action; | 149 this._requestBot.url = this.action; |
| 137 this._requestBot.method = this.method; | 150 this._requestBot.method = this.method; |
| 138 this._requestBot.contentType = this.contentType; | 151 this._requestBot.contentType = this.contentType; |
| 139 this._requestBot.withCredentials = this.withCredentials; | 152 this._requestBot.withCredentials = this.withCredentials; |
| 153 this._requestBot.headers = this.headers; |
| 140 | 154 |
| 141 if (this.method.toUpperCase() == 'POST') { | 155 if (this.method.toUpperCase() == 'POST') { |
| 142 this._requestBot.body = json; | 156 this._requestBot.body = json; |
| 143 } else { | 157 } else { |
| 144 this._requestBot.params = json; | 158 this._requestBot.params = json; |
| 145 } | 159 } |
| 146 | 160 |
| 147 this._requestBot.generateRequest(); | 161 this._requestBot.generateRequest(); |
| 148 this.fire('iron-form-submit', json); | 162 this.fire('iron-form-submit', json); |
| 149 }, | 163 }, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 (el.hasAttribute('is') && json[el.name])) { | 215 (el.hasAttribute('is') && json[el.name])) { |
| 202 continue; | 216 continue; |
| 203 } | 217 } |
| 204 addSerializedElement(el); | 218 addSerializedElement(el); |
| 205 } | 219 } |
| 206 | 220 |
| 207 return json; | 221 return json; |
| 208 }, | 222 }, |
| 209 | 223 |
| 210 _handleFormResponse: function (event) { | 224 _handleFormResponse: function (event) { |
| 211 this.fire('iron-form-response', event.detail.response); | 225 this.fire('iron-form-response', event.detail); |
| 212 }, | 226 }, |
| 213 | 227 |
| 214 _handleFormError: function (event) { | 228 _handleFormError: function (event) { |
| 215 this.fire('iron-form-error', event.detail); | 229 this.fire('iron-form-error', event.detail); |
| 216 }, | 230 }, |
| 217 | 231 |
| 218 _registerElement: function(e) { | 232 _registerElement: function(e) { |
| 219 e.target._parentForm = this; | 233 e.target._parentForm = this; |
| 220 this._customElements.push(e.target); | 234 this._customElements.push(e.target); |
| 221 }, | 235 }, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 this.appendChild(fakeSubmit); | 299 this.appendChild(fakeSubmit); |
| 286 | 300 |
| 287 fakeSubmit.click(); | 301 fakeSubmit.click(); |
| 288 | 302 |
| 289 this.removeChild(fakeSubmit); | 303 this.removeChild(fakeSubmit); |
| 290 } | 304 } |
| 291 | 305 |
| 292 }); | 306 }); |
| 293 | 307 |
| 294 </script> | 308 </script> |
| OLD | NEW |