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

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

Issue 2603443002: Clang format JS: Disallow single line functions, conditionals, loops, and switch statements (Closed)
Patch Set: update c/b/r/ as well Created 3 years, 12 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
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.
(...skipping 22 matching lines...) Expand all
33 * @param {string} msg The text to be pronounced. 33 * @param {string} msg The text to be pronounced.
34 */ 34 */
35 function announceAccessibleMessage(msg) { 35 function announceAccessibleMessage(msg) {
36 var element = document.createElement('div'); 36 var element = document.createElement('div');
37 element.setAttribute('aria-live', 'polite'); 37 element.setAttribute('aria-live', 'polite');
38 element.style.position = 'fixed'; 38 element.style.position = 'fixed';
39 element.style.left = '-9999px'; 39 element.style.left = '-9999px';
40 element.style.height = '0px'; 40 element.style.height = '0px';
41 element.innerText = msg; 41 element.innerText = msg;
42 document.body.appendChild(element); 42 document.body.appendChild(element);
43 window.setTimeout(function() { document.body.removeChild(element); }, 0); 43 window.setTimeout(function() {
44 document.body.removeChild(element);
45 }, 0);
44 } 46 }
45 47
46 /** 48 /**
47 * Generates a CSS url string. 49 * Generates a CSS url string.
48 * @param {string} s The URL to generate the CSS url for. 50 * @param {string} s The URL to generate the CSS url for.
49 * @return {string} The CSS url string. 51 * @return {string} The CSS url string.
50 */ 52 */
51 function url(s) { 53 function url(s) {
52 // http://www.w3.org/TR/css3-values/#uris 54 // http://www.w3.org/TR/css3-values/#uris
53 // Parentheses, commas, whitespace characters, single quotes (') and double 55 // Parentheses, commas, whitespace characters, single quotes (') and double
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 // </if> /* is_ios */ 518 // </if> /* is_ios */
517 519
518 /** 520 /**
519 * Helper to convert callback-based define() API to a promise-based API. 521 * Helper to convert callback-based define() API to a promise-based API.
520 * @suppress {undefinedVars} 522 * @suppress {undefinedVars}
521 * @param {!Array<string>} moduleNames 523 * @param {!Array<string>} moduleNames
522 * @return {!Promise} 524 * @return {!Promise}
523 */ 525 */
524 function importModules(moduleNames) { 526 function importModules(moduleNames) {
525 return new Promise(function(resolve) { 527 return new Promise(function(resolve) {
526 define(moduleNames, function() { resolve(Array.from(arguments)); }); 528 define(moduleNames, function() {
529 resolve(Array.from(arguments));
530 });
527 }); 531 });
528 } 532 }
529 533
530 /** 534 /**
531 * @param {!Event} e 535 * @param {!Event} e
532 * @return {boolean} Whether a modifier key was down when processing |e|. 536 * @return {boolean} Whether a modifier key was down when processing |e|.
533 */ 537 */
534 function hasKeyModifiers(e) { 538 function hasKeyModifiers(e) {
535 return !!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey); 539 return !!(e.altKey || e.ctrlKey || e.metaKey || e.shiftKey);
536 } 540 }
OLDNEW
« no previous file with comments | « ui/webui/resources/js/promise_resolver.js ('k') | ui/webui/resources/js/web_ui_listener_behavior.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698