@domql/element
Advanced tools
Comparing version 2.5.173 to 2.5.174
@@ -46,2 +46,3 @@ "use strict"; | ||
module.exports = __toCommonJS(methods_exports); | ||
var import_event = require("@domql/event"); | ||
var import_utils = require("@domql/utils"); | ||
@@ -144,4 +145,7 @@ var import_tree = require("../tree"); | ||
} | ||
function remove() { | ||
function remove(opts) { | ||
const element = this; | ||
const beforeUpdateReturns = (0, import_event.triggerEventOnUpdate)("beforeRemove", element, opts); | ||
if (beforeUpdateReturns === false) | ||
return element; | ||
if ((0, import_utils.isFunction)(element.node.remove)) | ||
@@ -156,2 +160,3 @@ element.node.remove(); | ||
element.parent.__ref.__children = (0, import_utils.removeValueFromArray)(element.parent.__ref.__children, element.key); | ||
(0, import_event.triggerEventOnUpdate)("remove", element, opts); | ||
} | ||
@@ -260,2 +265,3 @@ function get(param) { | ||
verbose.call(this); | ||
throw new Error(...params); | ||
} | ||
@@ -262,0 +268,0 @@ } |
'use strict' | ||
import { triggerEventOnUpdate } from '@domql/event' | ||
import { isDefined, isObject, isFunction, isObjectLike, isProduction, removeValueFromArray, deepClone } from '@domql/utils' | ||
@@ -103,4 +104,6 @@ import { TREE } from '../tree' | ||
export function remove () { | ||
export function remove (opts) { | ||
const element = this | ||
const beforeUpdateReturns = triggerEventOnUpdate('beforeRemove', element, opts) | ||
if (beforeUpdateReturns === false) return element | ||
if (isFunction(element.node.remove)) element.node.remove() | ||
@@ -113,2 +116,3 @@ else if (!isProduction()) { | ||
if (element.parent.__ref) element.parent.__ref.__children = removeValueFromArray(element.parent.__ref.__children, element.key) | ||
triggerEventOnUpdate('remove', element, opts) | ||
} | ||
@@ -222,2 +226,3 @@ | ||
if (params[params.length - 1]?.verbose) verbose.call(this) | ||
throw new Error(...params) | ||
} | ||
@@ -224,0 +229,0 @@ } |
{ | ||
"name": "@domql/element", | ||
"version": "2.5.173", | ||
"version": "2.5.174", | ||
"license": "MIT", | ||
@@ -34,3 +34,3 @@ "type": "module", | ||
}, | ||
"gitHead": "1e24ece1c2ab9e794b662804fcac399699bf99c5", | ||
"gitHead": "b14cdb4aa1e33bc43a46bedfac8fc8a8e80221be", | ||
"devDependencies": { | ||
@@ -37,0 +37,0 @@ "@babel/core": "^7.12.0" |
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
194603
5337