diff --git a/.eslintrc b/.eslintrc index fa7fcb81..8f853407 100644 --- a/.eslintrc +++ b/.eslintrc @@ -22,6 +22,7 @@ "dot-notation": [2, { "allowKeywords": false }], "eol-last": 2, "eqeqeq": [2, "smart"], + "guard-for-in": 2, "indent": [2, 2, {"SwitchCase": 1}], "key-spacing": 1, "linebreak-style": 2, diff --git a/js/main-window-dom.js b/js/main-window-dom.js index dd50660e..35df3654 100644 --- a/js/main-window-dom.js +++ b/js/main-window-dom.js @@ -7,7 +7,9 @@ function el(tagName, attributes, content) { content = [content]; } for (var attr in attributes) { - tag.setAttribute(attr, attributes[attr]); + if (attributes.hasOwnProperty(attr)) { + tag.setAttribute(attr, attributes[attr]); + } } for (var i = 0; i < content.length; i++) { if (typeof content[i] === 'string') { diff --git a/js/multi-display.js b/js/multi-display.js index 21a2ac77..4f27ff6a 100644 --- a/js/multi-display.js +++ b/js/multi-display.js @@ -27,8 +27,10 @@ MultiDisplay.prototype.setRegisterText = function(register, text) { MultiDisplay.prototype.showRegister = function(showKey) { for (var key in this.registers) { - var display = (key === showKey) ? 'block' : 'none'; - this.registers[key].node.style.display = display; + if (this.registers.hasOwnProperty(key)) { + var display = (key === showKey) ? 'block' : 'none'; + this.registers[key].node.style.display = display; + } } };