| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 /** | 220 /** |
| 221 * @param {?string} title | 221 * @param {?string} title |
| 222 * @param {?function(!Event):!Promise} handler | 222 * @param {?function(!Event):!Promise} handler |
| 223 */ | 223 */ |
| 224 setAction(title, handler) { | 224 setAction(title, handler) { |
| 225 if (this._actionElement) | 225 if (this._actionElement) |
| 226 this._actionElement.remove(); | 226 this._actionElement.remove(); |
| 227 if (!title || !handler) | 227 if (!title || !handler) |
| 228 return; | 228 return; |
| 229 this._actionElement = this.element.createChild('div', 'action'); | 229 this._actionElement = this.element.createChild('div', 'action'); |
| 230 var link = this._actionElement.createChild('a', 'action-link'); | 230 var link = this._actionElement.createChild('span', 'action-link'); |
| 231 link.textContent = title; | 231 link.textContent = title; |
| 232 link.addEventListener('click', (event) => { | 232 link.addEventListener('click', (event) => { |
| 233 link.disabled = true; | 233 link.disabled = true; |
| 234 handler(event).then(() => link.disabled = false); | 234 handler(event).then(() => link.disabled = false); |
| 235 event.stopPropagation(); | 235 event.stopPropagation(); |
| 236 }); | 236 }); |
| 237 } | 237 } |
| 238 }; | 238 }; |
| OLD | NEW |