Posted by
fl.schmitt(ops-users) on
URL: https://discuss.orbeon.com/xforms-output-mediatype-text-html-and-canvas-element-tp2549084p2551585.html
I've attached a test xforms page to demonstrate the problem - it
contains two instances with html content and canvas elements and some
attempts to render that html content using xforms:output. To check if
the canvas element works, the xhtml:body contains some plain html
content including similar canvas elements and some javascript to make
firefox render the canvas elements.
Using a newer firefox version, the canvas elements that are "hard-coded"
in the html body are displayed correctly, but those which should be
included in the xforms:output seem to be stripped from the output.
The test won't work with IE, i think, because canvas is still a
proprietary element. I've modified ops/xforms/clean-html.xsl, adding the
canvas element to the list of "safe" elements; also, modifying tagsoup
to let custom tags pass didn't help.
It would be great if anyone could help! Because of a recent update,
firefox doesn't allow inserting custom elements using the insertHtml
function any more. The canvas element would be an perfect replacement
for a certain custom tag i used up to now in my app, but i can't update
my app until orbeon supports displaying the canvas element in
xforms:output....
TIA
florian
Canvas Test
<div>
<p>First canvas: <canvas id="rd21" /></p>
<p>Second canvas <canvas id="rd33333" /></p>
</div>
First canvas:
Second canvas
Canvas-Test
First canvas:
Second canvas
XForms - escaped
test1 - value - saxon:parse
test2 - value - no mediatype
test3 - ref - no mediatype
test4 - value - xxforms:serialize
test5 - ref - mediatype
XForms 2 - unescaped
test1 - value - saxon:parse
test2 - value - no mediatype
test3 - ref - no mediatype
test4 - value - xxforms:serialize
test5 - ref - mediatype
var myKontext;
var myId;
var width;
var myText
var len;
var x;
var y;
var canv = document.getElementsByTagName("canvas");
for ( var int = 0; int < canv.length; int++) {
myKontext = canv[int].getContext("2d");
myId = canv[int].getAttribute("id");
myText = 'canvas with ID ' + myId;
// passe Canvas-Größe an Text-Inhalt an
len = myKontext.measureText(myText).width;
width = canv[int].width = len + 24
canv[int].height = 18
// Textposition: aus Mitte bzw von unten verschoben wg. Schatten
x = (width-len) / 2;
y = canv[int].height - 4;
// gelber Hintergrund
myKontext.fillStyle = "lightblue";
myKontext.fillRect(0,0,width,18);
// schreibe Inhalt
myKontext.fillStyle = "black";
myKontext.fillText(myText, x, y);
}
--
You receive this message as a subscriber of the
[hidden email] mailing list.
To unsubscribe: mailto:
[hidden email]
For general help: mailto:
[hidden email]?subject=help
OW2 mailing lists service home page:
http://www.ow2.org/wws