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

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: Fix svg 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-next-line no-restricted-properties
13 var el = document.getElementById(id); 16 var el = document.getElementById(id);
14 return el ? assertInstanceof(el, HTMLElement) : null; 17 return el ? assertInstanceof(el, HTMLElement) : null;
15 } 18 }
16 19
17 // TODO(devlin): This should return SVGElement, but closure compiler is missing 20 // TODO(devlin): This should return SVGElement, but closure compiler is missing
18 // those externs. 21 // those externs.
19 /** 22 /**
20 * Alias for document.getElementById. Found elements must be SVGElements. 23 * Alias for document.getElementById. Found elements must be SVGElements.
21 * @param {string} id The ID of the element to find. 24 * @param {string} id The ID of the element to find.
22 * @return {Element} The found element or null if not found. 25 * @return {Element} The found element or null if not found.
23 */ 26 */
24 function getSVGElement(id) { 27 function getSVGElement(id) {
28 // Disable getElementById restriction here, since it is not suitable for SVG
29 // elements.
30 // eslint-disable-next-line no-restricted-properties
25 var el = document.getElementById(id); 31 var el = document.getElementById(id);
26 return el ? assertInstanceof(el, Element) : null; 32 return el ? assertInstanceof(el, Element) : null;
27 } 33 }
28 34
29 /** 35 /**
30 * Add an accessible message to the page that will be announced to 36 * 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 37 * 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. 38 * other users. It's removed right away so it doesn't clutter the DOM.
33 * @param {string} msg The text to be pronounced. 39 * @param {string} msg The text to be pronounced.
34 */ 40 */
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 }); 521 });
516 } 522 }
517 523
518 /** 524 /**
519 * @param {!Event} e 525 * @param {!Event} e
520 * @return {boolean} Whether a modifier key was down when processing |e|. 526 * @return {boolean} Whether a modifier key was down when processing |e|.
521 */ 527 */
522 function hasKeyModifiers(e) { 528 function hasKeyModifiers(e) {
523 return !!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey); 529 return !!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey);
524 } 530 }
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