This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Mozilla XML > October 2005 > When does JavaScript get executed in FF-XForms?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
When does JavaScript get executed in FF-XForms?
|
|
| Adam FLinton 2005-10-17, 6:35 pm |
| Dear All,
We have an XML structure which consists of classes, attributes etc each
with a child element of annotation into which XHTML fragments can be
placed (mostly just display markup (bold underline etc).
We have a need to be able to edit these annotation elements in a
"WYSIWYG" way. The annotation would live in a textarea
There are lots of JavaScript based editors which allow for exactly this.
However it seems to be impossible to put the editors into Mozilla.
In the Novell plugin for IE the editors load & work fine.
as an example, download the tiny_mce editor into a folder beneath where
the XForm file is run from & add:
<script language="javascript" type="text/javascript"
src="./tinymce/jscripts/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
mode : "textareas"
}); </script>
Obviously adapt the src path to suit.
This in essence says "where ever you find a textarea put in tiny_mce".
However if you load this (or any other JavaScript WYSIWYG XHTML editor
you get:
Error: uncaught exception: [Exception... "Object cannot be created in
this context" code: "9" nsresult: "0x80530009
(NS_ERROR_DOM_NOT_SUPPORTED_ERR)" location:
"file:///D:/Data/Hl7/XML/XForm/Test/tinymce/jscripts/tiny_mce/tiny_mce_src.js
Line: 253"]
This line is the id'ed one:
document.write('<sc'+'ript language="javascript" type="text/javascript"
src="' + url + '"></script>');
from within:
TinyMCE.prototype.loadScript = function(url) {
for (var i=0; i<this.loadedFiles.length; i++) {
if (this.loadedFiles[i] == url)
return;
}
document.write('<sc'+'ript language="javascript" type="text/javascript"
src="' + url + '"></script>');
this.loadedFiles[this.loadedFiles.length] = url;
};
However each Javascript script blows with an
NS_ERROR_DOM_NOT_SUPPORTED_ERR error.
e.g. with another (whizzywig):
Error: uncaught exception: [Exception... "Object cannot be created in
this context" code: "9" nsresult: "0x80530009
(NS_ERROR_DOM_NOT_SUPPORTED_ERR)" location:
"file:///D:/Data/Hl7/XML/XForm/Test/whizzywig.js Line: 483"]
where again it's a document.write:
function w(string) { return document.write(string); }
So is there a fundamental problem trying to use javascript to rewrite
the contents of textareas?
I have even tried mozile as a moz/ff only option (back to ye olde detect
browser) but then I get:
Error: Error in parsing value for property '-moz-user-select'.
Declaration dropped.
Source File: file:///D:/Data/Hl7/XML/XForm/Test/MifEditor.css
Line: 7
where the css is:
-moz-user-select: normal;
Any hints, clues etc readily adopted as I would like a single XForm
which works across platforms & browsers if possible.
Adam
| |
| Allan Beaufour 2005-10-19, 6:25 am |
| Hi Adam,
Monday 17 October 2005 20:24 skrev Adam FLinton:
> However if you load this (or any other JavaScript WYSIWYG XHTML editor
> you get:
>
> Error: uncaught exception: [Exception... "Object cannot be created in
> this context" code: "9" nsresult: "0x80530009
> (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" location:
> "file:///D:/Data/Hl7/XML/XForm/Test/tinymce/jscripts/tiny_mce/tiny_mce_src.
>js Line: 253"]
My quick guess is that tinymce is oblivious to namespaces and tries to create
a script element inside an xforms:textarea, possibly resulting in
xforms:script, which does not exist.
--
Allan Beaufour
Linux Software Engineer
Novell, Inc.
Software for the Open Enterprise
www.novell.com/open
| |
| Martin Honnen 2005-10-19, 6:53 pm |
|
Adam FLinton wrote:
> However if you load this (or any other JavaScript WYSIWYG XHTML editor
> you get:
>
> Error: uncaught exception: [Exception... "Object cannot be created in
> this context" code: "9" nsresult: "0x80530009
> (NS_ERROR_DOM_NOT_SUPPORTED_ERR)" location:
> "file:///D:/Data/Hl7/XML/XForm/Test/tinymce/jscripts/tiny_mce/tiny_mce_src.js
> Line: 253"]
>
>
> This line is the id'ed one:
>
> document.write('<sc'+'ript language="javascript"
> type="text/javascript" src="' + url + '"></script>');
document.write is not supported in XHTML and XML parsed by the XML
parser, that is nothing new and does not depend on XForms, it is simply
a restriction browser implementors have imposed on script in XML/XHTML.
Here is one opinion why it is not implemented:
<http://ln.hixie.ch/?start=1091626816&count=1>
--
Martin Honnen
http://JavaScript.FAQTs.com/
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|