Opened 14 years ago

Closed 13 years ago

#973 closed defect (fixed)

Error switching wysiwyg/html including javascript file on the code

Reported by: Tiffany Owned by: gogo
Priority: high Milestone:
Component: Xinha Core Version:
Severity: major Keywords: javascript, html, switch, code


Hello, using Firefox if i paste an html code in xinha (html mode) that cointains a string like this:

<script type="text/javascript" src="javascript/utility.js"><!--// ajax utility //--></script>

and i switch to wysiwyg mode i'm not able to return again in html mode, it seems not work, the button remains clicked and xinha is freezed on wysiwyg mode but all buttons are disabled without "clean inline specifications" button.

some tips?
Thanks Tiffany

Change History (7)

comment:1 Changed 14 years ago by znoob2@…

I am not a dev but had a peek at it. The problem has probably something to do with a bad regular expression or so. To be precise as to when it goes wrong:

  1. you define type="text/javascript" before the src attribute and
  2. your src attribute contains 'javascript' (with or without characters around it, doesn't matter)

Temporary workaround:
define the src attribute first.

comment:2 Changed 14 years ago by wymsy

I couldn't reproduce this. Which getHtml method are you using? The DOMwalk version doesn't handle scripts very well, you should use TransformInnerHtml? instead.

comment:3 Changed 14 years ago by ray

I couldn't reproduce this, either. Tested with both getHTML methods in FF & IE7.

comment:4 Changed 14 years ago by guest

Xinha Config

xinha_plugins = xinha_plugins ? xinha_plugins :


xinha_config.getHtmlMethod = 'TransformInnerHTML';

System info

Browser: Mozilla/5.0 (Windows; U; Windows NT 5.1; nl; rv: Gecko/20070309 Firefox/
OS: Microsoft Windows XP Professional SP2
Xinha: Release: Trunk (Do, 22 Feb 2007 02:11:56 +0100)

Revision: 757
Last Changed By: ray

Both my browser and my operating system are dutch versions.


I switch to HTML view and in the line before </head> I insert this line:

    <script type="text/javascript" src="/javascript/something.js"></script>

Then switch back to wysiwyg. Firefox generates the following error (my browser is dutch, but you'll understand probably anyway):

Fout: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMJSWindow.find]"  nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)"  location: "JS frame :: http://server/project/xinha/modules/Gecko/Gecko.js :: anonymous :: line 359"  data: no]
Bronbestand: http://server/project/xinha/modules/Gecko/Gecko.js
Regel: 359

Now, although I have my interface back, the buttonbar is still grayed as for html view and the switch-to-html-view button doesn't do anything anymore.

comment:5 Changed 14 years ago by znoob2@…


    <script src="/javascript/something.js" type="text/javascript"></script>

though, works perfectly fine.

comment:6 Changed 14 years ago by znoob2@…

I think I found the bug although I cannot entirely explain it. You dev's probably may :)

It has todo with the freezescript feature. It finds script tags and replaces the last occurance of 'javascript' with 'freezescript'. Whilst it should look for 'type="text/javascript"' instead.

When I changed this (I did a preliminary test only searching for text/javascript which would still produce similar errors on file text/javascript/example.js) the bug was entirely gone. Also the unmentioned sidebug was gone (sometimes instead of crashing the script was moved to the body).

So I suggest the following:




I have tested it and could not reproduce the bug anymore. Tried 20 times :)

comment:7 Changed 13 years ago by gogo

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.