myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r1351693 - /myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/HtmlResponseWriter.java
Date Tue, 19 Jun 2012 13:01:10 GMT
Author: bommel
Date: Tue Jun 19 13:01:09 2012
New Revision: 1351693

URL: http://svn.apache.org/viewvc?rev=1351693&view=rev
Log:
(TOBAGO-1076)
Move the generated javascripts for the components to the end of the html document

Modified:
    myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/HtmlResponseWriter.java

Modified: myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/HtmlResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/HtmlResponseWriter.java?rev=1351693&r1=1351692&r2=1351693&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/HtmlResponseWriter.java
(original)
+++ myfaces/tobago/trunk/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/webapp/HtmlResponseWriter.java
Tue Jun 19 13:01:09 2012
@@ -148,14 +148,22 @@ public class HtmlResponseWriter extends 
   }
 
   @Override
-  public void endDocument() throws IOException {
-    String javascript = getJavascript();
-    if (org.apache.commons.lang.StringUtils.isNotEmpty(javascript)) {
-      startElement(HtmlElements.SCRIPT, null);
-      writeAttribute(HtmlAttributes.TYPE, "text/javascript", false);
-      write(getJavascript());
-      endElement(HtmlElements.SCRIPT);
+  public void endElement(String name) throws IOException {
+    if (name == HtmlElements.BODY) {
+      String javascript = getJavascript();
+      if (org.apache.commons.lang.StringUtils.isNotEmpty(javascript)) {
+        startElement(HtmlElements.SCRIPT, null);
+        writeAttribute(HtmlAttributes.TYPE, "text/javascript", false);
+        write(getJavascript());
+        endElement(HtmlElements.SCRIPT);
+      }
     }
+    super.endElement(name);
+  }
+
+  @Override
+  public void endDocument() throws IOException {
+
     endElement(HtmlElements.HTML);
   }
 }



Mime
View raw message