Whenever Cheerio inserts a node as a child of a some other node, it explicitly removes it from its previous `children` array. This both avoids memory leaks and more faithfully matches the behavior of the W3C DOM, where a node may only be a child of one other node. When a user creates an array of node objects from a string using `$.parseHTML`, she most likely intends to insert the contents into some previously-existing DOM structure. If supplied with the `children` array directly, future insertion operations will modify the contents of that array. This is both unintuitive from an API design perspective and inconsistent with jQuery's behavior. To avoid silently changing the contents of arrays given to users, update `$.parseHTML` to return a shallow copy of the `children` structure.
Node.js version 0.11 is an unstable platform, meaning it may introduce breaking changes at any time. It is useful for the project maintainers to be aware of such failures (because they represent potential problems with the next stable release of Node.js), they should not block ongoing work.
Ensure that each Cheerio function created with the `load` static method has a dedicated object in its prototype chain. This allows for conflict-free extension of the generated prototype. Additionally, expose the `fn` prototype alias as defined by jQuery and used by many jQuery plugins.
…get types of: $, [$], selector (both single and multiple results)
This patch increases parity with jQuery, specifically in cases where manipulation methods are called with existing nodes on sets containing more than one element. In such cases, the provided node should be cloned prior to insertion (excepting the final element in the set, where the original node should be inserted).