This release updates large swathes of the DOM APIs to conform to the standard, mostly by removing old stuff. It also fixes a few bugs, introduces a couple new features, and changes some defaults.
3.0.x will be the last release of jsdom to support Node.js. All future releases (starting with 4.0.0) will require io.js, whose new vm module will allow us to remove our contextify native-module dependency. (Given that I submitted the relevant patch to joyent/node 1.5 years ago, I'm very excited that we can finally use it!)
- By default documents now use
about:blankas their URL, instead of trying to infer some type of file URL from the call site (in Node.js) or usinglocation.href(in browsers). - Introduced a new "virtual console" abstraction for capturing console output from inside the page. See the readme for more information. Note that
console.errorwill no longer contribute to the (non-standard, and likely dying in the future)window.errorsarray. (@jeffcarp) - Added the named
new Image(width, height)constructor. (@vinothkr) - Fixed an exception when using
querySelectorwith selectors likediv:last-child > span[title]. - Removed all traces of entities, entity types, notations, default attributes, and CDATA sections.
- Differentiated between XML and HTML documents better, for example in how they handle the casing of tag names and attributes.
- Updated
DOMImplementationto mostly work per-spec, including removingaddFeatureandremoveFeaturemethods, theownerDocumentproperty, and makinghasFeaturealways returntrue. - Re-did the
CharacterDataimplementation to follow the algorithms in the DOM Standard; this notably removes a few exceptions that were previously thrown. - Re-did
Comment,Text, andProcessingInstructionto follow the DOM Standard and derive fromCharacterData. - Re-did
DocumentTypeto follow the DOM Standard and be much simpler, notably removing notations, entities, and default attributes. - Fixed a variety of accessors on
Node,Element,Attr, andDocument; some were removed that were nonstandard (especially setters); others were updated to reflect the spec; etc. - Re-did name/qname validation, which is done by various APIs, to work with the xml-name-validator package and some centralized algorithms.
- Made the XML parser at least somewhat aware of processing instructions.
- Cleaned up doctype parsing and association between doctypes and documents. More exotic doctypes should parse better now.
document.contentTypenow is generally inferred from the parsing mode of the document.- Moved some properties to
Document.prototypeandWindow.prototypeinstead of setting them as own properties during the document/window creation. This should improve memory usage (as well as spec compliance).