Opened 8 years ago

Closed 7 years ago

#831 closed defect (fixed)

Anchors are eaten by function checkEmpty

Reported by: guest Owned by: gogo
Priority: normal Milestone: Version 1.0
Component: Xinha Core Version: trunk
Severity: normal Keywords: bug, links, cleanup
Cc:

Description

The following line in function checkEmpty(el) eats anchors on a page during a cleanup operation:

    if ( /^(a|span|b|strong|i|em|font)$/i.test(el.tagName) && !el.firstChild)
    {
      HTMLArea.removeFromParent(el);
      ++stats.empty_tags;
    }

The problem is the a in the list of tags to remove. Anchors are by definition empty tags, but they shouldn't be removed from a page during cleanup because this will break links. Removing the a in the above list solves the problem. While we're here, why not add empty div, span and p tags to this list?

Change History (3)

comment:1 Changed 8 years ago by guest

  • Keywords bug links cleanup added

Oh yes, span is already included in the list. But div and p would be good.

comment:3 Changed 7 years ago by gogo

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.