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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user