Use blocked scoped variables

In addition to using const and let, this also upgrades our linter config and removes lint (mostly whitespace).
This commit is contained in:
Tim Schaub
2018-01-11 23:32:36 -07:00
parent 0bf2b04dee
commit ad62739a6e
684 changed files with 18120 additions and 18184 deletions

View File

@@ -10,7 +10,7 @@
* @return {CanvasRenderingContext2D} The context.
*/
export function createCanvasContext2D(opt_width, opt_height) {
var canvas = document.createElement('CANVAS');
const canvas = document.createElement('CANVAS');
if (opt_width) {
canvas.width = opt_width;
}
@@ -29,8 +29,8 @@ export function createCanvasContext2D(opt_width, opt_height) {
* @return {number} The width.
*/
export function outerWidth(element) {
var width = element.offsetWidth;
var style = getComputedStyle(element);
let width = element.offsetWidth;
const style = getComputedStyle(element);
width += parseInt(style.marginLeft, 10) + parseInt(style.marginRight, 10);
return width;
@@ -45,8 +45,8 @@ export function outerWidth(element) {
* @return {number} The height.
*/
export function outerHeight(element) {
var height = element.offsetHeight;
var style = getComputedStyle(element);
let height = element.offsetHeight;
const style = getComputedStyle(element);
height += parseInt(style.marginTop, 10) + parseInt(style.marginBottom, 10);
return height;
@@ -57,7 +57,7 @@ export function outerHeight(element) {
* @param {Node} oldNode The node to be replaced
*/
export function replaceNode(newNode, oldNode) {
var parent = oldNode.parentNode;
const parent = oldNode.parentNode;
if (parent) {
parent.replaceChild(newNode, oldNode);
}