@markuplint/ml-core
Advanced tools
Comparing version 1.1.0 to 1.2.0
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getLocationFromChars = exports.Text = exports.OmittedElement = exports.Node = exports.ElementCloseTag = exports.Element = exports.Document = exports.Doctype = exports.Comment = exports.Attribute = exports.Ruleset = exports.MLParseError = exports.MLRule = exports.MLCore = exports.createRule = exports.convertRuleset = void 0; | ||
var convert_ruleset_1 = require("./convert-ruleset"); | ||
@@ -12,5 +16,5 @@ Object.defineProperty(exports, "convertRuleset", { enumerable: true, get: function () { return convert_ruleset_1.convertRuleset; } }); | ||
var ml_parse_error_1 = require("./ml-error/ml-parse-error"); | ||
Object.defineProperty(exports, "MLParseError", { enumerable: true, get: function () { return ml_parse_error_1.default; } }); | ||
Object.defineProperty(exports, "MLParseError", { enumerable: true, get: function () { return __importDefault(ml_parse_error_1).default; } }); | ||
var ruleset_1 = require("./ruleset"); | ||
Object.defineProperty(exports, "Ruleset", { enumerable: true, get: function () { return ruleset_1.default; } }); | ||
Object.defineProperty(exports, "Ruleset", { enumerable: true, get: function () { return __importDefault(ruleset_1).default; } }); | ||
var ml_dom_1 = require("./ml-dom"); | ||
@@ -17,0 +21,0 @@ Object.defineProperty(exports, "Attribute", { enumerable: true, get: function () { return ml_dom_1.Attribute; } }); |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createSelector = exports.NodeStore = exports.createNode = void 0; | ||
var create_node_1 = require("./create-node"); | ||
Object.defineProperty(exports, "createNode", { enumerable: true, get: function () { return create_node_1.createNode; } }); | ||
var node_store_1 = require("./node-store"); | ||
Object.defineProperty(exports, "NodeStore", { enumerable: true, get: function () { return node_store_1.default; } }); | ||
Object.defineProperty(exports, "NodeStore", { enumerable: true, get: function () { return __importDefault(node_store_1).default; } }); | ||
var selector_1 = require("./selector"); | ||
Object.defineProperty(exports, "createSelector", { enumerable: true, get: function () { return selector_1.createSelector; } }); |
@@ -0,1 +1,2 @@ | ||
import { AnonymousNode } from '../'; | ||
interface ElementLikeObject { | ||
@@ -6,2 +7,3 @@ nodeName: string; | ||
parentNode: this | null; | ||
childNodes: AnonymousNode<any, any>[]; | ||
getAttribute?: (attrName: string) => string | null; | ||
@@ -8,0 +10,0 @@ } |
@@ -25,2 +25,3 @@ "use strict"; | ||
selectorParser.registerSelectorPseudos('not'); | ||
selectorParser.registerNestingOperators('>'); | ||
selectorParser.registerAttrEqualityMods('~', '^', '$', '*', '|'); | ||
@@ -125,2 +126,34 @@ __classPrivateFieldSet(this, _rawSelector, selector); | ||
} | ||
case 'has': { | ||
const has = element.childNodes.some(child => { | ||
let childSelector; | ||
let useChildCombinator = false; | ||
if (pseudo.valueType !== 'selector') { | ||
const selectorParser = new css_selector_parser_1.CssSelectorParser(); | ||
/** | ||
* The issue. | ||
* @see https://github.com/mdevils/css-selector-parser/issues/21 | ||
*/ | ||
if (/^>/.test(pseudo.value.trim())) { | ||
pseudo.value = pseudo.value.trim().replace(/^>/, ''); | ||
useChildCombinator = true; | ||
} | ||
childSelector = selectorParser.parse(pseudo.value); | ||
// throw new Error(`Unexpected parameters in "has" pseudo selector in "${rawSelector}"`); | ||
} | ||
else { | ||
childSelector = pseudo.value; | ||
} | ||
if (child.type === 'Element') { | ||
if (useChildCombinator) { | ||
return match(child, childSelector, rawSelector); | ||
} | ||
// TODO: Recursive checking when selector without child combinator. | ||
throw new Error(`Unsupport "${pseudo.name}" pseudo selector in "${rawSelector}"`); | ||
} | ||
return false; | ||
}); | ||
andMatch.push(has); | ||
break; | ||
} | ||
default: { | ||
@@ -127,0 +160,0 @@ throw new Error(`Unsupport "${pseudo.name}" pseudo selector in "${rawSelector}"`); |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Indentation = exports.Text = exports.OmittedElement = exports.Node = exports.ElementCloseTag = exports.Element = exports.Doctype = exports.Comment = exports.Attribute = exports.Document = void 0; | ||
var document_1 = require("./document"); | ||
Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return document_1.default; } }); | ||
Object.defineProperty(exports, "Document", { enumerable: true, get: function () { return __importDefault(document_1).default; } }); | ||
var tokens_1 = require("./tokens"); | ||
@@ -6,0 +10,0 @@ Object.defineProperty(exports, "Attribute", { enumerable: true, get: function () { return tokens_1.MLDOMAttribute; } }); |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MLDOMIndentation = exports.MLDOMPreprocessorSpecificBlock = exports.MLDOMElementCloseTag = exports.MLDOMElement = exports.MLDOMOmittedElement = exports.MLDOMText = exports.MLDOMDoctype = exports.MLDOMNode = exports.MLDOMToken = exports.MLDOMComment = exports.MLDOMAttribute = void 0; | ||
var attribute_1 = require("./attribute"); | ||
Object.defineProperty(exports, "MLDOMAttribute", { enumerable: true, get: function () { return attribute_1.default; } }); | ||
Object.defineProperty(exports, "MLDOMAttribute", { enumerable: true, get: function () { return __importDefault(attribute_1).default; } }); | ||
var comment_1 = require("./comment"); | ||
Object.defineProperty(exports, "MLDOMComment", { enumerable: true, get: function () { return comment_1.default; } }); | ||
Object.defineProperty(exports, "MLDOMComment", { enumerable: true, get: function () { return __importDefault(comment_1).default; } }); | ||
var token_1 = require("./token"); | ||
Object.defineProperty(exports, "MLDOMToken", { enumerable: true, get: function () { return token_1.default; } }); | ||
Object.defineProperty(exports, "MLDOMToken", { enumerable: true, get: function () { return __importDefault(token_1).default; } }); | ||
var node_1 = require("./node"); | ||
Object.defineProperty(exports, "MLDOMNode", { enumerable: true, get: function () { return node_1.default; } }); | ||
Object.defineProperty(exports, "MLDOMNode", { enumerable: true, get: function () { return __importDefault(node_1).default; } }); | ||
var doctype_1 = require("./doctype"); | ||
Object.defineProperty(exports, "MLDOMDoctype", { enumerable: true, get: function () { return doctype_1.default; } }); | ||
Object.defineProperty(exports, "MLDOMDoctype", { enumerable: true, get: function () { return __importDefault(doctype_1).default; } }); | ||
var text_1 = require("./text"); | ||
Object.defineProperty(exports, "MLDOMText", { enumerable: true, get: function () { return text_1.default; } }); | ||
Object.defineProperty(exports, "MLDOMText", { enumerable: true, get: function () { return __importDefault(text_1).default; } }); | ||
var omitted_element_1 = require("./omitted-element"); | ||
Object.defineProperty(exports, "MLDOMOmittedElement", { enumerable: true, get: function () { return omitted_element_1.default; } }); | ||
Object.defineProperty(exports, "MLDOMOmittedElement", { enumerable: true, get: function () { return __importDefault(omitted_element_1).default; } }); | ||
var element_1 = require("./element"); | ||
Object.defineProperty(exports, "MLDOMElement", { enumerable: true, get: function () { return element_1.default; } }); | ||
Object.defineProperty(exports, "MLDOMElement", { enumerable: true, get: function () { return __importDefault(element_1).default; } }); | ||
var element_close_tag_1 = require("./element-close-tag"); | ||
Object.defineProperty(exports, "MLDOMElementCloseTag", { enumerable: true, get: function () { return element_close_tag_1.default; } }); | ||
Object.defineProperty(exports, "MLDOMElementCloseTag", { enumerable: true, get: function () { return __importDefault(element_close_tag_1).default; } }); | ||
var preprocessor_specific_block_1 = require("./preprocessor-specific-block"); | ||
Object.defineProperty(exports, "MLDOMPreprocessorSpecificBlock", { enumerable: true, get: function () { return preprocessor_specific_block_1.default; } }); | ||
Object.defineProperty(exports, "MLDOMPreprocessorSpecificBlock", { enumerable: true, get: function () { return __importDefault(preprocessor_specific_block_1).default; } }); | ||
var indentation_1 = require("./indentation"); | ||
Object.defineProperty(exports, "MLDOMIndentation", { enumerable: true, get: function () { return indentation_1.default; } }); | ||
Object.defineProperty(exports, "MLDOMIndentation", { enumerable: true, get: function () { return __importDefault(indentation_1).default; } }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.MLRule = void 0; | ||
var ml_rule_1 = require("./ml-rule"); | ||
Object.defineProperty(exports, "MLRule", { enumerable: true, get: function () { return ml_rule_1.MLRule; } }); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getLocationFromChars = void 0; | ||
var get_location_from_chars_1 = require("./get-location-from-chars"); | ||
Object.defineProperty(exports, "getLocationFromChars", { enumerable: true, get: function () { return get_location_from_chars_1.getLocationFromChars; } }); |
{ | ||
"name": "@markuplint/ml-core", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "The core module of markuplint", | ||
@@ -21,8 +21,8 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
"@markuplint/i18n": "^1.1.0", | ||
"@markuplint/ml-ast": "^1.0.1", | ||
"@markuplint/ml-ast": "^1.1.0", | ||
"@markuplint/ml-config": "^1.0.0", | ||
"@markuplint/ml-spec": "^1.0.0", | ||
"@markuplint/ml-spec": "^1.1.0", | ||
"css-selector-parser": "^1.4.1" | ||
}, | ||
"gitHead": "a7fbdff7d01567d5a184e440a6f12f66f710fb54" | ||
"gitHead": "90b7f86d6708e2003cc33ca7aa7da327d590f6b4" | ||
} |
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
360778
2022
Updated@markuplint/ml-ast@^1.1.0
Updated@markuplint/ml-spec@^1.1.0