Skip to content

Releases: cheeriojs/cheerio

1.0.0-rc.2

02 Jul 17:37
Compare
Choose a tag to compare
1.0.0-rc.2 Pre-release
Pre-release

This release changes Cheerio's default parser to the Parse5 HTML
parser
. Parse5 is an excellent project
that rigorously conforms to the HTML standard. It does not support XML, so
Cheerio continues to use htmlparser2
when working with XML documents.

This switch addresses many long-standing bugs in Cheerio, but some users may
experience slower behavior in performance-critical applications. In addition,
htmlparser2 is more forgiving of invalid markup which can be useful when
input sourced from a third party and cannot be corrected. For these reasons,
the load method also accepts a DOM structure as produced by the htmlparser2
library. See the project's "readme" file for more details on this usage
pattern.

Migrating from version 0.x

cheerio.load( html[, options ] ) This method continues to act as a "factory"
function. It produces functions that define an API that is similar to the
global jQuery function provided by the jQuery library. The generated function
operates on a DOM structure based on the provided HTML.

In releases prior to version 1.0, the provided HTML was interpreted as a
document fragment. Following version 1.0, strings provided to the load method
are interpreted as documents. The same example will produce a $ function that
operates on a full HTML document, including an <html> document element with
nested <head> and <body> tags. This mimics web browser behavior much more
closely, but may require alterations to existing code.

For example, the following code will produce different results between 0.x and
1.0 releases:

const $ = cheerio.load('<p>Hello, <b>world</b>!</p>');

$.root().html();

//=> In version 0.x: '<p>Hello, <b>world</b>!</p>'
//=> In version 1.0: '<html><head></head><body><p>Hello, <b>world</b>!</p></body></html>'

Users wishing to parse, manipulate, and render full documents should not need
to modify their code. Likewise, code that does not interact with the "root"
element should not be effected by this change. (In the above example, the
expression $('p') returns the same result across Cheerio versions--a Cheerio
collection whose only member is a paragraph element.)

However, users wishing to render document fragments should now explicitly
create a "wrapper" element to contain their input.

// First, create a Cheerio function "bound" to an empty document (this is
// similar to loading an empty page in a web browser)
var $ = cheerio.load('');
// Next, create a "wrapper" element for the input fragment:
var $wrapper = $('<div/>');
// Finally, supply the input markup as the content for the wrapper:
$wrapper.append('<p>Hello, <b>world</b>!</p>');

$wrapper.html();
//=> '<p>Hello, <b>world</b>!</p>'

Change log:

  • Update History.md (and include migration guide) (Mike Pennisi)
  • Rename useHtmlParser2 option (Mike Pennisi)
  • Remove documentation for xmlMode option (Mike Pennisi)
  • Document advanced usage with htmlparser2 (Mike Pennisi)
  • Correct errors in Readme.md (Mike Pennisi)
  • Improve release process (Mike Pennisi)
  • 1.0.0-rc.1 (Mike Pennisi)
  • Update unit test (Mike Pennisi)
  • Normalize code style (Mike Pennisi)
  • Added support for nested wrapping. (Diane Looney)
  • Add nested wrapping test (Toni Helenius)
  • Added $.merge following the specification at https://api.jquery.com/jquery.merge/ Added test cases for $.merge (Diane Looney)
  • Clarify project scope in README file (Mike Pennisi)
  • .text() ignores script and style tags (#1018) (Haleem Assal)
  • Test suite housekeeping (#1016) (DianeLooney)
  • experiment with a job board (Matthew)
  • Change options format (inikulin)
  • Add test for #997 (inikulin)
  • Update .filter function docs. (Konstantin)
  • Standardise readme on ES6 variable declarations (Dekatron)
  • Use documents via $.load (inikulin)
  • Use parse5 as a default parser (closes #863) (inikulin)
  • Fix small typo in Readme (Darren Scerri)
  • Report test failures in CI (Mike Pennisi)
  • serializeArray should not ignore input elements without value attributes (Ricardo Gladwell)
  • Disallow variable shadowing (Mike Pennisi)
  • Update hasClass method (sufisaid)
  • Added MIT License fixes #902 (Prasanth Vaaheeswaran)
  • chore(package): update dependencies (greenkeeper[bot])
  • Use modular lodash package (#913) (Billy Janitsch)

1.0.0-rc.1

27 May 20:58
Compare
Choose a tag to compare
1.0.0-rc.1 Pre-release
Pre-release
Version 1.0.0 release candidate number 1

0.22.0

15 Dec 00:19
Compare
Choose a tag to compare
  • Return undefined in .prop if given an invalid element or tag (#880)
  • Merge pull request #884 from cheeriojs/readme-cleanup
  • readme updates
  • Merge pull request #881 from piamancini/patch-1
  • Added backers and sponsors from OpenCollective
  • Use jQuery from the jquery module in benchmarks (#871)
  • Document, test, and extend static $.text method (#855)
  • Fix typo on calling _.extend (#861)
  • Update versions (#870)
  • Use individual lodash functions (#864)
  • Added .serialize() support. Fixes #69 (#827)
  • Update Readme.md (#857)
  • add extension for JSON require call
  • remove gittask badge
  • Merge pull request #672 from underdogio/dev/checkbox.radio.values.sqwished
  • Added default value for checkboxes/radios

0.20.0

15 Dec 00:20
Compare
Choose a tag to compare
  • Add coveralls badge, remove link to old report (Felix Böhm)
  • Update lodash dependeny to 4.1.0 (leif.hanack)
  • Fix PR #726 adding 'appendTo()' and 'prependTo()' (Delgan)
  • Added appendTo and prependTo with tests #641 (digihaven)
  • Fix #780 by changing options context in '.find()' (Felix Böhm)
  • Add an unit test checking the query of child (Delgan)
  • fix #667: attr({foo: null}) removes attribute foo, like attr('foo', null) (Ray Waldin)
  • Include reference to dedicated "Loading" section (Mike Pennisi)
  • Added load method to $ (alanev)
  • update css-select to 1.2.0 (Felix Böhm)
  • Fixing Grammatical Error (Dan Corman)
  • Test against node v0.12 --> v4.2 (Jason Kurian)
  • Correct output in example (Felix Böhm)
  • Fix npm files filter (Bogdan Chadkin)
  • Enable setting data on all elements in selection (Mike Pennisi)
  • Reinstate $.fn.toArray (Mike Pennisi)
  • update css-select to 1.1.0 (Thomas Shafer)
  • Complete implementation of wrap (Mike Pennisi)
  • Correct name of unit test (Mike Pennisi)
  • Correct grammar in test titles (Mike Pennisi)
  • Normalize whitespace (Mike Pennisi)
  • Insert omitted assertion (Mike Pennisi)
  • Update invocation of children (Mike Pennisi)
  • Begin implementation of wrap method (Dandlezzz)
  • Update Readme.md (Sven Slootweg)
  • fix document's mistake in Readme.md (exoticknight)
  • Add tests for setting text and html as non-strings (Ryc O'Chet)
  • Fix for passing non-string values to .html or .text (Ryc O'Chet)
  • use a selector to filter form elements (fb55)
  • fix README.md typo (Yutian Li)
  • README: fix spelling (Chris Rebert)
  • Added support for options without a value attribute. Fixes #633 (Todd Wolfson)
  • responding to pull request feedback - remove item() method and related tests (Ray Waldin)
  • add length property and item method to object returned by prop('style'), plus tests (Ray Waldin)
  • Added .prop method to readme (Artem Burtsev)
  • Added .prop method (Artem Burtsev)
  • Added Gitter badge (The Gitter Badger)

0.19.0

15 Dec 00:21
Compare
Choose a tag to compare
  • fixed allignment (fb55)
  • added test case for malformed json in data attributes (fb55)
  • fix: handle some extreme cases like data-custom="{{templatevar}}". There is possibility error while parsing json . (Harish.K)
  • Add missing optional selector doc for {prev,next}{All,Until} (Jérémie Astori)
  • update to dom-serializer@0.1.0 (Felix Böhm)
  • Document Cheerio#serialzeArray (Mike Pennisi)
  • Fixed up serializeArray() and added multiple support (Todd Wolfson)
  • Implement serializeArray() (Jarno Leppänen)
  • recognize options in $.xml() (fb55)
  • lib/static.js: text(): rm errant space before ++ (Chris Rebert)
  • Do not expose internal children array (Mike Pennisi)
  • Change lodash dependencies to ^3.1.0 (Samy Pessé)
  • Update lodash@3.1.0 (Samy Pessé)
  • Updates Readme.md: .not(function (index, elem)) (Patrick Ward)
  • update to css-select@1.0.0 (fb55)
  • Allow failures in Node.js v0.11 (Mike Pennisi)
  • Added: Gittask badge (Matthew Mueller)
  • Isolate prototypes of functions created via load (Mike Pennisi)
  • Updates Readme.md: adds JS syntax highlighting (frankcash)
  • #608 -- Add support for insertBefore/insertAfter syntax. Supports target types of: $, [$], selector (both single and multiple results) (Ben Cochran)
  • Clone input nodes when inserting over a set (Mike Pennisi)
  • Move unit test files (Mike Pennisi)
  • remove unnecessarily tricky code (David Chambers)
  • pass options to $.html in toString (fb55)
  • add license info to package.json (Chris Rebert)
  • xyz@~0.5.0 (David Chambers)
  • Remove unofficial signature of children (Mike Pennisi)
  • Fix bug in css method (Mike Pennisi)
  • Correct bug in implementation of Cheerio#val (Mike Pennisi)

0.18.0

15 Dec 00:21
Compare
Choose a tag to compare
  • bump htmlparser2 dependency to ~3.8.1 (Chris Rebert)
  • Correct unit test titles (Mike Pennisi)
  • Correct behavior of after and before (Mike Pennisi)
  • implement jQuery's .has() (Chris Rebert)
  • Update repository url (haqii)
  • attr() should return undefined or name for booleans (Raoul Millais)
  • Update Readme.md (Ryan Breen)
  • Implement Cheerio#not (Mike Pennisi)
  • Clone nodes according to original parsing options (Mike Pennisi)
  • fix lint error (David Chambers)
  • Add explicit tests for DOM level 1 API (Mike Pennisi)
  • Expose DOM level 1 API for Node-like objects (Mike Pennisi)
  • Correct error in documentation (Mike Pennisi)
  • Return a fully-qualified Function from $.load (Mike Pennisi)
  • Update tests to avoid duck typing (Mike Pennisi)
  • Alter "loaded" functions to produce true instances (Mike Pennisi)
  • Organize tests for cheerio.load (Mike Pennisi)
  • Complete $.prototype.find (Mike Pennisi)
  • Use JSHint's extends option (Mike Pennisi)
  • Remove aliases for exported methods (Mike Pennisi)
  • Disallow unused variables (Mike Pennisi)
  • Remove unused internal variables (Mike Pennisi)
  • Remove unused variables from unit tests (Mike Pennisi)
  • Remove unused API method references (Mike Pennisi)
  • Move tests for contains method (Mike Pennisi)
  • xyz@0.4.0 (David Chambers)
  • Created a wiki for companies using cheerio in production (Matthew Mueller)
  • Implement $.prototype.index (Mike Pennisi)
  • Implement $.prototype.addBack (Mike Pennisi)
  • Added double quotes to radio attribute name to account for characters such as brackets (akant10)
  • Update History.md (Gabriel Falkenberg)
  • add 0.17.0 changelog (David Chambers)
  • exit prepublish script if tag not found (David Chambers)
  • alphabetize devDependencies (fb55)
  • ignore coverage dir (fb55)
  • submit coverage to coveralls (fb55)
  • replace jscoverage with istanbul (fb55)

0.17.0

15 Dec 00:22
Compare
Choose a tag to compare
  • Fix bug in internal uniqueSplice function (Mike Pennisi)
  • accept buffer argument to cheerio.load (David Chambers)
  • Respect options on the element level (Alex Indigo)
  • Change state definition to more readable (Artem Burtsev)
  • added test (0xBADC0FFEE)
  • add class only if doesn't exist (Artem Burtsev)
  • Made it less insane. (Alex Indigo)
  • Implement Cheerio#add (Mike Pennisi)
  • Use "loaded" instance of Cheerio in unit tests (Mike Pennisi)
  • Be more strict with object check. (Alex Indigo)
  • Added options argument to .html() static method. (Alex Indigo)
  • Fixed encoding mishaps. Adjusted tests. (Alex Indigo)
  • use dom-serializer module (fb55)
  • don't test on 0.8, don't ignore 0.11 (Felix Böhm)
  • parse: rm unused variables (coderaiser)
  • cheerio: rm unused variable (coderaiser)
  • Fixed test (Avi Kohn)
  • Added test (Avi Kohn)
  • Changed == to === (Avi Kohn)
  • Fixed a bug in removing type="hidden" attr (Avi Kohn)
  • sorted (Alexey Raspopov)
  • add muted attr to booleanAttributes (Alexey Raspopov)
  • fixed context of this in .html (Felix Böhm)
  • append new elements for each element in selection (fb55)

0.16.0

15 Dec 00:22
Compare
Choose a tag to compare
  • fix make bench (David Chambers)
  • makefile: add release-* targets (David Chambers)
  • alphabetize dependencies (David Chambers)
  • Rewrite data internals with caching behavior (Mike Pennisi)
  • Fence .val example as js (Kevin Sawicki)
  • Fixed typos. Deleted trailing whitespace from test/render.js (Nattaphoom Ch)
  • Fix manipulation APIs with removed elements (kpdecker)
  • Perform manual string parsing for hasClass (kpdecker)
  • Fix existing element removal (kpdecker)
  • update render tests (Felix Böhm)
  • fixed cheerio path (Felix Böhm)
  • use entities.escape for attribute values (Felix Böhm)
  • bump entities version (Felix Böhm)
  • remove lowerCaseTags option from readme (Felix Böhm)
  • added test case for .html in xmlMode (fb55)
  • render xml in html() when xmlMode: true (fb55)
  • use a map for booleanAttributes (fb55)
  • update singleTags, use utils.isTag (fb55)
  • update travis badge URL (Felix Böhm)
  • use typeof instead of _.isString and _.isNumber (fb55)
  • use Array.isArray instead of _.isArray (fb55)
  • replace _.isFunction with typeof (fb55)
  • removed unnecessary error message (fb55)
  • decode entities in htmlparser2 (fb55)
  • pass options object to CSSselect (fb55)

0.15.0

15 Dec 00:23
Compare
Choose a tag to compare
  • Update callbacks to pass element per docs (@kpdecker)
  • preserve options (@fb55)
  • Use SVG travis badge (@t3chnoboy)
  • only use static requires (@fb55)
  • Optimize manipulation methods (@kpdecker)
  • Optimize add and remove class cases (@kpdecker)
  • accept dom of DomHandler to cheerio.load (@nleush)
  • added parentsUntil method (@finspin)
  • Add performance optimization and bug fix empty method (@kpdecker)

0.14.0

15 Dec 00:23
Compare
Choose a tag to compare