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

@olton/query

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@olton/query - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

__html__/dataset/dataset.html

17

package.json
{
"name": "@olton/query",
"version": "0.4.0",
"version": "0.4.1",
"description": "Query is a minimalist JavaScript library for manipulating with HTML Elements",

@@ -28,12 +28,6 @@ "main": "src/index.js",

"browserslist": [
"last 2 versions",
"not ie >= 0",
"not ie_mob >= 0",
"not op_mini all",
"not op_mob >= 0",
"not kaios >= 0",
"not samsung >= 0",
"not baidu >= 0",
"not bb >= 0",
"maintained node versions"
"last 1 Chrome versions",
"last 1 Firefox versions",
"last 1 Opera versions",
"last 1 Edge versions"
],

@@ -49,2 +43,3 @@ "devDependencies": {

"jsdom-global": "3.0.2",
"parcel": "^2.7.0",
"rollup": "^2.75.5",

@@ -51,0 +46,0 @@ "rollup-plugin-terser": "^7.0.2",

@@ -65,40 +65,1 @@ export class DataSet {

}
export const QueryDataSet = {
data(key, val){
let elem, data
if (this.length === 0) {
return
}
elem = this[0]
if (!arguments.length) {
data = $.dataset.get(elem)
if (!data) {
data = []
for(let attr of elem.attributes) {
if (attr.startsWith('data-')) {
data.push({attr: elem.getAttribute(attr)})
}
}
}
return data
}
if (arguments.length === 1) {
return $.dataset.get(elem, key) || $.dataset.attr(elem, key)
}
return this.each( function() {
$.dataset.set( this, key, val )
})
},
removeData( key ) {
return this.each( function() {
$.dataset.remove( this, key )
})
}
}

@@ -135,2 +135,46 @@ import {each} from "../helpers/each.js"

Query.use({
data(key, val){
let elem, data
if (this.length === 0) {
return
}
elem = this[0]
if (!arguments.length) {
data = $.dataset.get(elem)
if (!data) {
data = []
for(let attr of [...elem.attributes]) {
const attrName = attr.name
if (attrName.startsWith('data-')) {
const obj = {
[attrName]: elem.getAttribute(attrName)
}
// data.push([attrName, elem.getAttribute(attrName)])
data.push(obj)
}
}
}
return data
}
if (arguments.length === 1) {
return $.dataset.get(elem, key) || $.dataset.attr(elem, key)
}
return this.each( function() {
$.dataset.set( this, key, val )
})
},
removeData( key ) {
return this.each( function() {
$.dataset.remove( this, key )
})
}
})
let _$ = globalThis.$

@@ -137,0 +181,0 @@

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