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

Side by Side Diff: ui/webui/resources/js/util.js

Issue 2921783003: WebUI: Fix/suppress some existing violations of no-restricted-globals. (Closed)
Patch Set: More Created 3 years, 6 months 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
« no previous file with comments | « ui/webui/resources/js/cr.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // <include src="assert.js"> 5 // <include src="assert.js">
6 6
7 /** 7 /**
8 * Alias for document.getElementById. Found elements must be HTMLElements. 8 * Alias for document.getElementById. Found elements must be HTMLElements.
9 * @param {string} id The ID of the element to find. 9 * @param {string} id The ID of the element to find.
10 * @return {HTMLElement} The found element or null if not found. 10 * @return {HTMLElement} The found element or null if not found.
11 */ 11 */
12 function $(id) { 12 function $(id) {
13 // Disable getElementById restriction here, since we are instructing other
14 // places to re-use the $() that is defined here.
15 /* eslint-disable no-restricted-properties */
Dan Beam 2017/06/02 23:01:58 why not var el = document.getElementById(id); //
dpapad 2017/06/02 23:30:03 Done. I was not aware of eslint-disable-line and e
13 var el = document.getElementById(id); 16 var el = document.getElementById(id);
17 /* eslint-enable no-restricted-properties */
14 return el ? assertInstanceof(el, HTMLElement) : null; 18 return el ? assertInstanceof(el, HTMLElement) : null;
15 } 19 }
16 20
17 // TODO(devlin): This should return SVGElement, but closure compiler is missing 21 // TODO(devlin): This should return SVGElement, but closure compiler is missing
18 // those externs. 22 // those externs.
19 /** 23 /**
20 * Alias for document.getElementById. Found elements must be SVGElements. 24 * Alias for document.getElementById. Found elements must be SVGElements.
21 * @param {string} id The ID of the element to find. 25 * @param {string} id The ID of the element to find.
22 * @return {Element} The found element or null if not found. 26 * @return {Element} The found element or null if not found.
23 */ 27 */
24 function getSVGElement(id) { 28 function getSVGElement(id) {
25 var el = document.getElementById(id); 29 var el = $(id);
26 return el ? assertInstanceof(el, Element) : null; 30 return el ? assertInstanceof(el, Element) : null;
27 } 31 }
28 32
29 /** 33 /**
30 * Add an accessible message to the page that will be announced to 34 * Add an accessible message to the page that will be announced to
31 * users who have spoken feedback on, but will be invisible to all 35 * users who have spoken feedback on, but will be invisible to all
32 * other users. It's removed right away so it doesn't clutter the DOM. 36 * other users. It's removed right away so it doesn't clutter the DOM.
33 * @param {string} msg The text to be pronounced. 37 * @param {string} msg The text to be pronounced.
34 */ 38 */
35 function announceAccessibleMessage(msg) { 39 function announceAccessibleMessage(msg) {
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 }); 535 });
532 } 536 }
533 537
534 /** 538 /**
535 * @param {!Event} e 539 * @param {!Event} e
536 * @return {boolean} Whether a modifier key was down when processing |e|. 540 * @return {boolean} Whether a modifier key was down when processing |e|.
537 */ 541 */
538 function hasKeyModifiers(e) { 542 function hasKeyModifiers(e) {
539 return !!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey); 543 return !!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey);
540 } 544 }
OLDNEW
« no previous file with comments | « ui/webui/resources/js/cr.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698