Revision history for HTML::DOM 0.016 28 August, 2008 New features/miscellaneous changes: • The UIEvent, MouseEvent and MutationEvent interfaces have been added. (Mutation events for attributes and character data modified are not yet automatically triggered.) • Events now have an init method that works like initEvent, but takes named args. • trigger_event has been extended to allow named args specify- ing the event type and which default action to take. It also chooses the right event class and reasonable defaults for the event name passed to it. • default_event_handler_for’s submit_button and reset_button event types have been removed, and default default event handlers for specific event types (i.e., default event han- dlers already in place by default) have been replaced by another mechanism (not part of the public API). • The innerHTML has been added to HTML::DOM and HTML::DOM::Element. It is currently read-only. • Triggering a form’s reset event (or calling its reset method, which in turn triggers the event) now actually resets the form. Bug fixes: • A table cell following an unclosed table cell (<td><TD>) no longer mangles the tree. This was bro- ken in 0.011 which turned that into the nonsensical <tr><td></td><tr><td></td></tr></tr>. (This may have affected other elements, as well.) • HTMLOptionsCollection is now listed as acting as a hash and as an array in HTML::DOM::Interface. • The trigger_event method now works on the document with a string arg, instead of dying. 0.015 20 August, 2008 • Removed every last reference to CSS::DOM::StyleDecl, which was renamed in 0.03. 0.014 20 August, 2008 • Fixed the Makefile.PL so it installs properly and doesn’t downgrade CSS::DOM after installing 0.03. • HTML::DOM->createEvent now dies if the arg passed to it is an unsupported event category. 0.013 19 August, 2008 New features: • HTML::DOM::Interface now indicates which members have UTF-16 equivalents. • Changes to conform to the Level-2 HTML DOM module: • HTML::DOM::Element::Input’s ‘type’ method is no longer read-only. • HTML::DOM::Element::Object now has a contentDocument, which returns nothing for now. • HTML::DOM::Element::Table’s caption, tHead and tFoot meth- ods now die when passed something other an element of the right type. • The insertRow methods of HTML::DOM::Element::Table and ::TableSection and the insertCell method of ::TableRow now die if the index is out of range. • Frame and iframe elements now each have a contentDocument method, which, for now, returns an empty HTML::DOM object. Later I need to add support for callback routines that create the object. • HTML::DOM::Exception now has a ‘code’ method. • The brand new shiny default_event_handler_for method has been added. It makes it less cumbersome to provide default behaviours for different event types. • All HTML elements now have a click method--something from HTML 5 (I seem to be getting ahead of myself). Bug fixes: • removeChild now works on the document tree. • Modification of an Attr object for an event attribute now modifies the event handler itself. • HTML::DOM::Interface no longer lists the index property of the HTMLOptionsElement interface as read-only. • HTML::DOM::Table’s and ::TableSection’s insertRow methods and ::TableRow’s insertCell method now insert the new row or cell into the right place when called with an index other than 0 or -1. • HTML::DOM::Implementation->hasFeature now returns true for Core 1.0, and not just Core 2.0. (Oops!) 0.012 29 July, 2008 Incompatible changes: • The parse_file method now uses HTML::Encoding to detect the encoding of the file, if given a file name, and if the encoding has not been set with the new ‘charset’ method or the constructor’s new ‘charset’ option. It used to assume ISO Latin 1. It still treats file handles the same way, though; that is, it assumes the file handle is produc- ing Unicode text (you have to ‘binmode’ to set the encoding if that’s not the case). New features: • The constructor now accepts a ‘charset’ option which is used by parse_file and by the make_request method of form form elements. • A ‘charset’ method has been added to HTML::DOM, which returns the encoding passed to the constructor or that parse_file used. You can also use it to set it. • parse_file’s return value is now useful: true upon success; false upon failure (to open the file) • Upward references in the object tree are now weak references. • I’ve started work on Level-2 HTML features. So far, • HTML::DOM::Interface lists HTMLOptionsCollection as a sepa- rate interface from HTMLCollection and • HTML::DOM::Collection::Options now throws an error if length is set. • A callback routine passed to event_attr_handler now receives the offset within the source of the attribute’s value as the fourth argument. • Attribute methods of elements now support implicit attri- butes (those with default values in the DTD). Bug fixes: • Suppressed an erroneous warning triggered in bleadperl (5.11 to be) by HTML::DOM::Element::Form’s inputs method. • HTML::DOM’s close method had an erroneous eval, which would catch errors that should have been propagated, in addition to the specific error it was intended to catch. • HTML::DOM::Collection::Option’s name and form_name_value methods no longer die when there are no options. • HTML::DOM::Element::Option’s text method now supports multi- ple child nodes, and no longer assumes that there is just one text node within the option. • In cases where the HTML DTD specifies a list of alternates for an attribute’s value, the corresponding DOM 0 methods return a normalised (lc) value. • HTML::DOM::Element’s removeAttributeNode method used to emit warnings when the node did not belong to the element and the element either had no attribute with the node’s name or an attribute that had never been accessed as a node. 0.011 19 May, 2008 New features: • Link and style elements now have their ‘sheet’ attribute (in other words, the LinkStyle interface has been added). • HTML::DOM now has a C<styleSheets> method (the DocumentStyle interface has been implemented). One bug fix: • The so-called ‘content_offset’ bug (RT #34404) has been fixed. It actually had nothing to do with content_offset (which merely exposed the bug), but text after the </html> tag that was inserted in the document, rather than the HTML element. 0.010 23 December, 2007 New features: • HTML::DOM::Node’s trigger_event method now returns nothing. (It used to return the return value of the default event handler.) As a side effect, this fixes a few bugs. • The classes for HTML tables and frames have been added. • HTML::DOM::Element now has a content_offset method. • HTML::DOM::Element::Form now has its reset method. • The DOM Level-2 core interfaces are now supported. • I’ve started work on CSS features. So far, elements have a ‘style’ method. • You can now access forms by using an HTML::DOM object as a hash ref. • A checkbox’s click method now toggles the checkbox’s state. Fixed bugs: • HTML::DOM::Element::Form’s submit method now returns nothing. • HTML::DOM::Element::Select’s blur and focus methods now return nothing. • HTML::DOM::Element::Button’s type method now works. • HTML::DOM::Element::Label’s htmlFor method now works. • Heading elements (h1..h6) are now blessed into the HTML::DOM::Element::Heading class, so the align method works. • HTML::DOM::Element::Object’s useMap method now works. • HTML::DOM::Element::Applet’s codeBase method now works. • tbody elements are now inserted into the tree if a <tr> occurs directly within a <table>. • HTML::DOM::Interface now includes HTML::DOM::TreeBuilder, which is used for the document’s <html> element while the HTML code is being parsed. • The as_text and as_HTML methods now work on the document’s <html> element during parsing. • The <html> element’s ‘version’ method now works dur- ing parsing. • getElementById and getElementsByTagName now stringify the name or ID (in order to make HTML::Element’s look_down method happy). These both used to return false negatives when passed objects with string overloading. • HTML::DOM::Element’s normalize method (which has been moved to HTML::DOM::Node) now actually does something. • HTML::DOM::Node’s cloneNode method used not to erase the clone’s parentNode attribute unless the cloning was deep. Nor did it erase the list of child nodes in a shallow clone, so those nodes would have multiple parents. • cloneNode now works with HTML elements (the attributes are now cloned). • HTML::DOM::CharacterData’s deleteData16 method now works properly, instead of getting offsets wrong and then convert- ing all the text into UTF-16. • HTML::DOM::Collection’s namedItem method used to return undef for form, img and map elements. • HTML::DOM::Collection::Elements’s namedItem method used to die if there were multiple form fields with the same name. • HTML::DOM’s open method no longer clobbers element handlers. 0.009 23 November, 2007 Changes/new features: * You can do something with errors produced by event handlers by passing a coderef to the new error_handler method. That coderef will be called for each error. (Before, such errors were ignored.) * HTML::DOM::Interface has been modified, such that 'Document' is no longer a separate interface--since there is no corresponding HTML::DOM module--, but all its members are now under HTMLDocument, which inherits directly from Node. Likewise, 'Element' has been merged into HTMLElement. * HTML::DOM::Element::Select now has 'add' and 'remove' methods. * 'Select' elements can now be used as array refs, so you can write $select-> instead of $select->options->. * You can now assign undef to such an array element to delete it, so '$select-> = undef' does the same thing as 'shift @$select'. 'delete $select->' also works. Bug fixes: * $form->action now works when the document has no base url (used to die) * HTML::DOM::Element::Select's type method now works. * HTML::DOM::Element::Select's selectedIndex method and HTML::DOM::Element::Option's selected method should work reliably now. * HTML::DOM::Collection::Options is now listed by HTML::DOM::Interface. * HTML::DOM::Element::Input's click method now returns an empty list. * HTML::DOM's event_attr_handler is now actually useful. (It used to be ignored most of the time.) 0.008 5 October, 2007 * New HTML::DOM::Interface module * Added type and value methods to HTML::DOM::Element::Button * Added the charset, coords and tabIndex methods to HTML::DOM::Element::A. * HTML::DOM's createElement method now throws an HTML::DOM::Exception. 0.007 29 September, 2007 Two bug fixes: * The URL method no longer warns if there is no URL. * The previous release broke parsing of forms. (The rest of the document would be within the form element.) Now it should work. 0.006 27 September, 2007 - The following interfaces have been implemented: HTMLFormElement HTMLSelectElement HTMLOptGroupElement HTMLOptionElement HTMLInputElement HTMLTextAreaElement HTMLButtonElement HTMLLabelElement HTMLFieldSetElement HTMLLegendElement HTMLUListElement HTMLOListElement HTMLDListElement HTMLDirectoryElement HTMLMenuElement HTMLLIElement HTMLDivElement HTMLParagraphElement HTMLHeadingElement HTMLQuoteElement HTMLPreElement HTMLBRElement HTMLBaseFontElement HTMLFontElement HTMLHRElement HTMLModElement HTMLAnchorElement HTMLImageElement HTMLObjectElement HTMLParamElement HTMLAppletElement HTMLMapElement HTMLAreaElement HTMLScriptElement - Some methods have also been added for compatibility with WWW::Mechanize. - The 'open' method no longer stops the ownerDocument method from working properly. - Furthermore, 'open' is no longer anywhere near as powerful as it was; it used to obliterate the coderefs that were passed to event_attr_handler and default_event_handler. - &HTML::DOM::base has been added. - The parse and eof methods have been deleted, since write and close do the same thing. 0.005 26 August, 2007 The HTMLCollection interface has now been implemented, and so have the attribute methods of the HTMLDocument interface (Level 1). The HTMLHtmlElement, HTMLHeadElement, HTMLLinkElement, HTMLTitleElement, HTMLMetaElement, HTMLBaseElement, HTMLIsIndexElement, HTMLStyleElement and HTMLBodyElement interfaces (again, Level 1) have also been implemented. 0.004 22 July, 2007 Fixed infinite recursion triggered by element handlers calling $dom_tree->write($html) when $html contains elements handled by the same handler. E.g., <script>document.write('<script>...<\/script>')</script> 0.003 15 July, 2007 - HTML::DOM::Text now has its nodeValue method, which I forgot about before. (Actually, I moved HTML::DOM::Comment's nodeValue to HTML::DOM::CharacterData.) - as_text and as_HTML have been overridden and now work. 0.002 9 July, 2007 The basic mechanism for event handling has been implemented. The various different flavours of event objects still need to be added. 0.001 27 June, 2007 The first version. So far, most of the level-1 core DOM is implemented, and a couple of HTML-specific methods, but that's all.