Hi Marc,
thanks for your test scripts.
I have an additional question: As the magic of jQuery lies in chaining,
I wonder if expressions like these could be done with the frame environment:
$("<div>").addClass(currentWfsConf.g_label_id).text(currentWfsConf.g_label).appendTo("#wfsForm");
(Disclaimer: this is untestedcompletely and I hope it's not all bad
jQuery code)
Can you create new tags in the frame, like $("<div>", parent)?
Can you use the appendTo with a context parameter?
I failed, but I may not yet have seen the light.
Thanks for your contribution,
Christoph
Marc Jansen schrieb:
Hi devs,
as discussed on monday there are certain things to be considered when
you want to use jQuery. Please rebuild this testcript(s):
File 1 (the parent | mainframe in Mapbender):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test</title>
<script src="./tree21/jquery-1.2.1.pack.js"
type="text/javascript"></script>
</head>
<body>
<iframe src="test2.php">
</iframe>
<div id="parentdiv">I shall disappear first</div>
</body>
</html>
File 2 (the child | any frame embeded in Mapbenders mainframe):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test</title>
<script type="text/javascript">
/**
* Map over parent's jquery to this frame's "$"/"jQuery".
* Keep the second parameter to work in other contexts.
*
* @todo check thoroughly.
* @author Marc Jansen <[EMAIL PROTECTED]>
*/
if (typeof $ == 'undefined' && typeof parent.$ != 'undefined' &&
typeof jQuery == 'undefined' && typeof parent.jQuery != 'undefined') {
jQuery = function(param, context) {
return parent.jQuery(param, context || window.document);
};
$ = jQuery;
}
// a test setting
window.setTimeout(function() {
alert('working in parent');
$('#parentdiv', parent).each(function() {
alert(this);
}).hide();
alert('working in child');
$('#iframediv').each( function() {
alert(this);
}).hide();
alert('has everything disappeared?');
}, 3000 );
</script>
</head>
<body>
<div id="iframediv">I shall disappear later</div>
</body>
</html>
Try to rebuild the two files and you'll understand what is happening
here. Needs to be checked in detail!
I suggest to test this further and to use this:
/**
* Map over parent's jquery to this frame's "$"/"jQuery".
* Keep the second parameter to work in other contexts.
*
* @todo check thoroughly.
* @author Marc Jansen <[EMAIL PROTECTED]>
*/
if (typeof $ == 'undefined' && typeof parent.$ != 'undefined' &&
typeof jQuery == 'undefined' && typeof parent.jQuery != 'undefined') {
jQuery = function(param, context) {
return parent.jQuery(param, context || window.document);
};
$ = jQuery;
}
when you want to use jQuery.
Bye,
-- Marc
_______________________________________________
Mapbender_dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapbender_dev
--
***************************************
Where2B-Konferenz
Die Lösungskonferenz der WhereGroup
am 29. November 2007 in Bonn
http://www.where2b-conference.com
***************************************
_______________________________________
W h e r e G r o u p GmbH & Co. KG
Siemensstraße 8
53121 Bonn
Germany
Christoph Baudson
Anwendungsentwickler
Fon: +49 (0)228 / 90 90 38 - 17
Fax: +49 (0)228 / 90 90 38 - 11
[EMAIL PROTECTED]
http://www.wheregroup.com
Amtsgericht Bonn, HRA 6788
_______________________________________
Komplementärin:
WhereGroup Verwaltungs GmbH
vertreten durch:
Arnulf Christl, Olaf Knopp, Peter Stamm
_______________________________________
_______________________________________________
Mapbender_dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapbender_dev