I was looking at the CleanWord-function included in the file fck_paste.html and noticed the folowing lines:
html = html.replace( /<H1([^>]*)>/gi, '<div$1><b><font size="6">' ) ;
html = html.replace( /<H2([^>]*)>/gi, '<div$1><b><font size="5">' ) ;
html = html.replace( /<H3([^>]*)>/gi, '<div$1><b><font size="4">' ) ;
html = html.replace( /<H4([^>]*)>/gi, '<div$1><b><font size="3">' ) ;
html = html.replace( /<H5([^>]*)>/gi, '<div$1><b><font size="2">' ) ;
html = html.replace( /<H6([^>]*)>/gi, '<div$1><b><font size="1">' ) ;
html = html.replace( /<\/H\d>/gi, '</font></b></div>' ) ;
I'm still thinking: why should a heading be changed into a font size?
Could anyone give me an opinion on this matter?
html = html.replace( /<H1([^>]*)>/gi, '<div$1><b><font size="6">' ) ;
html = html.replace( /<H2([^>]*)>/gi, '<div$1><b><font size="5">' ) ;
html = html.replace( /<H3([^>]*)>/gi, '<div$1><b><font size="4">' ) ;
html = html.replace( /<H4([^>]*)>/gi, '<div$1><b><font size="3">' ) ;
html = html.replace( /<H5([^>]*)>/gi, '<div$1><b><font size="2">' ) ;
html = html.replace( /<H6([^>]*)>/gi, '<div$1><b><font size="1">' ) ;
html = html.replace( /<\/H\d>/gi, '</font></b></div>' ) ;
I'm still thinking: why should a heading be changed into a font size?
Could anyone give me an opinion on this matter?
RE: Why change a heading into font size?
In addition to that, using specific font sizes is a bad idea because users have wide varieties of screens and resolutions. Relative font sizes should be used instead.
A heading with a font size of "1" is going to be quite small compared to the regular text that is displayed, and different web browsers have been known to base the rendered text on different default font sizes.
RE: Why change a heading into font size?
<font size="6"> is completely devoid of context, and using <font> tags is always a bad idea. They are semantically barren, and are not part of the XHTML Strict schema at all.
Why? Well using <hx> heading tags denotes more than just the size of the text, but gives context to what is within the tags, as well as what follows it. It breaks a document up into logical, machine parseable sections. It enables the hierarchy of the content to be navigated, useful for building up a table of contents.
Perhaps you decide later on that you want to add styling to your second level heading, so they also appear in Italics. You can't globally style your font tags, or even assume that every occurrence of <font size="5"> is a second level heading.
Seriously, if you are using <font> tags for anything, you're missing the whole point of the move towards XHTML and semantically rich markup.
I am pretty well experienced in the hassles of dealing with crappy Word HTML. I am surprised to find that FCK is stripping out some of the small amount of *good* code that word produces (Headings) and replacing it with bad code (Fonts) !
Just my 2c!
Cheers
Ben
RE: Why change a heading into font size?
I completely agree with you. I was so much suprised finding this piece of code that I kept wondering if I was overseeing something.
I'll comment these lines out.