Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: 1.7.2, 1.8
-
Fix Version/s: None
-
Component/s: Filters
-
Labels:None
-
Affected Branches:MOODLE_17_STABLE, MOODLE_18_STABLE
Description
Refering to http://www.brainjar.com/dhtml/events/
it was possible in previous html editor versions of moodle (at least 1.6.3 + works fine and is not changed ) to add some javascript like
<span style="background-color:yellow;"
onmouseover="this.style.backgroundColor='black';this.style.color='white'"
onmouseout="this.style.backgroundColor='yellow';this.style.color=''">
Sample element with mouse event handlers.
</span>
It is pssible to do this ONCE in current editor but current editor version adds after clicking <> (editing a resource in editor):
function anonymous() in IE
function onmouseout(event), function onmouseover(event) etc. in Firefox and Netscape
function anonymous(event) in Opera
and replaces 'black' with "black" and so on. In Firefox code looks like this after one press of <>
--------------------------------------------------
<span onmouseout="function onmouseout(event) { this.style.backgroundColor = "yellow"; this.style.color = ""; }" onmouseover="function onmouseover(event) { this.style.backgroundColor = "black"; this.style.color = "white"; }" style="background-color: yellow;"> Sample element with mouse event handlers. </span>
----------------------------------------------
It would not be a big problem - we could just say DO NOT USE JAVASCRIPT IN EDITOR - but the problem is (like Grigory Rubtsov says in a closed bug report http://tracker.moodle.org/browse/MDL-4863) that anyone can paste text that has some event handlers inside (copied from any webpage) to html editor and if that pasted text is edited second time IT CAN'T BE EDITED AGAIN IN FIREFOX.
Text can be edited in IE or cleaned from database but if users don't know it they get really confused. Pressing <> in firefox does not work and even painting - deleting - saving in firefox just does not clean code.
The main problem in firefox is this 'black' to "black" replacement that makes code uneditable in firefox. That previous report is http://tracker.moodle.org/browse/MDL-4863 (I should have left some empty space there...)