Guard for in

This commit is contained in:
Jordan Eldredge 2016-07-05 21:05:49 -07:00
parent 3a119416ba
commit 92c1df41cc
3 changed files with 8 additions and 3 deletions

View file

@ -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,

View file

@ -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') {

View file

@ -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;
}
}
};