Comparing version 0.3.0 to 1.0.0
@@ -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 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8596
6
213
1
41
0
13
15
- Removedcomponent-query@^0.0.3
- Removedcomponent-query@0.0.3(transitive)