can-child-nodes
Advanced tools
Comparing version 1.2.0 to 1.2.1
@@ -6,6 +6,6 @@ var QUnit = require('steal-qunit'); | ||
QUnit.test('Initialized the plugin', function(){ | ||
QUnit.test('Initialized the plugin', function(assert) { | ||
var div = document.createElement("div"); | ||
div.innerHTML = "<span></span>"; | ||
QUnit.equal(childNodes(div).length, 1); | ||
assert.equal(childNodes(div).length, 1); | ||
}); |
@@ -10,2 +10,3 @@ | ||
* @collection can-infrastructure | ||
* @package ./package.json | ||
* | ||
@@ -12,0 +13,0 @@ * @signature `childNodes(node)` |
@@ -1,3 +0,3 @@ | ||
/*can-child-nodes@1.1.0#can-child-nodes*/ | ||
define([ | ||
/*can-child-nodes@1.2.0#can-child-nodes*/ | ||
define('can-child-nodes', [ | ||
'require', | ||
@@ -4,0 +4,0 @@ 'exports', |
@@ -1,18 +0,25 @@ | ||
/*can-child-nodes@1.1.0#can-child-nodes*/ | ||
'use strict'; | ||
var namespace = require('can-namespace'); | ||
function childNodes(node) { | ||
var childNodes = node.childNodes; | ||
if ('length' in childNodes) { | ||
return childNodes; | ||
} else { | ||
var cur = node.firstChild; | ||
var nodes = []; | ||
while (cur) { | ||
nodes.push(cur); | ||
cur = cur.nextSibling; | ||
/*can-child-nodes@1.2.0#can-child-nodes*/ | ||
define('can-child-nodes', [ | ||
'require', | ||
'exports', | ||
'module', | ||
'can-namespace' | ||
], function (require, exports, module) { | ||
'use strict'; | ||
var namespace = require('can-namespace'); | ||
function childNodes(node) { | ||
var childNodes = node.childNodes; | ||
if ('length' in childNodes) { | ||
return childNodes; | ||
} else { | ||
var cur = node.firstChild; | ||
var nodes = []; | ||
while (cur) { | ||
nodes.push(cur); | ||
cur = cur.nextSibling; | ||
} | ||
return nodes; | ||
} | ||
return nodes; | ||
} | ||
} | ||
module.exports = namespace.childNodes = childNodes; | ||
module.exports = namespace.childNodes = childNodes; | ||
}); |
@@ -109,4 +109,5 @@ /*[process-shim]*/ | ||
args[2] = module; | ||
} else if (!args[0] && deps[0] === "exports") { | ||
// Babel uses the exports and module object. | ||
} | ||
// Babel uses the exports and module object. | ||
else if (!args[0] && deps[0] === "exports") { | ||
module = { exports: {} }; | ||
@@ -168,3 +169,3 @@ args[0] = module.exports; | ||
/*can-child-nodes@1.1.0#can-child-nodes*/ | ||
/*can-child-nodes@1.2.0#can-child-nodes*/ | ||
define('can-child-nodes', [ | ||
@@ -171,0 +172,0 @@ 'require', |
{ | ||
"name": "can-child-nodes", | ||
"version": "1.2.0", | ||
"version": "1.2.1", | ||
"description": "Read child nodes from elements", | ||
@@ -50,8 +50,8 @@ "homepage": "http://canjs", | ||
"jshint": "^2.9.1", | ||
"steal": "^1.6.5", | ||
"steal-qunit": "^1.0.1", | ||
"steal-tools": "^1.11.3", | ||
"testee": "^0.7.0" | ||
"steal": "^2.2.1", | ||
"steal-qunit": "^2.0.0", | ||
"steal-tools": "^2.2.1", | ||
"testee": "^0.9.0" | ||
}, | ||
"license": "MIT" | ||
} |
# can-child-nodes | ||
[![Build Status](https://travis-ci.org/canjs/can-child-nodes.svg?branch=master)](https://travis-ci.org/canjs/can-child-nodes) | ||
[![Join our Slack](https://img.shields.io/badge/slack-join%20chat-611f69.svg)](https://www.bitovi.com/community/slack?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![Join our Discourse](https://img.shields.io/discourse/https/forums.bitovi.com/posts.svg)](https://forums.bitovi.com/?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/canjs/can-child-nodes/blob/master/LICENSE) | ||
[![npm version](https://badge.fury.io/js/can-child-nodes.svg)](https://www.npmjs.com/package/can-child-nodes) | ||
[![Travis build status](https://travis-ci.org/canjs/can-child-nodes.svg?branch=master)](https://travis-ci.org/canjs/can-child-nodes) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/canjs/can-child-nodes.svg)](https://greenkeeper.io/) | ||
Read child nodes from elements | ||
## Usage | ||
## Documentation | ||
### ES6 use | ||
Read the [can-child-nodes API docs on CanJS.com](https://canjs.com/doc/can-child-nodes.html). | ||
With StealJS, you can import this module directly in a template that is autorendered: | ||
## Changelog | ||
```js | ||
import plugin from 'can-child-nodes'; | ||
``` | ||
See the [latest releases on GitHub](https://github.com/canjs/can-child-nodes/releases). | ||
### CommonJS use | ||
## Contributing | ||
Use `require` to load `can-child-nodes` and everything else | ||
needed to create a template that uses `can-child-nodes`: | ||
The [contribution guide](https://github.com/canjs/can-child-nodes/blob/master/CONTRIBUTING.md) has information on getting help, reporting bugs, developing locally, and more. | ||
```js | ||
var plugin = require("can-child-nodes"); | ||
``` | ||
## License | ||
### Standalone use | ||
Load the `global` version of the plugin: | ||
```html | ||
<script src='./node_modules/can-child-nodes/dist/global/can-child-nodes.js'></script> | ||
``` | ||
[MIT](https://github.com/canjs/can-child-nodes/blob/master/LICENSE) |
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
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
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
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
19378
308
16
27