Skip to content

Commit

Permalink
don't check loops for constant conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed Apr 14, 2019
1 parent 0f88802 commit 50d16b2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"no-compare-neg-zero": 2,
"no-cond-assign": 2,
"no-const-assign": 2,
"no-constant-condition": 2,
"no-constant-condition": ["error", { "checkLoops": false }],
"no-control-regex": 2,
"no-debugger": 2,
"no-delete-var": 2,
Expand Down
8 changes: 4 additions & 4 deletions packages/moon/dist/moon.js
Original file line number Diff line number Diff line change
Expand Up @@ -947,21 +947,21 @@
// the component.


var rootElement = typeof options.root === "string" ? document.querySelector(options.root) : options.root;
var root = typeof options.root === "string" ? document.querySelector(options.root) : options.root;
delete options.root;

if (rootElement === undefined) {
if (root === undefined) {
components[name] = function (data) {
return view(defaultObject(data, options));
};
} else {
setViewOld({
type: types.element,
name: rootElement.tagName,
name: root.tagName,
data: {
children: []
},
node: rootElement
node: root
});
setViewCurrent(view);
setData(options);
Expand Down
8 changes: 4 additions & 4 deletions packages/moon/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ export default function Moon(options) {

// If a `root` option is given, start the root renderer, or else just return
// the component.
const rootElement =
const root =
typeof options.root === "string" ?
document.querySelector(options.root) :
options.root;

delete options.root;

if (rootElement === undefined) {
if (root === undefined) {
components[name] = (data) => view(defaultObject(data, options));
} else {
setViewOld({
type: types.element,
name: rootElement.tagName,
name: root.tagName,
data: {
children: []
},
node: rootElement
node: root
});
setViewCurrent(view);
setData(options);
Expand Down

0 comments on commit 50d16b2

Please sign in to comment.