web/data/cubicweb.compat.js
changeset 1117 20a21b3153b0
parent 226 26eb9d72e722
child 1419 7ff24154351d
--- a/web/data/cubicweb.compat.js	Tue Mar 17 19:28:11 2009 +0100
+++ b/web/data/cubicweb.compat.js	Wed Mar 18 15:09:31 2009 +0100
@@ -242,7 +242,36 @@
 UL = createDomFunction('ul');
 
 // cubicweb specific
-IFRAME = createDomFunction('iframe');
+//IFRAME = createDomFunction('iframe');
+function IFRAME(params){
+  if ('name' in params){
+    try {
+      var node = document.createElement('<iframe name="'+params['name']+'">');
+      }catch (ex) {
+	 var node = document.createElement('iframe');
+      }
+  }
+  else{
+    var node = document.createElement('iframe');
+  }
+  for (key in params) {
+    if (key != 'name'){
+      var value = params[key];
+      if (key.substring(0, 2) == 'on') {
+	// this is an event handler definition
+	if (typeof value == 'string') {
+	  // litteral definition
+	  value = new Function(value);
+	}
+	node[key] = value;
+      } else { // normal node attribute
+	node.setAttribute(key, params[key]);
+      }
+    }
+  }
+  return node;
+}
+
 
 // dummy ultra minimalist implementation on deferred for jQuery
 function Deferred() {