This is an automated email from the ASF dual-hosted git repository.

svenmeier pushed a commit to branch WICKET-6321-cross-origin-integrity
in repository https://gitbox.apache.org/repos/asf/wicket.git

commit a5d359ab7a99e763265bbf80c1276ddbb577276d
Author: Sven Meier <[email protected]>
AuthorDate: Mon Dec 9 17:40:58 2019 +0100

    WICKET-6667 removed conditional comments
    
    since IE 11 no longer supports them
---
 .../AbstractJavaScriptReferenceHeaderItem.java     |   6 +-
 .../wicket/markup/head/CssContentHeaderItem.java   |  18 +--
 .../apache/wicket/markup/head/CssHeaderItem.java   | 173 ++-------------------
 .../wicket/markup/head/CssReferenceHeaderItem.java |  12 +-
 .../markup/head/CssUrlReferenceHeaderItem.java     |  13 +-
 .../markup/head/JavaScriptContentHeaderItem.java   |  17 +-
 .../wicket/markup/head/JavaScriptHeaderItem.java   | 110 +------------
 .../markup/head/JavaScriptReferenceHeaderItem.java |   9 +-
 .../head/JavaScriptUrlReferenceHeaderItem.java     |   9 +-
 .../wicket/markup/head/ResourceAggregator.java     |   6 +-
 .../markup/html/internal/HeaderResponseTest.java   |  93 -----------
 .../wicket/request/cycle/RerenderAjaxPage.java     |   2 +-
 12 files changed, 34 insertions(+), 434 deletions(-)

diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/AbstractJavaScriptReferenceHeaderItem.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/AbstractJavaScriptReferenceHeaderItem.java
index de85ad8..484b44c 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/AbstractJavaScriptReferenceHeaderItem.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/AbstractJavaScriptReferenceHeaderItem.java
@@ -31,18 +31,14 @@ public abstract class AbstractJavaScriptReferenceHeaderItem 
extends JavaScriptHe
        /**
         * Constructor.
         *
-        * @param condition
-        *              The condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
-        *              {@code null} or empty string for no condition.
         * @param defer
         *              a flag indicating whether the execution of a script 
should be deferred (delayed)
         *              until after the page has been loaded.
         * @param charset
         *              the charset to use when reading the script content
         */
-       protected AbstractJavaScriptReferenceHeaderItem(String condition, 
boolean defer, String charset)
+       protected AbstractJavaScriptReferenceHeaderItem(boolean defer, String 
charset)
        {
-               super(condition);
                this.defer = defer;
                this.charset = charset;
        }
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/CssContentHeaderItem.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/CssContentHeaderItem.java
index 97d14bd..93bc53d 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/CssContentHeaderItem.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/CssContentHeaderItem.java
@@ -44,12 +44,9 @@ public class CssContentHeaderItem extends CssHeaderItem
         * @param id
         *            unique id for the &lt;style&gt; element. This can be 
<code>null</code>, however in
         *            that case the ajax header contribution can't detect 
duplicate CSS fragments.
-        * @param condition
-        *            the condition when the css should be applied
         */
-       public CssContentHeaderItem(CharSequence css, String id, String 
condition)
+       public CssContentHeaderItem(CharSequence css, String id)
        {
-               super(condition);
                this.css = css;
                setId(id);
        }
@@ -65,23 +62,10 @@ public class CssContentHeaderItem extends CssHeaderItem
        @Override
        public void render(Response response)
        {
-               boolean hasCondition = Strings.isEmpty(getCondition()) == false;
-               if (hasCondition)
-               {
-                       response.write("<!--[if ");
-                       response.write(getCondition());
-                       response.write("]>");
-               }
-
                AttributeMap attributes = new AttributeMap();
                attributes.putAttribute(CssUtils.ATTR_ID, getId());
                attributes.putAttribute(CssUtils.ATTR_CSP_NONCE, getNonce());
                CssUtils.writeInlineStyle(response, getCss(), attributes);
-
-               if (hasCondition)
-               {
-                       response.write("<![endif]-->\n");
-               }
        }
 
        @Override
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/CssHeaderItem.java 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/CssHeaderItem.java
index 8ac04a3..459a56d 100644
--- a/wicket-core/src/main/java/org/apache/wicket/markup/head/CssHeaderItem.java
+++ b/wicket-core/src/main/java/org/apache/wicket/markup/head/CssHeaderItem.java
@@ -18,14 +18,11 @@ package org.apache.wicket.markup.head;
 
 import java.util.Objects;
 
-import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
 import org.apache.wicket.core.util.string.CssUtils;
 import org.apache.wicket.request.Response;
-import org.apache.wicket.request.cycle.RequestCycle;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.request.resource.ResourceReference;
 import org.apache.wicket.util.lang.Args;
-import org.apache.wicket.util.string.Strings;
 import org.apache.wicket.util.value.AttributeMap;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -42,32 +39,8 @@ public abstract class CssHeaderItem extends 
AbstractCspHeaderItem
 
        private static final Logger logger = 
LoggerFactory.getLogger(CssHeaderItem.class);
 
-       /**
-        * The condition to use for Internet Explorer conditional comments. 
E.g. "IE 7".
-        * {@code null} or empty string for no condition.
-        *
-        * <strong>Warning</strong>: the conditional comments don't work when 
injected dynamically
-        * with JavaScript (i.e. in Ajax response). An alternative solution is 
to use user agent sniffing
-        * at the server side:
-        * <code><pre>
-        * public void renderHead(IHeaderResponse response) {
-        *   WebClientInfo clientInfo = (WebClientInfo) 
getSession().getClientInfo();
-        *   ClientProperties properties = clientInfo.getProperties();
-        *   if (properties.isBrowserInternetExplorer() && 
properties.getBrowserVersionMajor() >= 8) {
-        *     response.renderCSSReference(new 
PackageResourceReference(MyPage.class, "my-conditional.css" ));
-        *   }
-        * }
-        * </pre></code>
-        */
-       private final String condition;
-
        private String markupId;
 
-       protected CssHeaderItem(String condition)
-       {
-               this.condition = condition;
-       }
-
        /**
         * @return an optional markup id for the &lt;link&gt; HTML element that 
will be rendered
         * for this header item
@@ -89,14 +62,6 @@ public abstract class CssHeaderItem extends 
AbstractCspHeaderItem
        }
 
        /**
-        * @return the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
-        */
-       public String getCondition()
-       {
-               return condition;
-       }
-       
-       /**
         * Creates a {@link CssReferenceHeaderItem} for the given reference.
         * 
         * @param reference
@@ -136,39 +101,7 @@ public abstract class CssHeaderItem extends 
AbstractCspHeaderItem
        public static CssReferenceHeaderItem forReference(ResourceReference 
reference,
                PageParameters pageParameters, String media)
        {
-               return forReference(reference, pageParameters, media, null);
-       }
-
-       /**
-        * Creates a {@link CssReferenceHeaderItem} for the given reference.
-        *
-        * <strong>Warning</strong>: the conditional comments don't work when 
injected dynamically
-        * with JavaScript (i.e. in Ajax response). An alternative solution is 
to use user agent sniffing
-        * at the server side:
-        * <code><pre>
-        * public void renderHead(IHeaderResponse response) {
-        *   WebClientInfo clientInfo = (WebClientInfo) 
getSession().getClientInfo();
-        *   ClientProperties properties = clientInfo.getProperties();
-        *   if (properties.isBrowserInternetExplorer() && 
properties.getBrowserVersionMajor() >= 8) {
-        *     response.renderCSSReference(new 
PackageResourceReference(MyPage.class, "my-conditional.css" ));
-        *   }
-        * }
-        * </pre></code>
-        *
-        * @param reference
-        *            a reference to a CSS resource
-        * @param pageParameters
-        *            the parameters for this CSS resource reference
-        * @param media
-        *            the media type for this CSS ("print", "screen", etc.)
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
-        * @return A newly created {@link CssReferenceHeaderItem} for the given 
reference.
-        */
-       public static CssReferenceHeaderItem forReference(ResourceReference 
reference,
-               PageParameters pageParameters, String media, String condition)
-       {
-               return new CssReferenceHeaderItem(reference, pageParameters, 
media, condition);
+               return new CssReferenceHeaderItem(reference, pageParameters, 
media);
        }
 
        /**
@@ -192,16 +125,14 @@ public abstract class CssHeaderItem extends 
AbstractCspHeaderItem
         *            the parameters for this CSS resource reference
         * @param media
         *            the media type for this CSS ("print", "screen", etc.)
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
         * @param rel
         *            the rel attribute content
         * @return A newly created {@link CssReferenceHeaderItem} for the given 
reference.
         */
        public static CssReferenceHeaderItem forReference(ResourceReference 
reference,
-               PageParameters pageParameters, String media, String condition, 
String rel)
+               PageParameters pageParameters, String media, String rel)
        {
-               return new CssReferenceHeaderItem(reference, pageParameters, 
media, condition, rel);
+               return new CssReferenceHeaderItem(reference, pageParameters, 
media, rel);
        }
 
        /**
@@ -216,38 +147,7 @@ public abstract class CssHeaderItem extends 
AbstractCspHeaderItem
         */
        public static CssContentHeaderItem forCSS(CharSequence css, String id)
        {
-               return forCSS(css, id, null);
-       }
-
-
-       /**
-        * Creates a {@link CssContentHeaderItem} for the given content.
-        *
-        * <strong>Warning</strong>: the conditional comments don't work when 
injected dynamically
-        * with JavaScript (i.e. in Ajax response). An alternative solution is 
to use user agent sniffing
-        * at the server side:
-        * <code><pre>
-        * public void renderHead(IHeaderResponse response) {
-        *   WebClientInfo clientInfo = (WebClientInfo) 
getSession().getClientInfo();
-        *   ClientProperties properties = clientInfo.getProperties();
-        *   if (properties.isBrowserInternetExplorer() && 
properties.getBrowserVersionMajor() >= 8) {
-        *     response.renderCSSReference(new 
PackageResourceReference(MyPage.class, "my-conditional.css" ));
-        *   }
-        * }
-        * </pre></code>
-        *
-        * @param css
-        *            css content to be rendered.
-        * @param id
-        *            unique id for the &lt;style&gt; element. This can be 
<code>null</code>, however in
-        *            that case the ajax header contribution can't detect 
duplicate CSS fragments.
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
-        * @return A newly created {@link CssContentHeaderItem} for the given 
content.
-        */
-       public static CssContentHeaderItem forCSS(CharSequence css, String id, 
String condition)
-       {
-               return new CssContentHeaderItem(css, id, condition);
+               return new CssContentHeaderItem(css, id);
        }
        
        /**
@@ -273,36 +173,7 @@ public abstract class CssHeaderItem extends 
AbstractCspHeaderItem
         */
        public static CssUrlReferenceHeaderItem forUrl(String url, String media)
        {
-               return forUrl(url, media, null);
-       }
-
-       /**
-        * Creates a {@link CssUrlReferenceHeaderItem} for the given url.
-        *
-        * <strong>Warning</strong>: the conditional comments don't work when 
injected dynamically
-        * with JavaScript (i.e. in Ajax response). An alternative solution is 
to use user agent sniffing
-        * at the server side:
-        * <code><pre>
-        * public void renderHead(IHeaderResponse response) {
-        *   WebClientInfo clientInfo = (WebClientInfo) 
getSession().getClientInfo();
-        *   ClientProperties properties = clientInfo.getProperties();
-        *   if (properties.isBrowserInternetExplorer() && 
properties.getBrowserVersionMajor() >= 8) {
-        *     response.renderCSSReference(new 
PackageResourceReference(MyPage.class, "my-conditional.css" ));
-        *   }
-        * }
-        * </pre></code>
-        *
-        * @param url
-        *            context-relative url of the CSS resource
-        * @param media
-        *            the media type for this CSS ("print", "screen", etc.)
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
-        * @return A newly created {@link CssUrlReferenceHeaderItem} for the 
given url.
-        */
-       public static CssUrlReferenceHeaderItem forUrl(String url, String 
media, String condition)
-       {
-               return new CssUrlReferenceHeaderItem(url, media, condition);
+               return new CssUrlReferenceHeaderItem(url, media);
        }
 
        /**
@@ -324,38 +195,19 @@ public abstract class CssHeaderItem extends 
AbstractCspHeaderItem
         *            context-relative url of the CSS resource
         * @param media
         *            the media type for this CSS ("print", "screen", etc.)
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
         * @param rel
         *            the rel attribute content
         * @return A newly created {@link CssUrlReferenceHeaderItem} for the 
given url.
         */
-       public static CssUrlReferenceHeaderItem forUrl(String url, String 
media, String condition,
-               String rel)
+       public static CssUrlReferenceHeaderItem forUrl(String url, String 
media, String rel)
        {
-               return new CssUrlReferenceHeaderItem(url, media, condition, 
rel);
+               return new CssUrlReferenceHeaderItem(url, media, rel);
        }
 
-       protected final void internalRenderCSSReference(Response response, 
String url, String media,
-               String condition, String rel)
+       protected final void internalRenderCSSReference(Response response, 
String url, String media, String rel)
        {
                Args.notEmpty(url, "url");
 
-               boolean hasCondition = Strings.isEmpty(condition) == false;
-               if (hasCondition)
-               {
-                       if 
(RequestCycle.get().find(IPartialPageRequestHandler.class).isPresent())
-                       {
-                               // WICKET-4894
-                               logger.warn("IE CSS engine doesn't support 
dynamically injected links in " +
-                                               "conditional comments. See the 
javadoc of IHeaderResponse for alternative solution.");
-                       }
-
-
-                       response.write("<!--[if ");
-                       response.write(condition);
-                       response.write("]>");
-               }
                AttributeMap attributes = new AttributeMap();
                attributes.putAttribute(CssUtils.ATTR_LINK_REL, rel == null ? 
"stylesheet" : rel);
                attributes.putAttribute(CssUtils.ATTR_TYPE, "text/css");
@@ -365,10 +217,6 @@ public abstract class CssHeaderItem extends 
AbstractCspHeaderItem
                attributes.putAttribute(CssUtils.ATTR_CSP_NONCE, getNonce());
                CssUtils.writeLink(response, attributes);
 
-               if (hasCondition)
-               {
-                       response.write("<![endif]-->");
-               }
                response.write("\n");
        }
 
@@ -378,13 +226,12 @@ public abstract class CssHeaderItem extends 
AbstractCspHeaderItem
                if (this == o) return true;
                if (o == null || getClass() != o.getClass()) return false;
                CssHeaderItem that = (CssHeaderItem) o;
-               return Objects.equals(condition, that.condition) &&
-                               Objects.equals(markupId, that.markupId);
+               return Objects.equals(markupId, that.markupId);
        }
 
        @Override
        public int hashCode()
        {
-               return Objects.hash(condition, markupId);
+               return Objects.hash(markupId);
        }
 }
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/CssReferenceHeaderItem.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/CssReferenceHeaderItem.java
index 531c90f..758460d 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/CssReferenceHeaderItem.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/CssReferenceHeaderItem.java
@@ -52,13 +52,10 @@ public class CssReferenceHeaderItem extends CssHeaderItem 
implements IReferenceH
         *            the parameters for this CSS resource reference
         * @param media
         *            the media type for this CSS ("print", "screen", etc.)
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
         */
        public CssReferenceHeaderItem(ResourceReference reference, 
PageParameters pageParameters,
-               String media, String condition)
+               String media)
        {
-               super(condition);
                this.reference = reference;
                this.pageParameters = pageParameters;
                this.media = media;
@@ -74,15 +71,12 @@ public class CssReferenceHeaderItem extends CssHeaderItem 
implements IReferenceH
         *            the parameters for this CSS resource reference
         * @param media
         *            the media type for this CSS ("print", "screen", etc.)
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
         * @param rel
         *            the rel attribute content
         */
        public CssReferenceHeaderItem(ResourceReference reference, 
PageParameters pageParameters,
-               String media, String condition, String rel)
+               String media, String rel)
        {
-               super(condition);
                this.reference = reference;
                this.pageParameters = pageParameters;
                this.media = media;
@@ -140,7 +134,7 @@ public class CssReferenceHeaderItem extends CssHeaderItem 
implements IReferenceH
        @Override
        public void render(Response response)
        {
-               internalRenderCSSReference(response, getUrl(), media, 
getCondition(), getRel());
+               internalRenderCSSReference(response, getUrl(), media, getRel());
        }
 
        @Override
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/CssUrlReferenceHeaderItem.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/CssUrlReferenceHeaderItem.java
index 36dae67..2b8de4b 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/CssUrlReferenceHeaderItem.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/CssUrlReferenceHeaderItem.java
@@ -44,14 +44,11 @@ public class CssUrlReferenceHeaderItem extends CssHeaderItem
         *            context-relative url of the CSS resource
         * @param media
         *            the media type for this CSS ("print", "screen", etc.)
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
         * @param rel
         *            the rel attribute content
         */
-       public CssUrlReferenceHeaderItem(String url, String media, String 
condition, String rel)
+       public CssUrlReferenceHeaderItem(String url, String media, String rel)
        {
-               super(condition);
                this.url = url;
                this.media = media;
                this.rel = rel;
@@ -64,12 +61,9 @@ public class CssUrlReferenceHeaderItem extends CssHeaderItem
         *            context-relative url of the CSS resource
         * @param media
         *            the media type for this CSS ("print", "screen", etc.)
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
         */
-       public CssUrlReferenceHeaderItem(String url, String media, String 
condition)
+       public CssUrlReferenceHeaderItem(String url, String media)
        {
-               super(condition);
                this.url = url;
                this.media = media;
                this.rel = null;
@@ -103,8 +97,7 @@ public class CssUrlReferenceHeaderItem extends CssHeaderItem
        public void render(Response response)
        {
                internalRenderCSSReference(response,
-                       UrlUtils.rewriteToContextRelative(getUrl(), 
RequestCycle.get()), getMedia(),
-                       getCondition(), getRel());
+                       UrlUtils.rewriteToContextRelative(getUrl(), 
RequestCycle.get()), getMedia(), getRel());
        }
 
        @Override
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptContentHeaderItem.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptContentHeaderItem.java
index fccadee..b4f80cb 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptContentHeaderItem.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptContentHeaderItem.java
@@ -42,12 +42,9 @@ public class JavaScriptContentHeaderItem extends 
JavaScriptHeaderItem
         * @param id
         *            unique id for the javascript element. This can be null, 
however in that case the
         *            ajax header contribution can't detect duplicate script 
fragments.
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
         */
-       public JavaScriptContentHeaderItem(CharSequence javaScript, String id, 
String condition)
+       public JavaScriptContentHeaderItem(CharSequence javaScript, String id)
        {
-               super(condition);
                this.javaScript = javaScript;
                setId(id);
        }
@@ -63,23 +60,11 @@ public class JavaScriptContentHeaderItem extends 
JavaScriptHeaderItem
        @Override
        public void render(Response response)
        {
-               boolean hasCondition = Strings.isEmpty(getCondition()) == false;
-               if (hasCondition)
-               {
-                       response.write("<!--[if ");
-                       response.write(getCondition());
-                       response.write("]>");
-               }
                AttributeMap attributes = new AttributeMap();
                attributes.putAttribute(JavaScriptUtils.ATTR_TYPE, 
"text/javascript");
                attributes.putAttribute(JavaScriptUtils.ATTR_ID, getId());
                attributes.putAttribute(JavaScriptUtils.ATTR_CSP_NONCE, 
getNonce());
                JavaScriptUtils.writeInlineScript(response, getJavaScript(), 
attributes);
-
-               if (hasCondition)
-               {
-                       response.write("<![endif]-->\n");
-               }
        }
 
        @Override
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptHeaderItem.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptHeaderItem.java
index e72f834..b7eb42d 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptHeaderItem.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptHeaderItem.java
@@ -23,7 +23,6 @@ import org.apache.wicket.request.Response;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.request.resource.ResourceReference;
 import org.apache.wicket.util.lang.Args;
-import org.apache.wicket.util.string.Strings;
 import org.apache.wicket.util.value.AttributeMap;
 
 /**
@@ -37,22 +36,11 @@ public abstract class JavaScriptHeaderItem extends 
AbstractCspHeaderItem
        private static final long serialVersionUID = 1L;
 
        /**
-        * The condition to use for Internet Explorer conditional comments. 
E.g. "IE 7".
-        * {@code null} or empty string for no condition.
-        */
-       private final String condition;
-
-       /**
         * An optional markup id to set on the rendered &lt;script&gt; HTML 
element for
         * this header item
         */
        private String markupId;
 
-       protected JavaScriptHeaderItem(String condition)
-       {
-               this.condition = condition;
-       }
-
        /**
         * @return unique id for the javascript element.
         */
@@ -74,14 +62,6 @@ public abstract class JavaScriptHeaderItem extends 
AbstractCspHeaderItem
        }
 
        /**
-        * @return the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
-        */
-       public String getCondition()
-       {
-               return condition;
-       }
-
-       /**
         * Creates a {@link JavaScriptReferenceHeaderItem} for the given 
reference.
         * 
         * @param reference
@@ -202,33 +182,7 @@ public abstract class JavaScriptHeaderItem extends 
AbstractCspHeaderItem
        public static JavaScriptReferenceHeaderItem 
forReference(ResourceReference reference,
                PageParameters pageParameters, String id, boolean defer, String 
charset)
        {
-               return new JavaScriptReferenceHeaderItem(reference, 
pageParameters, id, defer, charset, null);
-       }
-
-
-       /**
-        * Creates a {@link JavaScriptReferenceHeaderItem} for the given 
reference.
-        *
-        * @param reference
-        *            resource reference pointing to the javascript resource
-        * @param pageParameters
-        *            the parameters for this Javascript resource reference
-        * @param id
-        *            id that will be used to filter duplicate reference (it's 
still filtered by URL
-        *            too)
-        * @param defer
-        *            specifies that the execution of a script should be 
deferred (delayed) until after
-        *            the page has been loaded.
-        * @param charset
-        *            a non null value specifies the charset attribute of the 
script tag
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
-        * @return A newly created {@link JavaScriptReferenceHeaderItem} for 
the given reference.
-        */
-       public static JavaScriptReferenceHeaderItem 
forReference(ResourceReference reference,
-               PageParameters pageParameters, String id, boolean defer, String 
charset, String condition)
-       {
-               return new JavaScriptReferenceHeaderItem(reference, 
pageParameters, id, defer, charset, condition);
+               return new JavaScriptReferenceHeaderItem(reference, 
pageParameters, id, defer, charset);
        }
 
        /**
@@ -243,24 +197,7 @@ public abstract class JavaScriptHeaderItem extends 
AbstractCspHeaderItem
         */
        public static JavaScriptContentHeaderItem forScript(CharSequence 
javascript, String id)
        {
-               return forScript(javascript, id, null);
-       }
-
-       /**
-        * Creates a {@link JavaScriptContentHeaderItem} for the given content.
-        *
-        * @param javascript
-        *            javascript content to be rendered.
-        * @param id
-        *            unique id for the javascript element. This can be null, 
however in that case the
-        *            ajax header contribution can't detect duplicate script 
fragments.
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
-        * @return A newly created {@link JavaScriptContentHeaderItem} for the 
given content.
-        */
-       public static JavaScriptContentHeaderItem forScript(CharSequence 
javascript, String id, String condition)
-       {
-               return new JavaScriptContentHeaderItem(javascript, id, 
condition);
+               return new JavaScriptContentHeaderItem(javascript, id);
        }
 
        /**
@@ -326,43 +263,14 @@ public abstract class JavaScriptHeaderItem extends 
AbstractCspHeaderItem
        public static JavaScriptUrlReferenceHeaderItem forUrl(String url, 
String id, boolean defer,
                String charset)
        {
-               return forUrl(url, id, defer, charset, null);
-       }
-
-       /**
-        * Creates a {@link JavaScriptUrlReferenceHeaderItem} for the given url.
-        *
-        * @param url
-        *            context-relative url of the the javascript resource
-        * @param id
-        *            id that will be used to filter duplicate reference (it's 
still filtered by URL
-        *            too)
-        * @param defer
-        *            specifies that the execution of a script should be 
deferred (delayed) until after
-        *            the page has been loaded.
-        * @param charset
-        *            a non null value specifies the charset attribute of the 
script tag
-        * @return A newly created {@link JavaScriptUrlReferenceHeaderItem} for 
the given url.
-        */
-       public static JavaScriptUrlReferenceHeaderItem forUrl(String url, 
String id, boolean defer,
-               String charset, String condition)
-       {
-               return new JavaScriptUrlReferenceHeaderItem(url, id, defer, 
charset, condition);
+               return new JavaScriptUrlReferenceHeaderItem(url, id, defer, 
charset);
        }
 
        protected final void internalRenderJavaScriptReference(Response 
response, String url,
-               String id, boolean defer, String charset, String condition, 
boolean async)
+               String id, boolean defer, String charset, boolean async)
        {
                Args.notEmpty(url, "url");
 
-               boolean hasCondition = Strings.isEmpty(condition) == false;
-               if (hasCondition)
-               {
-                       response.write("<!--[if ");
-                       response.write(condition);
-                       response.write("]>");
-               }
-
                AttributeMap attributes = new AttributeMap();
                attributes.putAttribute(JavaScriptUtils.ATTR_TYPE, 
"text/javascript");
                attributes.putAttribute(JavaScriptUtils.ATTR_ID, id);
@@ -373,11 +281,6 @@ public abstract class JavaScriptHeaderItem extends 
AbstractCspHeaderItem
                attributes.putAttribute(JavaScriptUtils.ATTR_SCRIPT_SRC, url);
                attributes.putAttribute(JavaScriptUtils.ATTR_CSP_NONCE, 
getNonce());
                JavaScriptUtils.writeScript(response, attributes);
-
-               if (hasCondition)
-               {
-                       response.write("<![endif]-->\n");
-               }
        }
 
        @Override
@@ -386,13 +289,12 @@ public abstract class JavaScriptHeaderItem extends 
AbstractCspHeaderItem
                if (this == o) return true;
                if (o == null || getClass() != o.getClass()) return false;
                JavaScriptHeaderItem that = (JavaScriptHeaderItem) o;
-               return Objects.equals(condition, that.condition) &&
-                               Objects.equals(markupId, that.markupId);
+               return Objects.equals(markupId, that.markupId);
        }
 
        @Override
        public int hashCode()
        {
-               return Objects.hash(condition, markupId);
+               return Objects.hash(markupId);
        }
 }
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptReferenceHeaderItem.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptReferenceHeaderItem.java
index c5209cc..f46323c 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptReferenceHeaderItem.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptReferenceHeaderItem.java
@@ -57,13 +57,11 @@ public class JavaScriptReferenceHeaderItem extends 
AbstractJavaScriptReferenceHe
         *            the page has been loaded.
         * @param charset
         *            a non null value specifies the charset attribute of the 
script tag
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
         */
        public JavaScriptReferenceHeaderItem(ResourceReference reference,
-               PageParameters pageParameters, String id, boolean defer, String 
charset, String condition)
+               PageParameters pageParameters, String id, boolean defer, String 
charset)
        {
-               super(condition, defer, charset);
+               super(defer, charset);
                this.reference = Args.notNull(reference, "reference");
                this.pageParameters = pageParameters;
                setId(id);
@@ -103,8 +101,7 @@ public class JavaScriptReferenceHeaderItem extends 
AbstractJavaScriptReferenceHe
        @Override
        public void render(Response response)
        {
-               internalRenderJavaScriptReference(response, getUrl(), getId(), 
isDefer(), getCharset(),
-                       getCondition(), isAsync());
+               internalRenderJavaScriptReference(response, getUrl(), getId(), 
isDefer(), getCharset(), isAsync());
        }
 
        @Override
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptUrlReferenceHeaderItem.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptUrlReferenceHeaderItem.java
index 9c7bdbf..cc22f54 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptUrlReferenceHeaderItem.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/JavaScriptUrlReferenceHeaderItem.java
@@ -48,13 +48,10 @@ public class JavaScriptUrlReferenceHeaderItem extends 
AbstractJavaScriptReferenc
         *            the page has been loaded.
         * @param charset
         *            a non null value specifies the charset attribute of the 
script tag
-        * @param condition
-        *            the condition to use for Internet Explorer conditional 
comments. E.g. "IE 7".
         */
-       public JavaScriptUrlReferenceHeaderItem(String url, String id, boolean 
defer, String charset,
-               String condition)
+       public JavaScriptUrlReferenceHeaderItem(String url, String id, boolean 
defer, String charset)
        {
-               super(condition, defer, charset);
+               super(defer, charset);
                this.url = url;
                setId(id);
        }
@@ -72,7 +69,7 @@ public class JavaScriptUrlReferenceHeaderItem extends 
AbstractJavaScriptReferenc
        {
                internalRenderJavaScriptReference(response,
                        UrlUtils.rewriteToContextRelative(getUrl(), 
RequestCycle.get()), getId(), isDefer(),
-                       getCharset(), getCondition(), isAsync());
+                       getCharset(), isAsync());
        }
 
        @Override
diff --git 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/ResourceAggregator.java
 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/ResourceAggregator.java
index 2477ac6..8246fd1 100644
--- 
a/wicket-core/src/main/java/org/apache/wicket/markup/head/ResourceAggregator.java
+++ 
b/wicket-core/src/main/java/org/apache/wicket/markup/head/ResourceAggregator.java
@@ -513,8 +513,7 @@ public class ResourceAggregator extends 
DecoratingHeaderResponse
                                        item.getPageParameters(),
                                        item.getId(),
                                        item.isDefer(),
-                                       item.getCharset(),
-                                       item.getCondition()
+                                       item.getCharset()
                        );
                }
                else
@@ -543,8 +542,7 @@ public class ResourceAggregator extends 
DecoratingHeaderResponse
                {
                        resultBundle = 
CssHeaderItem.forReference(bundleReference,
                                        item.getPageParameters(),
-                                       item.getMedia(),
-                                       item.getCondition());
+                                       item.getMedia());
                }
                else
                {
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/HeaderResponseTest.java
 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/HeaderResponseTest.java
index 3e3649b..bb4a494 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/HeaderResponseTest.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/markup/html/internal/HeaderResponseTest.java
@@ -106,46 +106,6 @@ class HeaderResponseTest
     }
 
     /**
-     * Tests the creation of a proper IE conditional comment
-     */
-    @Test
-    void conditionalRenderCSSReference()
-    {
-        headerResponse.render(CssHeaderItem.forReference(reference, null, 
"screen", "lt IE 8"));
-        String expected = "<!--[if lt IE 8]><link rel=\"stylesheet\" 
type=\"text/css\" href=\"" +
-            RESOURCE_NAME + "\" media=\"screen\" /><![endif]-->\n";
-        String actual = headerResponse.getResponse().toString();
-        assertEquals(expected, actual);
-    }
-
-    /**
-     * Tests the creation of a proper IE conditional comment
-     */
-    @Test
-    void conditionalRenderCSSReferenceWithUrl()
-    {
-        headerResponse.render(CssHeaderItem.forUrl("resource.css", "screen", 
"lt IE 8"));
-        String expected = "<!--[if lt IE 8]><link rel=\"stylesheet\" 
type=\"text/css\" href=\""+RESOURCE_NAME+"\" media=\"screen\" /><![endif]-->\n";
-        String actual = headerResponse.getResponse().toString();
-        assertEquals(expected, actual);
-    }
-
-
-       /**
-        * Tests the creation of a proper IE conditional comment
-        */
-       @Test
-    void conditionalRenderCSSContent()
-       {
-               headerResponse.render(CssHeaderItem.forCSS(".className { 
font-size: 10px}", "id", "lt IE 8"));
-               String expected = "<!--[if lt IE 8]><style type=\"text/css\" 
id=\"id\">\n" +
-                               ".className { font-size: 10px}</style>\n" +
-                               "<![endif]-->\n";
-               String actual = headerResponse.getResponse().toString();
-               assertEquals(expected, actual);
-       }
-
-    /**
      * Tests setting of 'defer' attribute
      * <p>
      * WICKET-3661
@@ -208,57 +168,4 @@ class HeaderResponseTest
         String actual = headerResponse.getResponse().toString();
         assertEquals(expected, actual);
     }
-
-       /**
-        * Tests the creation of a proper IE conditional comment
-        */
-       @Test
-    void conditionalRenderJSReference()
-       {
-               headerResponse.render(
-                               JavaScriptHeaderItem.forReference(reference, 
new PageParameters(), "id", false, null, "lt IE 8"));
-
-               String expected = "<!--[if lt IE 8]><script 
type=\"text/javascript\" id=\"id\" 
src=\""+RESOURCE_NAME+"\"></script>\n<![endif]-->\n";
-
-               String actual = headerResponse.getResponse().toString();
-
-               assertEquals(expected, actual);
-       }
-
-       /**
-        * Tests the creation of a proper IE conditional comment
-        */
-       @Test
-    void conditionalRenderJSReferenceWithUrl()
-       {
-               
headerResponse.render(JavaScriptHeaderItem.forUrl("js-resource.js", "id", true, 
"cp1251", "lt IE 8"));
-
-               String expected = "<!--[if lt IE 8]><script 
type=\"text/javascript\" id=\"id\" defer=\"defer\" charset=\"cp1251\" 
src=\""+RESOURCE_NAME+"\"></script>\n" +
-                               "<![endif]-->\n";
-
-               String actual = headerResponse.getResponse().toString();
-
-               assertEquals(expected, actual);
-       }
-
-
-       /**
-        * Tests the creation of a proper IE conditional comment
-        */
-       @Test
-    void conditionalRenderJSContent()
-       {
-               
headerResponse.render(JavaScriptHeaderItem.forScript("someJSMethod();", "id", 
"lt IE 8"));
-
-               String expected = "<!--[if lt IE 8]><script 
type=\"text/javascript\" id=\"id\">\n" +
-                               "/*<![CDATA[*/\n" +
-                               "someJSMethod();\n" +
-                               "/*]]>*/\n" +
-                               "</script>\n" +
-                               "<![endif]-->\n";
-
-               String actual = headerResponse.getResponse().toString();
-
-               assertEquals(expected, actual);
-       }
 }
diff --git 
a/wicket-core/src/test/java/org/apache/wicket/request/cycle/RerenderAjaxPage.java
 
b/wicket-core/src/test/java/org/apache/wicket/request/cycle/RerenderAjaxPage.java
index 4eb4439..928fc34 100644
--- 
a/wicket-core/src/test/java/org/apache/wicket/request/cycle/RerenderAjaxPage.java
+++ 
b/wicket-core/src/test/java/org/apache/wicket/request/cycle/RerenderAjaxPage.java
@@ -78,6 +78,6 @@ public class RerenderAjaxPage extends WebPage
 
                // and add our own special sauce to the page to emphasize the 
issue. If this CSS is not
                // rendered, the page will show a big red box telling you about 
the failure.
-               response.render(new CssContentHeaderItem(HEAD_TEXT, "mystyle", 
null));
+               response.render(new CssContentHeaderItem(HEAD_TEXT, "mystyle"));
        }
 }

Reply via email to