Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

domutils

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

domutils - npm Package Compare versions

Comparing version 2.4.0 to 2.4.1

2

lib/legacy.d.ts

@@ -12,5 +12,5 @@ import { Node, Element } from "domhandler";

export declare function getElementById(id: string | ((id: string) => boolean), element: Node | Node[], recurse?: boolean): Element | null;
export declare function getElementsByTagName(name: string | ((name: string) => boolean), element: Node | Node[], recurse: boolean, limit?: number): Element[];
export declare function getElementsByTagName(name: string | ((name: string) => boolean), element: Node | Node[], recurse?: boolean, limit?: number): Element[];
export declare function getElementsByTagType(type: ElementType | ((type: ElementType) => boolean), element: Node | Node[], recurse?: boolean, limit?: number): Node[];
export {};
//# sourceMappingURL=legacy.d.ts.map

@@ -69,2 +69,3 @@ "use strict";

function getElementsByTagName(name, element, recurse, limit) {
if (recurse === void 0) { recurse = true; }
if (limit === void 0) { limit = Infinity; }

@@ -71,0 +72,0 @@ return querying_1.filter(Checks.tag_name(name), element, recurse, limit);

@@ -16,22 +16,29 @@ import type { Node, Element } from "domhandler";

/**
* Append a child to an element
* Append a child to an element.
*
* @param elem The element to append to
* @param child The element to be added as a child
* @param elem The element to append to.
* @param child The element to be added as a child.
*/
export declare function appendChild(elem: Element, child: Node): void;
/**
* Append an element after another
* Append an element after another.
*
* @param elem The element to append to
* @param next The element be added
* @param elem The element to append after.
* @param next The element be added.
*/
export declare function append(elem: Node, next: Node): void;
/**
* Prepend an element before another
* Prepend a child to an element.
*
* @param elem The element to append to
* @param prev The element be added
* @param elem The element to prepend before.
* @param child The element to be added as a child.
*/
export declare function prependChild(elem: Element, child: Node): void;
/**
* Prepend an element before another.
*
* @param elem The element to prepend before.
* @param prev The element be added.
*/
export declare function prepend(elem: Node, prev: Node): void;
//# sourceMappingURL=manipulation.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.prepend = exports.append = exports.appendChild = exports.replaceElement = exports.removeElement = void 0;
exports.prepend = exports.prependChild = exports.append = exports.appendChild = exports.replaceElement = exports.removeElement = void 0;
/**

@@ -43,23 +43,26 @@ * Remove an element from the dom

/**
* Append a child to an element
* Append a child to an element.
*
* @param elem The element to append to
* @param child The element to be added as a child
* @param elem The element to append to.
* @param child The element to be added as a child.
*/
function appendChild(elem, child) {
removeElement(child);
child.next = null;
child.parent = elem;
if (elem.children.push(child) !== 1) {
if (elem.children.push(child) > 1) {
var sibling = elem.children[elem.children.length - 2];
sibling.next = child;
child.prev = sibling;
child.next = null;
}
else {
child.prev = null;
}
}
exports.appendChild = appendChild;
/**
* Append an element after another
* Append an element after another.
*
* @param elem The element to append to
* @param next The element be added
* @param elem The element to append after.
* @param next The element be added.
*/

@@ -87,12 +90,33 @@ function append(elem, next) {

/**
* Prepend an element before another
* Prepend a child to an element.
*
* @param elem The element to append to
* @param prev The element be added
* @param elem The element to prepend before.
* @param child The element to be added as a child.
*/
function prependChild(elem, child) {
removeElement(child);
child.parent = elem;
child.prev = null;
if (elem.children.unshift(child) !== 1) {
var sibling = elem.children[1];
sibling.prev = child;
child.next = sibling;
}
else {
child.next = null;
}
}
exports.prependChild = prependChild;
/**
* Prepend an element before another.
*
* @param elem The element to prepend before.
* @param prev The element be added.
*/
function prepend(elem, prev) {
removeElement(prev);
var parent = elem.parent;
if (parent) {
var childs = parent.children;
childs.splice(childs.lastIndexOf(elem), 0, prev);
childs.splice(childs.indexOf(elem), 0, prev);
}

@@ -99,0 +123,0 @@ if (elem.prev) {

{
"name": "domutils",
"version": "2.4.0",
"version": "2.4.1",
"description": "Utilities for working with htmlparser2's dom",

@@ -34,3 +34,3 @@ "author": "Felix Boehm <me@feedic.com>",

"domelementtype": "^2.0.1",
"domhandler": "^3.1.0"
"domhandler": "^3.2.0"
},

@@ -37,0 +37,0 @@ "devDependencies": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc