Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2007-03-20 21:41:52

caugb
Xinha Community Member
Registered: 2006-12-04
Posts: 15

when editing, javascript events still working (IE) !?

I am editing full pages with Xinha. Ok, everything is allright, but in IE, the elements that have some javascript event, like onclick, onmouseover, ... are still enabled (it works, generating an error...).

Somebody knows the solution? that is a bug?

Thanks for any help

Offline

#2 2007-03-21 13:31:04

caugb
Xinha Community Member
Registered: 2006-12-04
Posts: 15

Re: when editing, javascript events still working (IE) !?

Ray, where are you? help!

Offline

#3 2007-03-22 13:17:45

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: when editing, javascript events still working (IE) !?

Offline

#4 2007-03-22 15:57:19

caugb
Xinha Community Member
Registered: 2006-12-04
Posts: 15

Re: when editing, javascript events still working (IE) !?

Hi Ray
I was not talking about the Xinha events, but the events inside the edited document.
If in my doc I have a menu with items like this:

<div ... onmouseover="chClass(1)" onmouseout="chClass(2)">

when editing in WYSIWYG mode this event will be working, and chClass() will be called, generating an error.
------------------------------
I hope it is more clear now...

Thank you, Cau

Offline

#5 2007-03-23 01:06:51

mharrisonline
Xinha Administrator
From: Denver, Colorado
Registered: 2005-04-11
Posts: 110
Website

Re: when editing, javascript events still working (IE) !?

I had found that to prevent onLoad events occurring, I had to replace "onLoad" with "onPlaceholder" when loading the document, and then switch it back to "onLoad" when saving. Maybe this idea would work here as well. "onmouseout" could be temporarily replaced with "onmouseplaceholderout," potentially.

Offline

#6 2007-03-23 05:15:13

ray
Xinha Administrator
From: Germany
Registered: 2005-03-23
Posts: 521
Website

Re: when editing, javascript events still working (IE) !?

this is just what happens (similarly) as of revision 793. Actually a check is inserted in the js  of the event that checks if inside the Xinha iframe and then returns false. This happens transparently in inwardHtml()/outwardHtml(), so that you won't be bothered in sourceview

Offline

#7 2007-03-23 07:39:06

caugb
Xinha Community Member
Registered: 2006-12-04
Posts: 15

Re: when editing, javascript events still working (IE) !?

Ray, i'm sorry... only now i understood.
But i made the changes specified in changeset (http://xinha.python-hosting.com/changeset/793), that affect inwardHtml, but the problem was there anyway. So I put an alert to see the HTML and I discovered that this function is not called when editor is loaded. I think we have to put it before to show the edited document to the user...

Well, before your response, i used this php functions, that modify the HTML replacing the event names before load in Xinha, and undoes that after Xinha edition (it worked well):

function disableEvents($html) {
$ever = "/(on(mouse(over|out|up|down|move)|click|dblclick|(un)?load|".
        "select|focus|blur|key(press|up|down)))(\s*=\s*)/i";
return preg_replace($ever, "_"."$1=", $html, -1);
}

function enableEvents($html) {
$dever = "/_(on(mouse(over|out|up|down|move)|click|dblclick|(un)?load|".
         "select|focus|blur|key(press|up|down)))(\s*=\s*)/i";
return preg_replace($dever, "$1=", $html, -1);
}

-> onmouseover - _onmouseover; onclick - _onclick; etc...

Last edited by caugb (2007-03-23 07:46:09)

Offline

Board footer

Powered by FluxBB