Skip to content

Commit 440bdbf

Browse files
committed
Using separate vars (and fixing indentation) in widgets.js
1 parent 43d029b commit 440bdbf

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

lib/widgets.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
var is = require('is');
55
var tag = require('./tag');
66

7-
var dataRegExp = /^data-[a-z]+([-][a-z]+)*$/,
8-
ariaRegExp = /^aria-[a-z]+$/,
9-
legalAttrs = ['autocomplete', 'autocorrect', 'autofocus', 'autosuggest', 'checked', 'dirname', 'disabled', 'tabindex', 'list', 'max', 'maxlength', 'min', 'multiple', 'novalidate', 'pattern', 'placeholder', 'readonly', 'required', 'size', 'step'],
10-
ignoreAttrs = ['id', 'name', 'class', 'classes', 'type', 'value'],
11-
getUserAttrs = function (opt) {
12-
return Object.keys(opt).reduce(function (attrs, k) {
13-
if ((ignoreAttrs.indexOf(k) === -1 && legalAttrs.indexOf(k) > -1) || dataRegExp.test(k) || ariaRegExp.test(k)) {
14-
attrs[k] = opt[k];
15-
}
16-
return attrs;
17-
}, {});
18-
};
7+
var dataRegExp = /^data-[a-z]+([-][a-z]+)*$/;
8+
var ariaRegExp = /^aria-[a-z]+$/;
9+
var legalAttrs = ['autocomplete', 'autocorrect', 'autofocus', 'autosuggest', 'checked', 'dirname', 'disabled', 'tabindex', 'list', 'max', 'maxlength', 'min', 'multiple', 'novalidate', 'pattern', 'placeholder', 'readonly', 'required', 'size', 'step'];
10+
var ignoreAttrs = ['id', 'name', 'class', 'classes', 'type', 'value'];
11+
var getUserAttrs = function (opt) {
12+
return Object.keys(opt).reduce(function (attrs, k) {
13+
if ((ignoreAttrs.indexOf(k) === -1 && legalAttrs.indexOf(k) > -1) || dataRegExp.test(k) || ariaRegExp.test(k)) {
14+
attrs[k] = opt[k];
15+
}
16+
return attrs;
17+
}, {});
18+
};
1919

2020
// used to generate different input elements varying only by type attribute
2121
var input = function (type) {

0 commit comments

Comments
 (0)