Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/sources/UIList.js

Issue 2527763003: [DevTools] Turn links into spans to prevent default behavior. (Closed)
Patch Set: fixed comments Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698