Commit ffdd8ad5 authored by Fergal Daly's avatar Fergal Daly Committed by Commit Bot

Reformat all of our .mjs files with clang-format --style=file

Tweak space-before-function-paren rules to be comatible with clang-format.

Change-Id: I686766972996f652a8ffe15f724227279117bbb6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1767284
Commit-Queue: Fergal Daly <fergal@chromium.org>
Reviewed-by: default avatarDomenic Denicola <domenic@chromium.org>
Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#690266}
parent d20f64b9
...@@ -272,7 +272,8 @@ module.exports = { ...@@ -272,7 +272,8 @@ module.exports = {
'space-before-function-paren': [ 'space-before-function-paren': [
'error', 'error',
{ {
anonymous: 'always', anonymous: 'never',
asyncArrow: 'always',
named: 'never' named: 'never'
} }
], ],
......
...@@ -37,7 +37,7 @@ function installGetter(proto, propName, getter) { ...@@ -37,7 +37,7 @@ function installGetter(proto, propName, getter) {
export function installPropertiesAndFunctions(proto, internals) { export function installPropertiesAndFunctions(proto, internals) {
reflection.installBool(proto, 'disabled'); reflection.installBool(proto, 'disabled');
reflection.installString(proto, 'name'); reflection.installString(proto, 'name');
installGetter(proto, 'type', function () { installGetter(proto, 'type', function() {
if (!(this instanceof proto.constructor)) { if (!(this instanceof proto.constructor)) {
throw new TypeError( throw new TypeError(
'The context object is not an instance of ' + proto.contructor.name); 'The context object is not an instance of ' + proto.contructor.name);
...@@ -45,28 +45,28 @@ export function installPropertiesAndFunctions(proto, internals) { ...@@ -45,28 +45,28 @@ export function installPropertiesAndFunctions(proto, internals) {
return this.localName; return this.localName;
}); });
installGetter(proto, 'form', function () { installGetter(proto, 'form', function() {
return this[internals].form; return this[internals].form;
}); });
installGetter(proto, 'willValidate', function () { installGetter(proto, 'willValidate', function() {
return this[internals].willValidate; return this[internals].willValidate;
}); });
installGetter(proto, 'validity', function () { installGetter(proto, 'validity', function() {
return this[internals].validity; return this[internals].validity;
}); });
installGetter(proto, 'validationMessage', function () { installGetter(proto, 'validationMessage', function() {
return this[internals].validationMessage; return this[internals].validationMessage;
}); });
installGetter(proto, 'labels', function () { installGetter(proto, 'labels', function() {
return this[internals].labels; return this[internals].labels;
}); });
proto.checkValidity = function () { proto.checkValidity = function() {
return this[internals].checkValidity(); return this[internals].checkValidity();
}; };
proto.reportValidity = function () { proto.reportValidity = function() {
return this[internals].reportValidity(); return this[internals].reportValidity();
}; };
proto.setCustomValidity = function (error) { proto.setCustomValidity = function(error) {
if (error === undefined) { if (error === undefined) {
throw new TypeError('Too few arguments'); throw new TypeError('Too few arguments');
} }
......
...@@ -2,10 +2,11 @@ ...@@ -2,10 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
import * as face from './face_utils.mjs';
import * as reflection from '../internal/reflection.mjs'; import * as reflection from '../internal/reflection.mjs';
import {SwitchTrack} from './track.mjs';
import * as face from './face_utils.mjs';
import * as style from './style.mjs'; import * as style from './style.mjs';
import {SwitchTrack} from './track.mjs';
const generateStyleSheet = style.styleSheetFactory(); const generateStyleSheet = style.styleSheetFactory();
...@@ -33,8 +34,9 @@ export class StdSwitchElement extends HTMLElement { ...@@ -33,8 +34,9 @@ export class StdSwitchElement extends HTMLElement {
constructor() { constructor() {
super(); super();
if (new.target !== StdSwitchElement) { if (new.target !== StdSwitchElement) {
throw new TypeError('Illegal constructor: StdSwitchElement is not ' + throw new TypeError(
'extensible for now'); 'Illegal constructor: StdSwitchElement is not ' +
'extensible for now');
} }
this[_internals] = this.attachInternals(); this[_internals] = this.attachInternals();
this._initializeDOM(); this._initializeDOM();
......
...@@ -114,8 +114,8 @@ export class StdToastElement extends HTMLElement { ...@@ -114,8 +114,8 @@ export class StdToastElement extends HTMLElement {
get action() { get action() {
return this.#actionSlot.assignedNodes().length !== 0 ? return this.#actionSlot.assignedNodes().length !== 0 ?
this.#actionSlot.assignedNodes()[0] : this.#actionSlot.assignedNodes()[0] :
null; null;
} }
set action(val) { set action(val) {
...@@ -173,8 +173,9 @@ export class StdToastElement extends HTMLElement { ...@@ -173,8 +173,9 @@ export class StdToastElement extends HTMLElement {
show({duration = DEFAULT_DURATION} = {}) { show({duration = DEFAULT_DURATION} = {}) {
if (duration <= 0) { if (duration <= 0) {
throw new RangeError(`Invalid Argument: duration must be greater ` + throw new RangeError(
`than 0 [${duration} given]`); `Invalid Argument: duration must be greater ` +
`than 0 [${duration} given]`);
} }
this.setAttribute('open', ''); this.setAttribute('open', '');
...@@ -224,12 +225,7 @@ delete StdToastElement.prototype.connectedCallback; ...@@ -224,12 +225,7 @@ delete StdToastElement.prototype.connectedCallback;
export function showToast(message, options = {}) { export function showToast(message, options = {}) {
const toast = new StdToastElement(message); const toast = new StdToastElement(message);
const { const {action, closeButton, type, ...showOptions} = options;
action,
closeButton,
type,
...showOptions
} = options;
if (isElement(action)) { if (isElement(action)) {
toast.action = action; toast.action = action;
...@@ -258,8 +254,7 @@ export function showToast(message, options = {}) { ...@@ -258,8 +254,7 @@ export function showToast(message, options = {}) {
return toast; return toast;
} }
const idGetter = const idGetter = Object.getOwnPropertyDescriptor(Element.prototype, 'id').get;
Object.getOwnPropertyDescriptor(Element.prototype, 'id').get;
function isElement(value) { function isElement(value) {
try { try {
idGetter.call(value); idGetter.call(value);
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* @param {!Set} a A set of elements. * @param {!Set} a A set of elements.
* @param {!Set} b A set of elements. * @param {!Set} b A set of elements.
*/ */
export function difference(a, b) { export function difference(a, b) {
const result = new Set(); const result = new Set();
for (const element of a) { for (const element of a) {
......
...@@ -45,10 +45,8 @@ const StorageAreaAsyncIteratorPrototype = { ...@@ -45,10 +45,8 @@ const StorageAreaAsyncIteratorPrototype = {
}; };
Object.defineProperty( Object.defineProperty(
StorageAreaAsyncIteratorPrototype, StorageAreaAsyncIteratorPrototype, Symbol.toStringTag,
Symbol.toStringTag, {writable: false, enumerable: false});
{writable: false, enumerable: false}
);
function getNextIterResult(iter, performDatabaseOperation) { function getNextIterResult(iter, performDatabaseOperation) {
return performDatabaseOperation(async (transaction, store) => { return performDatabaseOperation(async (transaction, store) => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment