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

@cocreate/observer

Package Overview
Dependencies
Maintainers
1
Versions
218
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cocreate/observer - npm Package Compare versions

Comparing version 1.11.10 to 1.12.0

12

CHANGELOG.md

@@ -0,1 +1,13 @@

# [1.12.0](https://github.com/CoCreate-app/CoCreate-observer/compare/v1.11.10...v1.12.0) (2023-11-16)
### Bug Fixes
* callbacklist condition ([68be1f6](https://github.com/CoCreate-app/CoCreate-observer/commit/68be1f6398ce59cb70b26f1537fb75f874201ddf))
### Features
* support special selectors that end in [] ([ff24e72](https://github.com/CoCreate-app/CoCreate-observer/commit/ff24e72781d0f27bcfae31c043cdc591cdf39ec1))
## [1.11.10](https://github.com/CoCreate-app/CoCreate-observer/compare/v1.11.9...v1.11.10) (2023-11-12)

@@ -2,0 +14,0 @@

2

package.json
{
"name": "@cocreate/observer",
"version": "1.11.10",
"version": "1.12.0",
"description": "Register a components init function & observe selector. The init function will be fired immedietly after detection of selector.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -381,16 +381,23 @@ // TODO: run for all mutaitonList addedNodes and removed nodes match with this.mapCallback

let callbackType = callbacks[name]
let {
callback,
selector
} = callbackList[name];
if (callbackType === "callback") {
benchmarker.stop('mutation')
callback(mutation);
benchmarker.start('mutation')
if (callbackList[name]) {
let {
callback,
selector
} = callbackList[name];
if (callbackType === "callback") {
benchmarker.stop('mutation')
callback(mutation);
benchmarker.start('mutation')
}
else if (callbackType === "query") {
if (selector.endsWith('[]')) {
if (!mutation.target.matches(selector.slice(0, -2)))
continue
} else if (!mutation.target.matches(selector))
continue
benchmarker.stop('mutation')
callback(mutation);
benchmarker.start('mutation')
}
}
else if (callbackType === "query" && mutation.target.matches(selector)) {
benchmarker.stop('mutation')
callback(mutation);
benchmarker.start('mutation')
}
}

@@ -444,3 +451,7 @@ };

for (let el of elements) {
if (el.matches(selector)) matchedEl.push(el);
if (selector.endsWith('[]')) {
if (el.matches(selector.slice(0, -2)))
matchedEl.push(el)
} else if (el.matches(selector))
matchedEl.push(el);
}

@@ -447,0 +458,0 @@ if (matchedEl.length) {

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