@markuplint/ml-core
Advanced tools
Comparing version 1.0.0-alpha.11 to 1.0.0-alpha.12
@@ -75,17 +75,25 @@ "use strict"; | ||
this.isFragment = ast.isFragment; | ||
for (var _i = 0, _a = this.tree; _i < _a.length; _i++) { | ||
var node = _a[_i]; | ||
recursiveResolveCategories(node); | ||
} | ||
// add rules to node | ||
for (var _i = 0, _a = this.nodeList; _i < _a.length; _i++) { | ||
var node = _a[_i]; | ||
for (var _b = 0, _c = this.nodeList; _b < _c.length; _b++) { | ||
var node = _c[_b]; | ||
// global rules | ||
for (var _b = 0, _c = Object.keys(ruleset.rules); _b < _c.length; _b++) { | ||
var ruleName = _c[_b]; | ||
for (var _d = 0, _e = Object.keys(ruleset.rules); _d < _e.length; _d++) { | ||
var ruleName = _e[_d]; | ||
var rule = ruleset.rules[ruleName]; | ||
node.rules[ruleName] = rule; | ||
} | ||
if (!(node instanceof tokens_1.MLDOMElement)) { | ||
if (node.type !== 'Element' && node.type !== 'ElementCloseTag') { | ||
continue; | ||
} | ||
var selectorTarget = node.type === 'Element' ? node : node.startTag; | ||
// node specs and special rules for node by selector | ||
for (var _d = 0, _e = ruleset.nodeRules; _d < _e.length; _d++) { | ||
var nodeRule = _e[_d]; | ||
for (var _f = 0, _g = ruleset.nodeRules; _f < _g.length; _f++) { | ||
var nodeRule = _g[_f]; | ||
if (!nodeRule.rules) { | ||
continue; | ||
} | ||
var selector = nodeRule.selector || nodeRule.tagName; | ||
@@ -95,16 +103,11 @@ if (!selector) { | ||
} | ||
var matched = node.matches(selector); | ||
var matched = selectorTarget.matches(selector); | ||
if (!matched) { | ||
continue; | ||
} | ||
if (!nodeRule.rules) { | ||
continue; | ||
} | ||
// special rules | ||
for (var _f = 0, _g = Object.keys(nodeRule.rules); _f < _g.length; _f++) { | ||
var ruleName = _g[_f]; | ||
for (var _h = 0, _j = Object.keys(nodeRule.rules); _h < _j.length; _h++) { | ||
var ruleName = _j[_h]; | ||
var rule = nodeRule.rules[ruleName]; | ||
if (rule) { | ||
node.rules[ruleName] = rule; | ||
} | ||
node.rules[ruleName] = rule; | ||
} | ||
@@ -114,6 +117,6 @@ } | ||
// overwrite rule to child node | ||
for (var _h = 0, _j = ruleset.childNodeRules; _h < _j.length; _h++) { | ||
var nodeRule = _j[_h]; | ||
for (var _k = 0, _l = ruleset.childNodeRules; _k < _l.length; _k++) { | ||
var nodeRule = _l[_k]; | ||
if (!nodeRule.rules || !nodeRule.selector) { | ||
return; | ||
break; | ||
} | ||
@@ -124,3 +127,3 @@ var _loop_1 = function (ruleName) { | ||
var node = _a[_i]; | ||
if (!(node instanceof tokens_1.MLDOMElement)) { | ||
if (node.type !== 'Element') { | ||
continue; | ||
@@ -144,11 +147,7 @@ } | ||
var this_1 = this; | ||
for (var _k = 0, _l = Object.keys(nodeRule.rules); _k < _l.length; _k++) { | ||
var ruleName = _l[_k]; | ||
for (var _m = 0, _o = Object.keys(nodeRule.rules); _m < _o.length; _m++) { | ||
var ruleName = _o[_m]; | ||
_loop_1(ruleName); | ||
} | ||
} | ||
for (var _m = 0, _o = this.tree; _m < _o.length; _m++) { | ||
var node = _o[_m]; | ||
recursiveResolveCategories(node); | ||
} | ||
} | ||
@@ -155,0 +154,0 @@ Object.defineProperty(MLDOMDocument.prototype, "doctype", { |
{ | ||
"name": "@markuplint/ml-core", | ||
"version": "1.0.0-alpha.11", | ||
"version": "1.0.0-alpha.12", | ||
"description": "The core module of markuplint", | ||
@@ -26,3 +26,3 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
}, | ||
"gitHead": "5966e1fa119ba9813e5a19d760a794abd88da08c" | ||
"gitHead": "81b3d6bf0e833f0e79c4f65a32203136de6edd23" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
242740
2010