Permalink
Browse files

JSLint validation

  • Loading branch information...
1 parent d0dfc8c commit 489690c7d2dbeb58dd8593590b5d98f3110f71b3 @medikoo committed Feb 20, 2012
Showing with 44 additions and 32 deletions.
  1. +1 −0 .gitignore
  2. +6 −0 .lint
  3. +9 −9 lib/domjs.js
  4. +3 −1 lib/dscope.js
  5. +2 −2 lib/html5.js
  6. +2 −1 package.json
  7. +1 −0 test/.lint
  8. +1 −0 test/.lintignore
  9. +19 −19 test/domjs.js
View
@@ -1 +1,2 @@
+/.lintcache
/node_modules
View
6 .lint
@@ -0,0 +1,6 @@
+@root
+indent 2
+maxlen 80
+nomen
+tabs
+predef console
View
@@ -101,12 +101,12 @@ module.exports = {
},
getCreate: function (name) {
return function () {
- return this.getUpdate(
- this.createElement(name, this.processArguments(arguments)));
+ return this.getUpdate(this.createElement(name,
+ this.processArguments(arguments)));
};
},
getUpdate: function (el) {
- return function f () {
+ return function f() {
if (!arguments.length) {
return el;
}
@@ -115,15 +115,16 @@ module.exports = {
}.bind(this);
},
createElement: function (name, data) {
- return this.updateElement(
- this.df.appendChild(this.document.createElement(name)), data);
+ return this.updateElement(this.df.appendChild(
+ this.document.createElement(name)
+ ), data);
},
processChildren: function (children) {
- return compact.call(flatten.call(children.map(function self (child) {
+ return compact.call(flatten.call(children.map(function self(child) {
if (isFunction(child)) {
child = child();
} else if (!isNode(child) && isList(child) &&
- (typeof child === 'object')) {
+ (typeof child === 'object')) {
return map.call(child, self, this);
} else if ((typeof child === "string") || (typeof child === "number")) {
child = this.document.createTextNode(child);
@@ -132,8 +133,7 @@ module.exports = {
}, this)));
},
updateElement: function (el, data) {
- var attrs = data[0], children = data[1];
- var self = this;
+ var attrs = data[0], children = data[1], self = this;
oForEach.call(attrs, function (value, name) {
this.setAttribute(el, name, value);
}, this);
View
@@ -30,6 +30,8 @@ unset = function (scope, cache) {
module.exports = function (fn, scope) {
var result, cache = {};
- set(scope, cache); result = fn(); unset(scope, cache);
+ set(scope, cache);
+ result = fn();
+ unset(scope, cache);
return result;
};
View
@@ -8,7 +8,7 @@ var isFunction = require('es5-ext/lib/Function/is-function')
html5js = Object.freeze(extend.call(domjs, {
setAttribute: function (_super, el, name, value) {
- if ((name.slice(0,2) === 'on') && isFunction(value)) {
+ if ((name.slice(0, 2) === 'on') && isFunction(value)) {
el.setAttribute(name, name);
el[name] = value;
} else {
@@ -18,7 +18,7 @@ html5js = Object.freeze(extend.call(domjs, {
}).init(['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio',
'b', 'bdi', 'bdo', 'blockquote', 'br', 'button', 'canvas', 'caption', 'cite',
'code', 'col', 'colgroup', 'command', 'datalist', 'dd', 'del', 'details',
- 'device','dfn', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption',
+ 'device', 'dfn', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption',
'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header',
'hgroup', 'hr', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen',
'label', 'legend', 'li', 'link', 'map', 'mark', 'menu', 'meter', 'nav',
View
@@ -14,7 +14,8 @@
"url": "https://github.com/medikoo/domjs/issues"
},
"scripts": {
- "test": "./node_modules/tad/bin/tad lib"
+ "test": "node ./node_modules/tad/bin/tad lib",
+ "lint": "node ./node_modules/jslint/bin/jslint.js --color --git"
},
"dependencies": {
"es5-ext": "0.7.x"
View
@@ -0,0 +1 @@
+predef+ __dirname, foo, bar, _var, _element, _direct, _text, _comment, _cdata, c, div
View
@@ -0,0 +1 @@
+/__playground
View
@@ -9,36 +9,36 @@ module.exports = function (t, a) {
builder = Object.create(t).init(['foo', 'bar', 'var'])
.init(document, require);
dom = builder.build(function () {
- var late;
+ var late;
- foo("foo text");
+ foo("foo text");
- late = bar({ 'class': "test-class", other: "test-other", id: "internal" },
- foo("raz"),
- foo("dwa"),
- foo("trzy"));
+ late = bar({ 'class': "test-class", other: "test-other", id: "internal" },
+ foo("raz"),
+ foo("dwa"),
+ foo("trzy"));
- _var();
+ _var();
- late(foo("cztery"));
- late(foo("pięć"));
+ late(foo("cztery"));
+ late(foo("pięć"));
- late().setAttribute("foo", "bar");
+ late().setAttribute("foo", "bar");
- _element('not-standard', { foo: true, bar: false },
- "not standard content");
+ _element('not-standard', { foo: true, bar: false },
+ "not standard content");
- _direct(el1 = document.createElement('div'),
- el2 = document.createElement('p'));
- el2.setAttribute('id', 'external');
+ _direct(el1 = document.createElement('div'),
+ el2 = document.createElement('p'));
+ el2.setAttribute('id', 'external');
- _text("text sibling");
+ _text("text sibling");
- _comment("comment sibling");
+ _comment("comment sibling");
- _cdata("cdata sibling");
+ _cdata("cdata sibling");
- });
+ });
a(dom && dom.nodeType, 11, "Expect document fragment");

0 comments on commit 489690c

Please sign in to comment.