Socket
Socket
Sign inDemoInstall

min-dom

Package Overview
Dependencies
Maintainers
2
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

min-dom - npm Package Compare versions

Comparing version 0.3.0 to 1.0.0

CHANGELOG.md

18

lib/classes.js

@@ -33,3 +33,3 @@ /**

module.exports = function(el){
module.exports = function(el) {
return new ClassList(el);

@@ -61,3 +61,3 @@ };

ClassList.prototype.add = function(name){
ClassList.prototype.add = function(name) {
// classList

@@ -87,3 +87,3 @@ if (this.list) {

ClassList.prototype.remove = function(name){
ClassList.prototype.remove = function(name) {
if ('[object RegExp]' == toString.call(name)) {

@@ -115,3 +115,3 @@ return this.removeMatching(name);

ClassList.prototype.removeMatching = function(re){
ClassList.prototype.removeMatching = function(re) {
var arr = this.array();

@@ -138,6 +138,6 @@ for (var i = 0; i < arr.length; i++) {

ClassList.prototype.toggle = function(name, force){
ClassList.prototype.toggle = function(name, force) {
// classList
if (this.list) {
if ("undefined" !== typeof force) {
if ('undefined' !== typeof force) {
if (force !== this.list.toggle(name, force)) {

@@ -153,3 +153,3 @@ this.list.toggle(name); // toggle again to correct

// fallback
if ("undefined" !== typeof force) {
if ('undefined' !== typeof force) {
if (!force) {

@@ -178,3 +178,3 @@ this.remove(name);

ClassList.prototype.array = function(){
ClassList.prototype.array = function() {
var className = this.el.getAttribute('class') || '';

@@ -196,3 +196,3 @@ var str = className.replace(/^\s+|\s+$/g, '');

ClassList.prototype.has =
ClassList.prototype.contains = function(name){
ClassList.prototype.contains = function(name) {
return this.list

@@ -199,0 +199,0 @@ ? this.list.contains(name)

@@ -1,1 +0,11 @@

module.exports = require('component-query');
module.exports = function(selector, el) {
el = el || document;
return el.querySelector(selector);
};
module.exports.all = function(selector, el) {
el = el || document;
return el.querySelectorAll(selector);
};
{
"name": "min-dom",
"version": "0.3.0",
"version": "1.0.0",
"description": "A minimal dom utility toolbelt",
"scripts": {
"test": "karma start test/config/karma.conf.js --single-run --no-auto-watch"
"lint": "eslint .",
"test": "karma start",
"all": "run-s lint test"
},

@@ -27,3 +29,2 @@ "keywords": [

"component-event": "^0.1.4",
"component-query": "^0.0.3",
"delegate-events": "^1.1.1",

@@ -37,2 +38,4 @@ "domify": "^1.3.1",

"chai": "^4.1.2",
"eslint": "^4.11.0",
"eslint-plugin-mocha": "^4.11.0",
"karma": "^1.7.1",

@@ -45,4 +48,5 @@ "karma-browserify": "^5.1.1",

"mocha": "^4.0.1",
"npm-run-all": "^4.1.2",
"watchify": "^3.9.0"
}
}

@@ -10,12 +10,13 @@ # min-dom

Tiny if exposing only the most basic utilities (`event`, `classes`, `delegate`, `matches`, `query`).
This library is tiny (`2Kb` in size) and still exposes all fundamental utilities:
```bash
$ browserify index.js \
--standalone=dom \
--plugin=tinyify | \
gzip > min-dom.min.js.gz
$ du -b *.gz
1842 min-dom.min.js.gz
```
$ browserify index.js --standalone=dom | \
bundle-collapser | \
uglifyjs | \
gzip > min-dom.min.js.gz
$ du min-dom.min.js.gz
4 min-dom.min.js.gz
```

@@ -35,3 +36,3 @@

* `matches` - selector match check; [matches-selector](https://github.com/ForbesLindesay/matches-selector)
* `query` - selector query support; [component-query](https://github.com/component/query)
* `query` - native selector query support
* `remove` - detach a node from its parent

@@ -38,0 +39,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