solomax commented on a change in pull request #376: WICKET-6682 add CSP nonce 
support: initial commit
URL: https://github.com/apache/wicket/pull/376#discussion_r302989065
 
 

 ##########
 File path: 
wicket-core/src/main/java/org/apache/wicket/core/util/string/CssUtils.java
 ##########
 @@ -60,17 +64,45 @@ public static void writeCss(final Response response, final 
CharSequence text, St
                writeCloseTag(response);
        }
 
+       /**
+        * Write the simple text to the response object surrounded by a style 
tag.
+        *
+        * @param response
+        *            The HTTP: response
+        * @param text
+        *            The text to added in between the style tags
+        * @param attributes
+        *            Extra style attributes
+        */
+       public static void writeCss(final Response response, final CharSequence 
text, IValueMap attributes)
+       {
+               writeOpenTag(response, attributes);
+               response.write(text);
+               writeCloseTag(response);
+       }
+
        /**
         *
         * @param response
         * @param id
         */
        public static void writeOpenTag(final Response response, String id)
+       {
+               HeaderItemAttributeMap attributes = new 
HeaderItemAttributeMap();
+               attributes.add(HeaderItemAttribute.ID, id);
+               writeOpenTag(response, attributes);
+       }
+
+       /**
+        *
+        * @param response
+        * @param attributes
+        */
+       public static void writeOpenTag(final Response response, IValueMap 
attributes)
        {
                response.write(INLINE_OPEN_TAG_START);
-               if (id != null)
-               {
-                       response.write(" id=\"" + id + "\"");
+               if (attributes != null) {
+                       response.write(" "+attributes.toString());
 
 Review comment:
   `toString()` call is redundant here, missing white-spaces

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to