| 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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 this.fire('iron-form-invalid'); | 227 this.fire('iron-form-invalid'); |
| 228 return; | 228 return; |
| 229 } | 229 } |
| 230 | 230 |
| 231 var json = this.serialize(); | 231 var json = this.serialize(); |
| 232 | 232 |
| 233 // Native forms can also index elements magically by their name (can't mak
e | 233 // Native forms can also index elements magically by their name (can't mak
e |
| 234 // this up if I tried) so we need to get the correct attributes, not the | 234 // this up if I tried) so we need to get the correct attributes, not the |
| 235 // elements with those names. | 235 // elements with those names. |
| 236 this.request.url = this.getAttribute('action'); | 236 this.request.url = this.getAttribute('action'); |
| 237 this.request.method = this.getAttribute('method'); | 237 this.request.method = this.getAttribute('method') || 'GET'; |
| 238 this.request.contentType = this.contentType; | 238 this.request.contentType = this.contentType; |
| 239 this.request.withCredentials = this.withCredentials; | 239 this.request.withCredentials = this.withCredentials; |
| 240 this.request.headers = this.headers; | 240 this.request.headers = this.headers; |
| 241 | 241 |
| 242 if (this.request.method.toUpperCase() === 'POST') { | 242 if (this.request.method.toUpperCase() === 'POST') { |
| 243 this.request.body = json; | 243 this.request.body = json; |
| 244 } else { | 244 } else { |
| 245 this.request.params = json; | 245 this.request.params = json; |
| 246 } | 246 } |
| 247 | 247 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 * array of values. | 285 * array of values. |
| 286 * | 286 * |
| 287 * @return {!Object} | 287 * @return {!Object} |
| 288 */ | 288 */ |
| 289 serialize: function() { | 289 serialize: function() { |
| 290 var json = {}; | 290 var json = {}; |
| 291 | 291 |
| 292 function addSerializedElement(name, value) { | 292 function addSerializedElement(name, value) { |
| 293 // If the name doesn't exist, add it. Otherwise, serialize it to | 293 // If the name doesn't exist, add it. Otherwise, serialize it to |
| 294 // an array, | 294 // an array, |
| 295 if (!json[name]) { | 295 if (json[name] === undefined) { |
| 296 json[name] = value; | 296 json[name] = value; |
| 297 } else { | 297 } else { |
| 298 if (!Array.isArray(json[name])) { | 298 if (!Array.isArray(json[name])) { |
| 299 json[name] = [json[name]]; | 299 json[name] = [json[name]]; |
| 300 } | 300 } |
| 301 json[name].push(value); | 301 json[name].push(value); |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 // Go through all of the registered custom components. | 305 // Go through all of the registered custom components. |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 parent._parentForm === this) { | 504 parent._parentForm === this) { |
| 505 return true; | 505 return true; |
| 506 } | 506 } |
| 507 } | 507 } |
| 508 return false; | 508 return false; |
| 509 } | 509 } |
| 510 | 510 |
| 511 }); | 511 }); |
| 512 | 512 |
| 513 </script> | 513 </script> |
| OLD | NEW |