Comparing version 0.8.0 to 0.8.1
@@ -0,1 +1,7 @@ | ||
0.8.1 / 2012-06-02 | ||
================== | ||
* fixed regression where if you created an element, it would update the root | ||
* compatible with node 4.x (again) | ||
0.8.0 / 2012-05-27 | ||
@@ -2,0 +8,0 @@ ================== |
@@ -8,2 +8,5 @@ var fs = require('fs'); | ||
*/ | ||
exports.version = require('./package.json').version; | ||
exports.version = (function() { | ||
var pkg = fs.readFileSync(__dirname + '/package.json', 'utf8'); | ||
return JSON.parse(pkg).version; | ||
})(); |
@@ -158,3 +158,3 @@ var _ = require('underscore'), | ||
siblings.splice.apply(siblings, [index, 1].concat(content)); | ||
updateDOM(siblings, this.parent); | ||
@@ -161,0 +161,0 @@ this.parent.children = siblings; |
@@ -8,12 +8,4 @@ /* | ||
// Generic root element | ||
var root = { | ||
type : 'root', | ||
name : 'root', | ||
parent : null, | ||
prev : null, | ||
next : null, | ||
children : [] | ||
}; | ||
/* | ||
@@ -25,4 +17,14 @@ Parser | ||
// Generic root element | ||
var root = { | ||
type : 'root', | ||
name : 'root', | ||
parent : null, | ||
prev : null, | ||
next : null, | ||
children : [] | ||
}; | ||
// Update the dom using the root | ||
update(dom); | ||
update(dom, root); | ||
@@ -88,5 +90,2 @@ return root; | ||
arr = isArray(arr) ? arr : [arr]; | ||
// Take parent or root | ||
parent = parent || root; | ||
@@ -93,0 +92,0 @@ // Update neighbors |
@@ -36,3 +36,3 @@ /* | ||
var match = null; | ||
// Handle HTML strings | ||
@@ -44,3 +44,3 @@ if (selector.charAt(0) === "<" && selector.charAt(selector.length - 1) === ">" && selector.length >= 3) { | ||
} | ||
if (match && (match[1] || !context)) { | ||
@@ -47,0 +47,0 @@ if (match[1]) { |
@@ -6,3 +6,3 @@ { | ||
"keywords": ["htmlparser", "jquery", "selector", "scraper"], | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"repository": { | ||
@@ -9,0 +9,0 @@ "type": "git", |
@@ -85,3 +85,3 @@ # cheerio [![Build Status](https://secure.travis-ci.org/MatthewMueller/cheerio.png?branch=master)](http://travis-ci.org/MatthewMueller/cheerio) | ||
$ = cheerio.load('<ul id = "fruits">...</ul>', { ignoreWhitespace: false, xmlMode: true }); | ||
$ = cheerio.load('<ul id = "fruits">...</ul>', { ignoreWhitespace: true, xmlMode: true }); | ||
@@ -91,3 +91,3 @@ These parsing options are taken directly from htmlparser, therefore any options that can be used in htmlparser | ||
{ ignoreWhitespace: true, xmlMode: false, lowerCaseTags: false } | ||
{ ignoreWhitespace: false, xmlMode: false, lowerCaseTags: false } | ||
@@ -94,0 +94,0 @@ For a list of options and their effects, see [this](https://github.com/FB55/node-htmlparser/wiki/DOMHandler) and |
@@ -67,2 +67,11 @@ var $ = require('../'), | ||
}); | ||
describe('.load', function() { | ||
it('(html) : should retain original root after creating a new node', function() { | ||
var $html = $.load('<body><ul id = "fruits"></ul></body>'); | ||
expect($html('body')).to.have.length(1); | ||
var script = $html('<script>'); | ||
expect($html('body')).to.have.length(1); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
84056
975