You are here: Foswiki>Tasks Web>Item5295 (09 Jan 2015, GeorgeClark)Edit Attach

Item5295: Use inline CSS instead of font tag to avoid malformed HTML for common user input

pencil
Priority: Normal
Current State: No Action Required
Released In: n/a
Target Release: patch
Applies To: Engine
Component:
Branches:
Reported By: TWiki:Main.EdAvis
Waiting For:
Last Change By: GeorgeClark
At the moment TWiki implements colour directives like %RED% with the <font> tag. But because HTML restricts the places font can appear, this can lead to malformed HTML being produced. For example the user might enter

<pre class="code">

Hello %RED% there %ENDCOLOR%.

</pre>

With TWiki 4.2.0, this generates a <font> inside the <pre> element, which is not permitted by the HTML DTD. The output is therefore malformed HTML. But if instead TWiki used <span style="font: #ff0000">, it would be legal HTML.

Since the <font> element is deprecated anyway it would be a good idea to move away from it towards <span style="..."> or <div style="...">.

I think this is a bug, not an enhancement, because of the malformed HTML currently being produced.

-- TWiki:Main/EdAvis - 28 Jan 2008

Currently the colours are defined in the TWikiPreferences topic. What negative and non compatible result could come out of changing to <span tags with CSS ?

-- TWiki:Main.KennethLavrsen - 28 Jan 2008

We've left the time of Netscape 4 support behind us, I think. But then even Netscape supported span color tags.

-- TWiki:Main.ArthurClemens - 28 Jan 2008

Yes, it should be safe to use: http://www.richinstyle.com/bugs/netscape4.html

-- TWiki:Main.ArthurClemens - 29 Jan 2008

ItemTemplate edit

Summary Use inline CSS instead of font tag to avoid malformed HTML for common user input
ReportedBy TWiki:Main.EdAvis
Codebase
SVN Range TWiki-5.0.0, Wed, 23 Jan 2008, build 16283
AppliesTo Engine
Component
Priority Normal
CurrentState No Action Required
WaitingFor
Checkins
TargetRelease patch
ReleasedIn n/a
CheckinsOnBranches
trunkCheckins
masterCheckins
ItemBranchCheckins
Release01x01Checkins
Topic revision: r7 - 09 Jan 2015, GeorgeClark
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy