Changelog for HTML-Tree

3.23    Sun Nov 12 11:09:31 CST 2006
    [THINGS THAT MAY BREAK YOUR CODE OR TESTS]
    * Mark-Jason Dominus points out that the fix for as_html was not
      proper, and broken behavior should never be codified.  Fixed
      as_html so an empty string doesn't encode entites, instead of
      blaming the behavior on HTML::Entities.  (RT 18571)

3.22 	Sat Nov 11 21:23:22 CST 2006
    [THINGS THAT MAY BREAK YOUR CODE OR TESTS]
    * HTML::Element::as_XML now only escapes five characters, instead
      of escaping everything but alphanumerics and spaces.  This is
      more in line with the XML spec, and will no longer escape wide
      characters as two (or more) entities.  Resolves RT 14260.  Thanks
      to Carl Franks and somewhere [at] confuzzled.lu for assistance.

    [FIXES]
    * A string comparison was commented to use lc() on both sides, but
      didn't.  This caused HTML::Element::look_down to not properly find
      elements in certain cases.  Thanks to Andrew Suhachov. (RT 21114)

    [TESTS]
    * Added several new tests and enhanced others.  Thanks to Rocco
      Caputo for t/attributes.t, and several others for providing
      test cases in their RT bugs.

    [DOCUMENTATION]
    * Fixed description of HTML::Element::all_attr_names.  Thanks
      to dsteinbrunner [at] pobox.com for catching it.
    * Fixed example code in HTML::Element::push_content.  Thanks
      to dsteinbrunner [at] pobox.com for catching it. (RT 21293)
    * Fixed description of HTML::Element::as_HTML.  Thanks to
      Mark-Jason Dominus for catching it.  (RT 18569)
    

3.21	Sun Aug  6 19:10:00 CDT 2006
    [FIXES]
    * Updated HTML::Parser requirement to 3.46 to fix a bug in
      tag-rendering.t, noted in RT 20816 and 19796.  Thanks to 
      Gordon Lack and Ricardo Signes
    * Fixed HTML::TreeBuilder to not remove &nbsp; where it shouldn't,
      using patch supplied in RT 17481.  Thanks to Chris Madsen.

    [DOCUMENTATION]
    * HTML-Tree has a new maintainer: Pete Krawczyk <petek@cpan.org>

3.20    Sun Jun  4 22:24:38 CDT 2006
    No code changes.  Just making sure all notes go to Andy Lester,
    not Sean Burke.

3.19_04 Wed Feb  1 09:57:35 PST 2006
    [FIXES]
    * Modified starttag() so that it could render a literal HTML::Element
      correctly. Added a test case for this in tag-rendering.t
      Thanks to Terrence Brannon.


3.19_03 Fri Nov 25 22:20:51 CST 2005
    [THINGS THAT MAY BREAK YOUR CODE]
    * The store_declarations() method has been restored, but defaults
      to true instead of false.


3.19_02 Thu Nov 24 22:51:40 CST 2005

    [THINGS THAT MAY BREAK YOUR CODE]
    * The store_declarations() method has been removed.
    * Non-closing HTML tags like <IMG> are now rendered as <IMG />.
    * All values in tags are now double-quoted.  Previously, all-numeric
      values weren't quoted.

    [FIXES]
    * The DOCTYPE declaration now always gets put back at the top of
      the recreated document.  Thanks, Terrence Brannon.
    * Non-closing HTML tags like <IMG> are now rendered as <IMG />.
      Thanks to Ian Malpass.
    * All values in tags are now double-quoted.

    [DOCUMENTATION]
    * Updated docs from Terrence Brannon.


2005-11-09   Andy Lester

   Release 3.19_01 -- No new functionality.  New tests, though!
   Thanks to the Chicago Perl Mongers for their work.

2003-09-15   Sean M. Burke <sburke@cpan.org>

   Release 3.18 -- bugfix to test, adding qr// to look_(down|up)

   Accepting Iain 'Spoon' Truskett's neat patch for qr// as lookdown
   operators (previously you had to do sub { $_[0]=~ m/.../}).

   Rewrote some tests, notably parsefile.t, which was pointlessly
   failing because of an incompatibility with an HTML::Parser version.

   Removed the disused ancient utils "dtd2pm" and "ent" from the dist.

   Added TODO file.


2003-01-18   Sean M. Burke <sburke@cpan.org>

   Release 3.17 -- minor bugfix

   HTML::Element : Making as_HTML('',...) work just like
   as_HTML(undef,...).  Also fixing as_XML's docs to remove mention of
   an unimplemented feature (specifying what characters to escape).


2002-11-06   Sean M. Burke <sburke@cpan.org>

   Release 3.16 -- just fixing a doc typo.


2002-11-06   Sean M. Burke <sburke@cpan.org>

   Release 3.15 -- a few new features.

   Added the aliases "descendents" and "find" to HTML::Element.

   Added a new method "simplify_pres" to HTML::Element.   


2002-10-19   Sean M. Burke <sburke@cpan.org>
   Release 3.14 -- minor bugfix

   Just fixes a few problems in HTML::Element with the number_lists
   method.


2002-08-16   Sean M. Burke <sburke@cpan.org>

   Release 3.13 -- basically a bugfix version

   It turns out that 3.12 had a hideous HTML::TreeBuilder bug that
   made the whole thing damn near useless.  Fixed.
   Many many thanks to Michael Koehne for catching this!

   Wrote t/parse.t, to catch this sort of thing from happening again.
   
   Fixed a bug that would treat <td> outside any table context
   as <tr><table><td> instead of <table><tr><td>



2002-07-30   Sean M. Burke <sburke@cpan.org>

   Release 3.12

   Added as_trimmed_text method to HTML::Element, as described
   (prophesied?) in the fantabulous new book /Perl & LWP/.

   Bugfix: fixed unshift_content when given a LoL.  (_parent wasn't
   getting set right.)

   HTML::Element and HTML::TreeBuilder now enforce at least some
   minimal sanity on what can be in a tag name.  (Notably, no spaces,
   slashes, or control characters.)

   Semi-bugfix: $element->replace_with(...) can now take LoLs in its
   replacement list.

   Bumped HTML::Element version up to 3.12 (right from 3.09)

   Semi-bugfix: as_XML now doesn't use named entities in its return
   value -- it always uses numeric entities.

   Added behavior: new_frow_lol can now do clever things in list
   context.

   HTML::Tree -- added blurb for /Perl & LWP/

   HTML::TreeBuilder -- added blurb for /Perl & LWP/
   Also added a few tweaks to do better with XHTML parsing.
   Added guts() and disembowel() methods, for parsing document fragments.


   TODO: desperately need to add tests to t/


2001-03-14   Sean M. Burke <sburke@cpan.org>

   Release 3.11

   Bugfix: Klaus-Georg Adams <Klaus-Georg.Adams@sap.com> reported that
   the topmost frameset element in an HTML::TreeBuilder tree wasn't
   getting its _parent attribute set.  Fixed.

   Minor bugfix: the root element of a new HTML::TreeBuilder tree was
   missing its initial "_implicit" attribute.  Fixed.

   Two handy new methods in HTML::TreeBuilder: 
    * HTML::TreeBuilder->new_from_content(...)
    * HTML::TreeBuilder->new_from_file($filename)
       a.k.a.: HTML::TreeBuilder->new_from_file($fh)

2001-03-10   Sean M. Burke <sburke@cpan.org>

   Release 3.10

   Now bundling three relevent The Perl Journal articles by me:
   HTML::Tree::AboutObjects, HTML::Tree::AboutTrees, and
   HTML::Tree::Scanning.

   Vadims_Beilins@swh-t.lv observes that $h->push_content(LoL)
   doesn't take care of _parent bookkeeping right.  FIXED.
   John Woffindin <john@xoren.co.nz> notes a similar bug in clone();
   FIXED.

   Adding no_space_compacting feature to TreeBuilder, at suggestion of
   Victor Wagner <vitus@ice.ru>.

   Incorporating the clever suggestion (from Martin H. Sluka,
   <martin@sluka.de>) that $element->extract_links's returned LoL
   should contain a third item (for the attribute name) in the
   per-link listref.  I also add a fourth item, the tagname of the
   element.

   New method, "elementify", in HTML::TreeBuilder.

   Various improvements and clarifications to the POD in
   HTML::TreeBuilder and HTML::Element.

   Some new methods in HTML::Element: "number_lists",
   "objectify_text", and "deobjectify_text".

   HTML::Element and HTML::TreeBuilder versions both bumped up from
   3.08 to 3.10, to keep pace with the HTML::Tree version.

2001-01-21   Sean M. Burke <sburke@cpan.org>

   Release 3.09

   Changed HTML/Element/traverse.pod to HTML/Element/traverse.pm

   Wrote overview file: HTML/Tree.pm

2000-11-03   Sean M. Burke <sburke@cpan.org>

   Release 3.08

   In Element and TreeBuilder: fixed handling of textarea content --
   Thanks to Ronald J Kimball <rjk@linguist.dartmouth.edu> for
   catching this.

   In Element: a few internal changes to make it subclassable by the
   forthcoming XML::Element et al.

2000-10-20   Sean M. Burke <sburke@cpan.org>

   Release 3.07

   In Element: made new_from_lol accept existing HTML::Element objects
   as part of the loltree.  Thanks for Bob Glickstein
   <bobg@zanshin.com> for the suggestion.

   In Element: feeding an arrayref to push_content, unshift_content,
   or splice_content now implicitly calls new_from_lol.

   In Element: reversed the change in as_HTML/XML/Lisp_form that would
   skip dumping attributes with references for values.  It reacted
   undesirably with objects that overload stringify; to wit, URI.pm
   objects.

2000-10-15   Sean M. Burke <sburke@cpan.org>

   Release 3.06
   
   In Element: methods added:  $x->id, $x->idf, $x->as_XML,
   $x->as_Lisp_form

   In Element: internal optimization: as_HTML no longer uses the
   tag() accessor.  Should cause no change in behavior.

   In Element: as_HTML (via starttag) no longer tries to dump
   attributes whose values are references, or whose names
   are null-string or "/".  This should cause no change in
   behavior, as there's no normal way for any document to parse
   to a tree containing any such attributes.

   In Element: minor rewordings or typo-fixes in the POD.

2000-10-02   Sean M. Burke <sburke@cpan.org>

   Release 3.05

   In Element: fixed typo in docs for the content_refs_list method.
   Had:
    foreach my $item ($h->content_array_ref) {
   Corrected to:
    foreach my $item (@{ $h->content_array_ref }) {

   In Element: fixed bug in $h->left that made it useless in scalar
   context.  Thanks to Toby Thurston <toby@wildfire.dircon.co.uk> for
   spotting this.

   In Element: added new method $h->tagname_map

   In TreeBuilder: Some minor corrections to the logic of handling TD
   and TH elements -- basically bug fixes, in response to an astute
   bug report from Toby Thurston <toby@wildfire.dircon.co.uk>.

   In TreeBuilder: Fixed lame bug that made strict-p mode nearly
   useless.  It may now approach usability!

   This dist contains a simple utility called "htmltree" that parses
   given HTML documents, and dumps their parse tree.  (It's not
   actually new in this version, but was never mentioned before.)

   In TreeBuilder, a change of interest only to advanced programmers
   familiar with TreeBuilder's source and perpetually undocumented
   features: there is no $HTML::TreeBuilder::Debug anymore.

   If you want to throw TreeBuilder into Debug mode, you have to do it
   at compile time -- by having a line like this BEFORE any line that
   says "use HTML::TreeBuilder":

      sub HTML::TreeBuilder::DEBUG () {3};
  
   where "5" is whatever debug level (0 for no debug output) that you
   want TreeBuilder to be in.  All the in TreeBuilder that used to say

     print "...stuff..." if $Debug > 1;

   now say

     print "...stuff..." if DEBUG > 1;

   where DEBUG is the constant-sub whose default value set at compile
   time is 0.  The point of this is that for the typical
   compilation-instance of TreeBuilder will run with DEBUG = 0, and
   having that set at compile time means that all the "print ... if
   DEBUG" can be optimized away at compile time, so they don't appear
   in the code tree for TreeBuilder.  This leads to a typical ~10%
   speedup in TreeBuilder code, since it's no longer having to
   constantly interrogate $Debug.

   Note that if you really do NEED the debug level to vary at runtime,
   say:
     sub HTML::TreeBuilder::DEBUG () { $HTML::TreeBuilder::DEBUG };
   and then change that variable's value as need be.  Do this only if
   necessary, tho.

   BTW, useful line to have in your ~/.cshrc:
     alias deparse 'perl -MO=Deparse \!*'
   I found it useful for deparsing TreeBuilder.pm to make sure that
   the DEBUG-conditional statements really were optimized away
   as I intended.

2000-09-04   Sean M. Burke <sburke@cpan.org>

   Release 3.04

   In TreeBuilder: added p_strict, an option to somewhat change
   behavior of implicating "</p>"s.
   Added store_comments, store_declarations, store_pis, to control
   treatment of comments, declarations, and PIs when parsing.

   In Element: documented the pseudo-elements (~comment, ~declaration,
   ~pi, and ~literal).  Corrected as_HTML dumping of ~pi elements.
   
   Removed formfeeds from source of Element and TreeBuilder --
   different editors (and Perl) treat them differently as far as
   incrementing the line counter; so Perl might report an error on
   line 314, but preceding formfeeds might make your editor think that
   that line is actually 316 or something, resulting in confusion all
   around.  Ahwell.

2000-08-26   Sean M. Burke <sburke@cpan.org>

   Release 3.03

   Introduced an optimization in TreeBuilder's logic for checking that
   body-worthy elements are actually inserted under body.  Should
   speed things up a bit -- it saves two method calls per typical
   start-tag.  Hopefully no change in behavior.

   Whoops -- 3.01's change in the return values of TreeBuilder's
   (internal) end(...) method ended up breaking the processing of list
   elements.  Fixed.  Thanks to Claus Schotten for spotting this.

   Whoops 2 -- Margarit A. Nickolov spotted that TreeBuilder
   documented a implicit_body_p_tag method, but the module didn't
   define it.  I must have deleted it some time or other.  Restored.


2000-08-20   Sean M. Burke <sburke@cpan.org>

   Release 3.02

   Fixed a silly typo in Element that made delete_ignorable_whitespace
   useless.

   Made Element's $tree->dump take an optional output-filehandle
   argument.

   Added (restored?) "use integer" to TreeBuilder.


2000-08-20   Sean M. Burke <sburke@cpan.org>

   Release 3.01

   Now depends on HTML::Tagset for data tables of HTML elements and
   their characteristics.

   Version numbers for HTML::TreeBuilder and HTML::Element, as well as
   for the package, moved forward to 3.01.

   Minor changes to HTML::TreeBuilder's docs.

   HTML::TreeBuilder now knows not to amp-decode text children of
   CDATA-parent elements.  Also exceptionally stores comments under
   CDATA-parent elements.

   TreeBuilder should now correctly parse documents with frameset
   elements.  Tricky bunch of hacks.

   TreeBuilder now ignores those pointless "x-html" tags that a
   certain standards-flouting monopolistic American software/OS
   company's mailer wraps its HTML in.

   Introduced "tweaks" in HTML::TreeBuilder -- an experimental
   (and quite undocumented) feature to allow specifying callbacks
   to be called when specific elements are closed; makes possible
   rendering (or otherwise scanning and/or manipulating) documents
   as they are being parsed.  Inspired by Michel Rodriguez's clever
   XML::Twig module.  Until I document this, email me if you're
   interested.

   HTML::Element's as_HTML now knows not to amp-escape children of
   CDATA-parent elements.  Thanks to folks who kept reminding me about this.

   HTML::Element's as_HTML can now take an optional parameter
   specifying which non-empty elements will get end-tags omitted.

   HTML::Element's traverse's docs moved into separate POD,
   HTML::Element::traverse.

   Added HTML::Element methods all_attr_names and
   all_external_attr_names.  Fixed bug in all_external_attr.

   Added HTML::Element method delete_ignorable_whitespace.
   (Actually just moved from HTML::TreeBuilder, where it was
   undocumented, and called tighten_up.)

   Adding a bit of sanity checking to Element's look_down, look_up.

   Added some formfeeds to the source of Element and TreeBuilder,
   to make hardcopy a bit more readable.

2000-06-28   Sean M. Burke <sburke@cpan.org>

   Release 0.68

   Fixed doc typo for HTML::Element's lineage_tag_names method.

   Fixed lame bug in HTML::Element's all_external_attr that made it
   quite useless.  Thanks to Rich Wales <richw@webcom.com> for the bug
   report and patch.

   Changed as_text to no longer DEcode entities, as it formerly did,
   and was documented to.  Since entities are already decoded by time
   text is stored in the tree, another decoding step is wrong.  Neither
   me nor Gisle Aas can remember what that was doing there in the
   first place.

   Changed as_text to not traverse under 'style' and 'script'
   elements.  Rewrote as_text's traverser to be iterative.

   Added a bit of text to HTML::AsSubs to recommend using XML::Generator.


2000-06-12   Sean M. Burke  <sburke@cpan.org>

   Release 0.67.  Just changes to HTML::Element...

   Introduced look_up and look_down.  Thanks to the folks on the
   libwww list for helping me find the right form for that idea.
   Deprecated find_by_attribute

   Doc typo fixed: at one point in the discussion of "consolidating
   text", I said push_content('Skronk') when I meant
   unshift_content('Skronk').  Thanks to Richard Y. Kim (ryk@coho.net)
   for pointing this out.

   Added left() and right() methods.

   Made address([address]) accept relative addresses (".3.0.1")

   Added content_array_ref and content_refs_list.

   Added a bit more clarification to bits of the Element docs here and there.

   Made find_by_tag_name work iteratively now, for speed.


2000-05-18   Sean M. Burke  <sburke@cpan.org>

   Release 0.66

   Noting my new email address.

   Fixed bug in HTML::Element::detach_content -- it would return
   empty-list, instead of returing the nodes detached.

   Fixed big in HTML::Element::replace_with_content -- it would
   accidentally completely kill the parent's content list!
   Thanks to Reinier Post and others for spotting this error.

   Fixed big in HTML::Element::replace_with -- it put replacers
   in the content list of of the new parent, !but! forgot to update
   each replacer's _parent attribute.
   Thanks to Matt Sisk for spotting this error.


2000-03-26   Sean M. Burke  <sburke@netadventure.net>

   Release 0.65

   Important additions to HTML::Element :

     Totally reimplemented the traverse() method, and added features,
     now providing a somewhat-new interface.  It's still
     backwards-compatible both syntactically and semantically.
     
     Added methods: content_list, detach_content, replace_linkage,
     normalize_content, preinsert, postinsert, and has_insane_linkage.

     $h->attr('foo', undef) now actually deletes the attribute
     'foo' from $h, instead of setting it to undef.  Hopefully
     this won't break any existing code!

   Rearranged the order of some sections in the Element docs
   for purely pedagogical reasons.

   Bugfix:  $tree->clone failed to delete the internal
   _head and _body attributes of the clone (used by TreeBuilder),
   $tree->clone->delete ended up deleting most/all of the original!
   Fixed.  Added cavets to the docs warning against cloning
   TreeBuilder objects that are in mid-parse (not that I think most
   users are exactly rushing to do this).
   Thanks to Bob Glickstein for finding and reporting this bug.

   Added some regression/sanity tests in t/

   A bit more sanity checking in TreeBuilder: checks for _head and
   _body before including it.

   Modded TreeBuilder's calls to traverse() to be use new [sub{...},0]
   calling syntax, for sake of efficiency.

   Added some undocumented and experimental code in Element and
   TreeBuilder for using HTML::Element objects to represent
   comments, PIs, declarations, and "literals".

2000-03-08   Sean M. Burke <sburke@netadventure.net>

   Release 0.64

   Bugfix:  $element->replace_with_content() would cause
   a fatal error if any of $element's content nodes were
   text segments.  Fixed.

2000-03-08   Sean M. Burke <sburke@netadventure.net>

   Release 0.63

   Fixed a typo in the SYNOPSIS of TreeBuilder.pm: I had "->destroy" for
   "->delete"!

   Added $element->clone and HTML::Element->clone_list(nodes) methods,
   as Marek Rouchal very helpfully suggested.

   $tree->as_HTML can now indent, hopefully properly.  The logic to do
   so is pretty frightening, and regrettably doesn't wrap, and it's
   not obvious how to make it capable of doing so.

   $tree->as_text can now take a 'skip_dels' parameter.

   Added $h->same_as($j) method.

   Added $h->all_attr method.

   Added $h->new_from_lol constructor method.


1999-12-18   Sean M. Burke <sburke@netadventure.net>

   Release 0.62

   Incremented HTML::AsSubs version to 1.13, and HTML::Parse version
   to 2.7, to avoid version confusion with the old (<0.60) HTML-Tree
   dist.

   Re-simplified the options to HTML::Element::traverse, removing the
   verbose_for_text option.  (The behavior that it turned on, is now
   always on; this should not cause any problems with any existing
   code.)

   Fixed HTML::Element::delete_content, and made an
   HTML::TreeBuilder::delete to override it for TreeBuilder nodes,
   which have their own special attributes.  

   HTML::Element::find_by_attribute, find_by_attribute, and get_attr_i
   now behave differently in scalar context, if you're the sort that
   likes context on method calls.  HTML::Element::descendant is now
   optimized in scalar context.

   Fixed up some of the reporting of lineages in some $Debug-triggered
   messages.

   Fixed minor bug in updating pos when a text node under HTML
   implicates BODY (and maybe P).

   You should not use release 0.61

   

1999-12-15   Sean M. Burke <sburke@netadventure.net>

   Release 0.61

   Versions in this dist:
    HTML::Parse:  2.6
    HTML::TreeBuilder: 2.91
    HTML::Element:  1.44
    HTML::AsSubs: 1.12

   No longer including the Formatter modules.

   Lots of new methods and changes in HTML::Element; reorganized docs.

   Added new HTML tags to HTML::Element's and HTML::TreeBuilder's
   internal tables.

   Reworked the logic in HTML::TreeBuilder.  Previous versions dealt
   badly with tables, and attempts to enforce content-model rules
   occasionally went quite awry.  This new version is much less
   agressive about content-model rules, and works on the principle
   that if the HTML source is cock-eyed, there's limits to what can be
   done to keep the syntax tree from being cock-eyed.

   HTML::TreeBuilder now also tries to ignore ignorable whitespace.
   The resulting parse trees often have half (or fewer) the number of
   nodes, without all the ignorable "     " nodes like before.



1999-12-15   Gisle Aas <gisle@aas.no>

   Release 0.53

   Make it compatible with HTML-Parser-3.00



1999-11-10   Gisle Aas <gisle@aas.no>

   Release 0.52

   Fix SYNOPSIS for HTML::FormatText as suggested by
   Michael G Schwern <schwern@pobox.com>

   Updated my email address.



1998-07-07   Gisle Aas <aas@sn.no>

   Release 0.51

   Avoid new warnings introduced by perl5.004_70



1998-04-01   Gisle Aas <aas@sn.no>

   Release 0.50, the HTML::* modules the dealt with HTML syntax trees
   was unbundled from libwww-perl-5.22.
