]> source.dussan.org Git - vaadin-framework.git/commitdiff
Remove div contents from locationdivs in customlayout, Evaluate scripts
authorJoonas Lehtinen <joonas.lehtinen@itmill.com>
Fri, 15 Jun 2007 12:54:39 +0000 (12:54 +0000)
committerJoonas Lehtinen <joonas.lehtinen@itmill.com>
Fri, 15 Jun 2007 12:54:39 +0000 (12:54 +0000)
svn changeset:1750/svn branch:trunk

src/com/itmill/toolkit/terminal/gwt/client/ui/ICustomLayout.java

index 47fbb560f0a8c92731224bd9f55705f63549d718..7b492390fe9510c9592911f696bf73a191b01157 100644 (file)
@@ -65,6 +65,7 @@ public class ICustomLayout extends SimplePanel implements Paintable, Layout {
                        while (parent != null && !(parent instanceof IWindow)) parent = parent.getParent();
                        if (parent != null && ((IWindow)parent).getTheme() != null);
                        prefixImgSrcs(html.getElement(), "../theme/"+((IWindow)parent).getTheme()+"/layout/");
+                       removeAndEvalScripts(html.getElement());
        }
 
        private native void addUniqueIdsForLocations(Element e, String idPrefix) /*-{
@@ -72,7 +73,10 @@ public class ICustomLayout extends SimplePanel implements Paintable, Layout {
                for (var i = 0; i < divs.length; i++) {
                        var div = divs[i];
                        var location = div.getAttribute("location");
-                       if (location != null) div.setAttribute("id",idPrefix + location);
+                       if (location != null) {
+                               div.setAttribute("id",idPrefix + location);
+                               div.innerHTML="";
+                       }
                }                       
        }-*/;
 
@@ -84,6 +88,18 @@ public class ICustomLayout extends SimplePanel implements Paintable, Layout {
                if (src.indexOf("http") != 0) div.setAttribute("src",srcPrefix + src);
        }                       
 }-*/;
+       
+       private native void removeAndEvalScripts(Element e) /*-{
+       var scripts = e.getElementsByTagName("script"); 
+       for (var i = 0; i < scripts.length; i++) {
+               var script = scripts[i].innerHTML;
+               scripts[i].innerHTML = "";
+               try {
+               eval(script);
+               } catch (e) {}
+       }                       
+}-*/;
+
 
        public void replaceChildComponent(Widget from, Widget to) {
                CaptionWrapper wrapper = (CaptionWrapper) componentToWrapper.get(from);