Ticket #107 (closed defect: fixed)
Editor strips tags containing "s" character
| Reported by: | PACE | Owned by: | jf.hovinne |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.5 |
| Component: | editor | Version: | trunk |
| Keywords: | removeEmptyTags | Cc: |
Description
Whenever a tag only contains the lowercase character "s", the tag including the content gets discarded. E.g., the text "<p>This is <b>s</b>parta!</p>" is returned by the xhtml() function as "<p>This is parta!</p>".
The cause for this is an incorrect regex in the function WYMeditor.XhtmlSaxListener.prototype.removeEmptyTags:
return xhtml.replace(new RegExp('<('+this.block_tags.join("|")+')>(<br \/>| | |\s)*<\/\\1>' ,'g'),'');
There is a backslash missing before "\s", so it erroneously strips tags containing "s" instead of tags containing whitespaces.
// Correct:
return xhtml.replace(new RegExp('<('+this.block_tags.join("|")+')>(<br \/>| | |\\s)*<\/\\1>' ,'g'),'');
br, Benjamin
Change History
Note: See
TracTickets for help on using
tickets.