- Removing "djConfig" attribute from Dojo <script> tag rendering since we don't need it for Spring Faces and it violates HTML validation.
- Ensuring that all component-rendered <script> tags include a type="text/javascript" attribute.
This commit is contained in:
@@ -20,6 +20,7 @@ public class AjaxEventInterceptorRenderer extends DojoRenderer {
|
||||
|
||||
ResponseWriter writer = context.getResponseWriter();
|
||||
writer.startElement("script", component);
|
||||
writer.writeAttribute("type", "text/javascript", null);
|
||||
|
||||
String processIds = (String) component.getAttributes().get("processIds");
|
||||
String renderIds = (String) component.getAttributes().get("renderIds");
|
||||
|
||||
@@ -180,6 +180,7 @@ public class AjaxViewRoot extends DelegatingViewRoot {
|
||||
String script = "dojo.byId('" + formId + "').action = '"
|
||||
+ context.getApplication().getViewHandler().getActionURL(context, getViewId()) + "'";
|
||||
writer.startElement("script", null);
|
||||
writer.writeAttribute("type", "text/javascript", null);
|
||||
writer.writeText(script, null);
|
||||
writer.endElement("script");
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package org.springframework.faces.ui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.context.FacesContext;
|
||||
@@ -26,9 +24,7 @@ public abstract class BaseDojoParentComponentRenderer extends BaseSpringFacesPar
|
||||
|
||||
resourceHelper.renderStyleLink(context, dijitThemePath + dijitTheme + "/" + dijitTheme + ".css");
|
||||
|
||||
Map dojoAttributes = new HashMap();
|
||||
dojoAttributes.put("djConfig", "parseOnLoad: true");
|
||||
resourceHelper.renderScriptLink(context, dojoJsResourceUri, dojoAttributes);
|
||||
resourceHelper.renderScriptLink(context, dojoJsResourceUri);
|
||||
|
||||
resourceHelper.renderScriptLink(context, springDojoJsResourceUri);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ public class DojoAdvisorRenderer extends DojoRenderer {
|
||||
resourceHelper.renderDojoInclude(context, ((DojoAdvisor) component).getDojoComponentType());
|
||||
|
||||
writer.startElement(SCRIPT_ELEMENT, component);
|
||||
writer.writeAttribute("type", "text/javascript", null);
|
||||
StringBuffer script = new StringBuffer();
|
||||
script.append(" Spring.advisors.push(new Spring.ValidatingFieldAdvisor({ ");
|
||||
script.append(" targetElId : '" + advisedChild.getClientId(context) + "', ");
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
package org.springframework.faces.ui;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.faces.component.UIComponent;
|
||||
import javax.faces.context.FacesContext;
|
||||
@@ -42,9 +40,7 @@ public class DojoRenderer extends SpringFacesRenderer {
|
||||
|
||||
resourceHelper.renderStyleLink(context, dijitThemePath + dijitTheme + "/" + dijitTheme + ".css");
|
||||
|
||||
Map dojoAttributes = new HashMap();
|
||||
dojoAttributes.put("djConfig", "parseOnLoad: true");
|
||||
resourceHelper.renderScriptLink(context, dojoJsResourceUri, dojoAttributes);
|
||||
resourceHelper.renderScriptLink(context, dojoJsResourceUri);
|
||||
|
||||
resourceHelper.renderScriptLink(context, springDojoJsResourceUri);
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ public class ProgressiveCommandLinkRenderer extends ProgressiveCommandButtonRend
|
||||
// Now render the link's HTML into a javascript variable
|
||||
ResponseWriter writer = context.getResponseWriter();
|
||||
writer.startElement("script", component);
|
||||
writer.writeAttribute("type", "text/javascript", null);
|
||||
String scriptVarStart = "var " + component.getClientId(context).replaceAll(":", "_") + "_link = \"";
|
||||
writer.writeText(scriptVarStart, null);
|
||||
writer = new DoubleQuoteEscapingWriter(writer);
|
||||
|
||||
@@ -42,6 +42,7 @@ public class ValidateAllRenderer extends SpringFacesRenderer {
|
||||
UIComponent advisedChild = (UIComponent) component.getChildren().get(0);
|
||||
|
||||
writer.startElement(SCRIPT_ELEMENT, component);
|
||||
writer.writeAttribute("type", "text/javascript", null);
|
||||
StringBuffer script = new StringBuffer();
|
||||
script.append("Spring.advisors.push(new Spring.ValidateAllAdvisor({" + "event : 'onclick', " + "targetId : '"
|
||||
+ advisedChild.getClientId(context) + "'}));");
|
||||
|
||||
Reference in New Issue
Block a user