Ticket #160 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

Empty table header <th> elements are removed

Reported by: weswinham Owned by: jf.hovinne
Priority: major Milestone:
Component: editor Version: trunk
Keywords: Cc:

Description

Related to #133, empty th elements are removed by the parser, which breaks some table layouts.

Change History

comment:1 Changed 3 years ago by weswinham

I fixed this in my version by changing WYMeditor.XhtmlSaxListener.prototype.removeEmptyTags to:

  return xhtml.replace(new RegExp('<('+this.block_tags.join("|").replace(/\|td/,'').replace(/\|th/, '')+')>(<br \/>|&#160;|&nbsp;|\\s)*<\/\\1>' ,'g'),'');

comment:2 Changed 3 years ago by weswinham

And just for reference, the html spec doesn't say th's can't be empty (it explicitly states that they can). It doesn't make a ton of sense to have an empty header, but punishing a user by removing their cell if they make a header and then later delete those contents doesn't accomplish anything useful.

 http://www.w3.org/TR/html4/struct/tables.html#h-11.2.6

comment:3 Changed 3 years ago by jf.hovinne

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in r615, thanks.

Note: See TracTickets for help on using tickets.