Comparing version 3.1.0 to 3.2.0
@@ -58,2 +58,13 @@ import { AnyNode, Element } from "domhandler"; | ||
/** | ||
* Returns all nodes with the supplied `className`. | ||
* | ||
* @category Legacy Query Functions | ||
* @param className Class name to search for. | ||
* @param nodes Nodes to search through. | ||
* @param recurse Also consider child nodes. | ||
* @param limit Maximum number of nodes to return. | ||
* @returns All nodes with the supplied `className`. | ||
*/ | ||
export declare function getElementsByClassName(className: string | ((name: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): Element[]; | ||
/** | ||
* Returns all nodes with the supplied `type`. | ||
@@ -60,0 +71,0 @@ * |
@@ -127,2 +127,15 @@ import { isTag, isText } from "domhandler"; | ||
/** | ||
* Returns all nodes with the supplied `className`. | ||
* | ||
* @category Legacy Query Functions | ||
* @param className Class name to search for. | ||
* @param nodes Nodes to search through. | ||
* @param recurse Also consider child nodes. | ||
* @param limit Maximum number of nodes to return. | ||
* @returns All nodes with the supplied `className`. | ||
*/ | ||
export function getElementsByClassName(className, nodes, recurse = true, limit = Infinity) { | ||
return filter(getAttribCheck("class", className), nodes, recurse, limit); | ||
} | ||
/** | ||
* Returns all nodes with the supplied `type`. | ||
@@ -129,0 +142,0 @@ * |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getFeed = void 0; | ||
exports.getFeed = getFeed; | ||
var stringify_js_1 = require("./stringify.js"); | ||
@@ -21,3 +21,2 @@ var legacy_js_1 = require("./legacy.js"); | ||
} | ||
exports.getFeed = getFeed; | ||
/** | ||
@@ -24,0 +23,0 @@ * Parse an Atom feed. |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.uniqueSort = exports.compareDocumentPosition = exports.DocumentPosition = exports.removeSubsets = void 0; | ||
exports.DocumentPosition = void 0; | ||
exports.removeSubsets = removeSubsets; | ||
exports.compareDocumentPosition = compareDocumentPosition; | ||
exports.uniqueSort = uniqueSort; | ||
var domhandler_1 = require("domhandler"); | ||
@@ -39,3 +42,2 @@ /** | ||
} | ||
exports.removeSubsets = removeSubsets; | ||
/** | ||
@@ -52,3 +54,3 @@ * @category Helpers | ||
DocumentPosition[DocumentPosition["CONTAINED_BY"] = 16] = "CONTAINED_BY"; | ||
})(DocumentPosition = exports.DocumentPosition || (exports.DocumentPosition = {})); | ||
})(DocumentPosition || (exports.DocumentPosition = DocumentPosition = {})); | ||
/** | ||
@@ -119,3 +121,2 @@ * Compare the position of one node against another node in any other document, | ||
} | ||
exports.compareDocumentPosition = compareDocumentPosition; | ||
/** | ||
@@ -144,3 +145,2 @@ * Sort an array of nodes based on their relative position in the document, | ||
} | ||
exports.uniqueSort = uniqueSort; | ||
//# sourceMappingURL=helpers.js.map |
@@ -58,2 +58,13 @@ import { AnyNode, Element } from "domhandler"; | ||
/** | ||
* Returns all nodes with the supplied `className`. | ||
* | ||
* @category Legacy Query Functions | ||
* @param className Class name to search for. | ||
* @param nodes Nodes to search through. | ||
* @param recurse Also consider child nodes. | ||
* @param limit Maximum number of nodes to return. | ||
* @returns All nodes with the supplied `className`. | ||
*/ | ||
export declare function getElementsByClassName(className: string | ((name: string) => boolean), nodes: AnyNode | AnyNode[], recurse?: boolean, limit?: number): Element[]; | ||
/** | ||
* Returns all nodes with the supplied `type`. | ||
@@ -60,0 +71,0 @@ * |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getElementsByTagType = exports.getElementsByTagName = exports.getElementById = exports.getElements = exports.testElement = void 0; | ||
exports.testElement = testElement; | ||
exports.getElements = getElements; | ||
exports.getElementById = getElementById; | ||
exports.getElementsByTagName = getElementsByTagName; | ||
exports.getElementsByClassName = getElementsByClassName; | ||
exports.getElementsByTagType = getElementsByTagType; | ||
var domhandler_1 = require("domhandler"); | ||
@@ -88,3 +93,2 @@ var querying_js_1 = require("./querying.js"); | ||
} | ||
exports.testElement = testElement; | ||
/** | ||
@@ -105,3 +109,2 @@ * Returns all nodes that match `options`. | ||
} | ||
exports.getElements = getElements; | ||
/** | ||
@@ -122,3 +125,2 @@ * Returns the node with the supplied ID. | ||
} | ||
exports.getElementById = getElementById; | ||
/** | ||
@@ -139,4 +141,18 @@ * Returns all nodes with the supplied `tagName`. | ||
} | ||
exports.getElementsByTagName = getElementsByTagName; | ||
/** | ||
* Returns all nodes with the supplied `className`. | ||
* | ||
* @category Legacy Query Functions | ||
* @param className Class name to search for. | ||
* @param nodes Nodes to search through. | ||
* @param recurse Also consider child nodes. | ||
* @param limit Maximum number of nodes to return. | ||
* @returns All nodes with the supplied `className`. | ||
*/ | ||
function getElementsByClassName(className, nodes, recurse, limit) { | ||
if (recurse === void 0) { recurse = true; } | ||
if (limit === void 0) { limit = Infinity; } | ||
return (0, querying_js_1.filter)(getAttribCheck("class", className), nodes, recurse, limit); | ||
} | ||
/** | ||
* Returns all nodes with the supplied `type`. | ||
@@ -156,3 +172,2 @@ * | ||
} | ||
exports.getElementsByTagType = getElementsByTagType; | ||
//# sourceMappingURL=legacy.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.prepend = exports.prependChild = exports.append = exports.appendChild = exports.replaceElement = exports.removeElement = void 0; | ||
exports.removeElement = removeElement; | ||
exports.replaceElement = replaceElement; | ||
exports.appendChild = appendChild; | ||
exports.append = append; | ||
exports.prependChild = prependChild; | ||
exports.prepend = prepend; | ||
/** | ||
@@ -26,3 +31,2 @@ * Remove an element from the dom | ||
} | ||
exports.removeElement = removeElement; | ||
/** | ||
@@ -51,3 +55,2 @@ * Replace an element in the dom | ||
} | ||
exports.replaceElement = replaceElement; | ||
/** | ||
@@ -73,3 +76,2 @@ * Append a child to an element. | ||
} | ||
exports.appendChild = appendChild; | ||
/** | ||
@@ -101,3 +103,2 @@ * Append an element after another. | ||
} | ||
exports.append = append; | ||
/** | ||
@@ -123,3 +124,2 @@ * Prepend a child to an element. | ||
} | ||
exports.prependChild = prependChild; | ||
/** | ||
@@ -147,3 +147,2 @@ * Prepend an element before another. | ||
} | ||
exports.prepend = prepend; | ||
//# sourceMappingURL=manipulation.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.findAll = exports.existsOne = exports.findOne = exports.findOneChild = exports.find = exports.filter = void 0; | ||
exports.filter = filter; | ||
exports.find = find; | ||
exports.findOneChild = findOneChild; | ||
exports.findOne = findOne; | ||
exports.existsOne = existsOne; | ||
exports.findAll = findAll; | ||
var domhandler_1 = require("domhandler"); | ||
@@ -20,3 +25,2 @@ /** | ||
} | ||
exports.filter = filter; | ||
/** | ||
@@ -67,3 +71,2 @@ * Search an array of nodes and their children for nodes passing a test function. | ||
} | ||
exports.find = find; | ||
/** | ||
@@ -81,3 +84,2 @@ * Finds the first element inside of an array that matches a test function. This is an alias for `Array.prototype.find`. | ||
} | ||
exports.findOneChild = findOneChild; | ||
/** | ||
@@ -109,3 +111,2 @@ * Finds one element in a tree that passes a test. | ||
} | ||
exports.findOne = findOne; | ||
/** | ||
@@ -125,3 +126,2 @@ * Checks if a tree of nodes contains at least one node passing a test. | ||
} | ||
exports.existsOne = existsOne; | ||
/** | ||
@@ -163,3 +163,2 @@ * Search an array of nodes and their children for elements passing a test function. | ||
} | ||
exports.findAll = findAll; | ||
//# sourceMappingURL=querying.js.map |
@@ -6,3 +6,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.innerText = exports.textContent = exports.getText = exports.getInnerHTML = exports.getOuterHTML = void 0; | ||
exports.getOuterHTML = getOuterHTML; | ||
exports.getInnerHTML = getInnerHTML; | ||
exports.getText = getText; | ||
exports.textContent = textContent; | ||
exports.innerText = innerText; | ||
var domhandler_1 = require("domhandler"); | ||
@@ -21,3 +25,2 @@ var dom_serializer_1 = __importDefault(require("dom-serializer")); | ||
} | ||
exports.getOuterHTML = getOuterHTML; | ||
/** | ||
@@ -35,3 +38,2 @@ * @category Stringify | ||
} | ||
exports.getInnerHTML = getInnerHTML; | ||
/** | ||
@@ -56,3 +58,2 @@ * Get a node's inner text. Same as `textContent`, but inserts newlines for `<br>` tags. Ignores comments. | ||
} | ||
exports.getText = getText; | ||
/** | ||
@@ -76,3 +77,2 @@ * Get a node's text content. Ignores comments. | ||
} | ||
exports.textContent = textContent; | ||
/** | ||
@@ -96,3 +96,2 @@ * Get a node's inner text, ignoring `<script>` and `<style>` tags. Ignores comments. | ||
} | ||
exports.innerText = innerText; | ||
//# sourceMappingURL=stringify.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.prevElementSibling = exports.nextElementSibling = exports.getName = exports.hasAttrib = exports.getAttributeValue = exports.getSiblings = exports.getParent = exports.getChildren = void 0; | ||
exports.getChildren = getChildren; | ||
exports.getParent = getParent; | ||
exports.getSiblings = getSiblings; | ||
exports.getAttributeValue = getAttributeValue; | ||
exports.hasAttrib = hasAttrib; | ||
exports.getName = getName; | ||
exports.nextElementSibling = nextElementSibling; | ||
exports.prevElementSibling = prevElementSibling; | ||
var domhandler_1 = require("domhandler"); | ||
@@ -15,3 +22,2 @@ /** | ||
} | ||
exports.getChildren = getChildren; | ||
/** | ||
@@ -27,3 +33,2 @@ * Get a node's parent. | ||
} | ||
exports.getParent = getParent; | ||
/** | ||
@@ -57,3 +62,2 @@ * Gets an elements siblings, including the element itself. | ||
} | ||
exports.getSiblings = getSiblings; | ||
/** | ||
@@ -71,3 +75,2 @@ * Gets an attribute from an element. | ||
} | ||
exports.getAttributeValue = getAttributeValue; | ||
/** | ||
@@ -86,3 +89,2 @@ * Checks whether an element has an attribute. | ||
} | ||
exports.hasAttrib = hasAttrib; | ||
/** | ||
@@ -98,3 +100,2 @@ * Get the tag name of an element. | ||
} | ||
exports.getName = getName; | ||
/** | ||
@@ -115,3 +116,2 @@ * Returns the next element sibling of a node. | ||
} | ||
exports.nextElementSibling = nextElementSibling; | ||
/** | ||
@@ -132,3 +132,2 @@ * Returns the previous element sibling of a node. | ||
} | ||
exports.prevElementSibling = prevElementSibling; | ||
//# sourceMappingURL=traversal.js.map |
{ | ||
"name": "domutils", | ||
"version": "3.1.0", | ||
"version": "3.2.0", | ||
"description": "Utilities for working with htmlparser2's dom", | ||
@@ -34,3 +34,3 @@ "author": "Felix Boehm <me@feedic.com>", | ||
"build:esm": "npm run build:cjs -- --module esnext --target es2019 --outDir lib/esm && echo '{\"type\":\"module\"}' > lib/esm/package.json", | ||
"build:docs": "typedoc --hideGenerator --exclude \"**/*+(index|.spec).ts\" --categorizeByGroup false --sort enum-value-ascending --sort alphabetical src", | ||
"build:docs": "typedoc src", | ||
"prepare": "npm run build" | ||
@@ -52,15 +52,15 @@ }, | ||
"devDependencies": { | ||
"@types/jest": "^29.5.1", | ||
"@types/node": "^18.16.2", | ||
"@typescript-eslint/eslint-plugin": "^5.59.1", | ||
"@typescript-eslint/parser": "^5.59.1", | ||
"eslint": "^8.39.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-jsdoc": "^43.1.1", | ||
"htmlparser2": "~8.0.2", | ||
"jest": "^29.5.0", | ||
"prettier": "^2.8.8", | ||
"ts-jest": "^29.1.0", | ||
"typedoc": "^0.24.6", | ||
"typescript": "^5.0.4" | ||
"@types/jest": "^29.5.14", | ||
"@types/node": "^22.10.2", | ||
"@typescript-eslint/eslint-plugin": "^8.18.1", | ||
"@typescript-eslint/parser": "^8.18.1", | ||
"eslint": "^8.57.1", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-jsdoc": "^50.6.1", | ||
"htmlparser2": "~9.1.0", | ||
"jest": "^29.7.0", | ||
"prettier": "^3.4.2", | ||
"ts-jest": "^29.2.5", | ||
"typedoc": "^0.27.5", | ||
"typescript": "^5.7.2" | ||
}, | ||
@@ -67,0 +67,0 @@ "jest": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
165368
2860