html-parser icon indicating copy to clipboard operation
html-parser copied to clipboard

<meta> in body resets indentation

Open tdlewis77 opened this issue 7 years ago • 0 comments

my $tree = HTML::TreeBuilder->new();
$tree->parse("<html><head></head><body><div><h1>1</h1><p>1</p></div><div><h1>2</h1><meta/><p>2</p></div></body></html>");
$tree->dump;
<html> @0
  <head> @0.0
    <meta /> @0.0.0 # Instead of @0.1.1.1
  <body> @0.1
    <div> @0.1.0
      <h1> @0.1.0.0
        "1"
      <p> @0.1.0.1
        "1"
    <div> @0.1.1
      <h1> @0.1.1.0
        "2"
    <p> @0.1.2 # Instead of @0.1.1.2
      "2"

Note: I don't know why a website author would do this, but I encountered a site that did.

tdlewis77 avatar Dec 02 '18 15:12 tdlewis77