Ticket #160 (closed defect: fixed)
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: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.
Note: See
        TracTickets for help on using
        tickets.
    

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 \/>| | |\\s)*<\/\\1>' ,'g'),'');