Strikethrough / line-through problem

Strikethrough / line-through problem

by Glenys Hanson -
Number of replies: 5
Hello,

The strikethrough icon in the Moodle text editor creates: strikethrough
That is with the code: <span style="text-decoration: line-through;">strikethrough</span>

I work on several Moodle platforms. On some of them (1.9, 1.6) this code is removed by Moodle when the message (or wiki, or glossary item) is saved, though it works fine here and on at 1.8 platform I use.

It used to work fine on all the platforms. I'm not the administrator on these platforms. What can the administrators have done to cause this change and what can they do to solve the problem?

I know there is a workaround: to put in manually <strike>word</strike>. This is fine (though I believe deprecated?) for one or two words, but I need a better solution as I have a Grammar Glossary where there are dozens of examples of erroneous words and expressions intended to be indicated by being crossed out. The removal of all the crossings-out is causing confusion to the students. The Grammar Glossary is integrated into several courses. I can't even remove it easily without causing a lot of knock-on effects. What can I do?

Cheers,
Glenys
Average of ratings: -
In reply to Glenys Hanson

Re: Strikethrough / line-through problem

by Glenys Hanson -
Hello,

My administator has found that the problem comes from Firefox which creates the tag <span style="text-decoration: line-through;"> while IE7 creates <strike>

<span style="text-decoration: line-through;"> is not interpreted by some versions of Moodle.

Why does the HTML editor create different tags in different browsers?

Is this a bug?

Cheers,
Glenys
In reply to Glenys Hanson

Re: Strikethrough / line-through problem

by Glenys Hanson -
Hello,

Does nobody have an answer to this problem?

What can I do?

Cheers,
Glenys
In reply to Glenys Hanson

Re: Strikethrough / line-through problem

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Glenys,

Sorry I don't have an answer for the problem you describe, however I suggest you report it in the tracker, then post the issue number in this discussion. This will ensure that developers investigate the problem as quickly as possible.
In reply to Glenys Hanson

Re: Strikethrough / line-through problem

by Mauno Korpelainen -
Maybe this has something to do with

$ALLOWED_TAGS

in weblib.php

I have not tested all versions of moodle but <span> really should work everywhere. We should have 4 different ways to do strikethrough:

<del>test1</del>: test1

<s>test2</s>: test2

<strike>test3</strike>: test3

<span style="text-decoration: line-through">test4</span>: test4

but here in moodle.org + in wiki & glossary on my test site moodle is filtering <del> and <s>

The <s> and <strike> elements were deprecated in HTML 4.01 and
 <s> and <strike> elements are not supported in XHTML 1.0 Strict DTD but <del> is valid XHTML 1.0 Strict DTD and should not be stripped away. I think htmlarea is just using global browser javascript command

execCommand("strikethrough")

without parsing so this "bug" must come from some filter. All browsers support it but browsers (not editors) may generate different code for execCommands: http://www.quirksmode.org/dom/execCommand.html

In reply to Mauno Korpelainen

Re: Strikethrough / line-through problem

by Mauno Korpelainen -

A really quick test: I selected "Tim O'Reilly" in http://www.quirksmode.org/dom/execCommand/ and then pressed <s> button. Results:

In Firefox: <span style="text-decoration: line-through;">Tim O'Reilly</span>

In Safari: <span class="Apple-style-span" style="text-decoration: line-through;">Tim O'Reilly</span>

In IE7 and Opera: <STRIKE>Tim O'Reilly </STRIKE>

To force all browsers to use same tags we should use some other function instead of execCommand("strikethrough") in htmlarea.php or parse/replace tags afterwards