Comparing version
0.10.7 / 2013-02-10 | ||
================== | ||
* Code & doc cleanup (davidchambers) | ||
* Fixed bug in filter (jugglinmike) | ||
0.10.6 / 2013-01-29 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -94,3 +94,3 @@ var _ = require('underscore'), | ||
return make(_.filter(this, _.isString(match) ? | ||
function(el) { return select(match, el).length; } | ||
function(el) { return select(match, el)[0] === el; } | ||
: function(el, i) { return match.call(make(el), i, el); } | ||
@@ -97,0 +97,0 @@ )); |
@@ -10,3 +10,2 @@ /* | ||
updateDOM = parse.update, | ||
isArray = Array.isArray, | ||
_ = require('underscore'); | ||
@@ -51,3 +50,3 @@ | ||
// $(dom) | ||
if (selector.name || isArray(selector)) | ||
if (selector.name || Array.isArray(selector)) | ||
return this.make(selector, this); | ||
@@ -129,3 +128,3 @@ | ||
if (dom.cheerio) return dom; | ||
dom = (_.isArray(dom)) ? dom : [dom]; | ||
dom = (Array.isArray(dom)) ? dom : [dom]; | ||
return _.extend(context || new Cheerio(), dom, { length: dom.length }); | ||
@@ -132,0 +131,0 @@ }; |
@@ -6,4 +6,3 @@ /* | ||
_ = require('underscore'), | ||
isTag = require('./utils').isTag, | ||
isArray = Array.isArray; | ||
isTag = require('./utils').isTag; | ||
@@ -84,3 +83,3 @@ /* | ||
// normalize | ||
arr = isArray(arr) ? arr : [arr]; | ||
if (!Array.isArray(arr)) arr = [arr]; | ||
@@ -87,0 +86,0 @@ // Update neighbors |
/* | ||
Module dependencies | ||
*/ | ||
var _ = require('underscore'), | ||
isArray = Array.isArray; | ||
var _ = require('underscore'); | ||
@@ -68,3 +67,3 @@ /* | ||
var render = module.exports = function(dom, opts) { | ||
dom = (isArray(dom) || dom.cheerio) ? dom : [dom]; | ||
if (!Array.isArray(dom) && !dom.cheerio) dom = [dom]; | ||
opts = opts || {}; | ||
@@ -71,0 +70,0 @@ |
@@ -6,3 +6,3 @@ { | ||
"keywords": ["htmlparser", "jquery", "selector", "scraper"], | ||
"version": "0.10.6", | ||
"version": "0.10.7", | ||
"repository": { | ||
@@ -9,0 +9,0 @@ "type": "git", |
@@ -487,48 +487,5 @@ # cheerio [](http://travis-ci.org/MatthewMueller/cheerio) | ||
#### $.dom() | ||
Get the raw DOM of the parsed HTML document. | ||
```js | ||
$.dom() | ||
//=> [{ | ||
// type: 'tag', | ||
// name: 'ul', | ||
// attribs: { id: 'fruits' }, | ||
// children: | ||
// [ [Object], | ||
// [Object], | ||
// [Object], | ||
// [Object], | ||
// [Object], | ||
// [Object], | ||
// [Object] ], | ||
// parent: null, | ||
// prev: null, | ||
// next: null | ||
// }] | ||
``` | ||
#### $.contains( container, contained ) | ||
Checks to see if the `contained` DOM element is a descendent of the `container` DOM element. | ||
#### $.isArray( array ) | ||
Checks to see the passed argument is an array. | ||
```js | ||
$.isArray( $.dom() ) | ||
//=> true | ||
``` | ||
#### $.inArray( elem, arr ) | ||
Checks to see if the element is in the array | ||
#### $.makeArray( obj ) | ||
Turns an array-like object (like $) into a native array. | ||
#### $.each( obj, function(index, elem) ) | ||
Generic iterator function. | ||
#### $.merge( one, two ) | ||
Merge the contents of two arrays together into the first array. | ||
## Screencasts | ||
@@ -549,3 +506,3 @@ | ||
```shell | ||
npm install . | ||
make setup | ||
make test | ||
@@ -552,0 +509,0 @@ ``` |
@@ -140,2 +140,7 @@ var expect = require('expect.js'), | ||
}); | ||
it('(selector) : should not consider nested elements', function() { | ||
var lis = $(fruits).filter('li'); | ||
expect(lis).to.have.length(0); | ||
}); | ||
@@ -142,0 +147,0 @@ it('(fn) : should reduce the set of matched elements to those that pass the function\'s test', function() { |
Sorry, the diff of this file is not supported yet
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1933
0.05%94226
-0.6%577
-6.94%