You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Makundi <ma...@koodaripalvelut.com> on 2010/07/27 17:48:43 UTC

Bug or feature - strange behavior?

Hi!

Is it abug or a feature that if I have the following:

  public void renderHead(IHeaderResponse response) {
      // Tweak 1
      response.renderString(CssUtils.INLINE_OPEN_TAG);
      response.renderString("div.upper-background-canvas { background:
url(/images/template-bg.png) repeat-x rgb(55,115,130); } body {
background: none rgb(68,68,20); } ");
      response.renderString(CssUtils.INLINE_CLOSE_TAG);
      // Tweak 2
      response.renderString(CssUtils.INLINE_OPEN_TAG);
      response.renderString("div.container-panel { width: 98%; }");
      response.renderString(CssUtils.INLINE_CLOSE_TAG);
  }

The result rendered in browser is:
<style type="text/css"><!--
div.upper-background-canvas { background: url(/images/template-bg.png)
repeat-x rgb(55,115,130); } body { background: none rgb(68,68,20); }
--></style>
div.container-panel { width: 98%; }

This seems sensless... it considers the css script open/close tags
duplicate and drops them from the rendering phase. I will do the same
for any javascript line? For example if I had "alert(value);" in
multiple places it would just strip them and I would get bizzearre
results?

Seems a bit over-optimized to me .... what do you think?


**
Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Bug or feature - strange behavior?

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Could someone add some debug output warning for stripped tags that
looks like open close tags  ;]]]

2010/7/27 Martin Grigorov <mg...@apache.org>:
> Accoring to
> org.apache.wicket.markup.html.IHeaderResponse.renderString(CharSequence)
> javadoc:
>
> /**
>  * Renders an arbitrary string to the header. The string is only rendered if
> the same string
>  * hasn't been rendered before.
>
> Each sequence is rendered only once! So you need to pass the whole CSS in
> one pass: open+body+close
>
> On Tue, Jul 27, 2010 at 5:48 PM, Martin Makundi <
> martin.makundi@koodaripalvelut.com> wrote:
>
>> Hi!
>>
>> Is it abug or a feature that if I have the following:
>>
>>  public void renderHead(IHeaderResponse response) {
>>      // Tweak 1
>>      response.renderString(CssUtils.INLINE_OPEN_TAG);
>>      response.renderString("div.upper-background-canvas { background:
>> url(/images/template-bg.png) repeat-x rgb(55,115,130); } body {
>> background: none rgb(68,68,20); } ");
>>      response.renderString(CssUtils.INLINE_CLOSE_TAG);
>>      // Tweak 2
>>      response.renderString(CssUtils.INLINE_OPEN_TAG);
>>      response.renderString("div.container-panel { width: 98%; }");
>>      response.renderString(CssUtils.INLINE_CLOSE_TAG);
>>  }
>>
>> The result rendered in browser is:
>> <style type="text/css"><!--
>> div.upper-background-canvas { background: url(/images/template-bg.png)
>> repeat-x rgb(55,115,130); } body { background: none rgb(68,68,20); }
>> --></style>
>> div.container-panel { width: 98%; }
>>
>> This seems sensless... it considers the css script open/close tags
>> duplicate and drops them from the rendering phase. I will do the same
>> for any javascript line? For example if I had "alert(value);" in
>> multiple places it would just strip them and I would get bizzearre
>> results?
>>
>> Seems a bit over-optimized to me .... what do you think?
>>
>>
>> **
>> Martin
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Bug or feature - strange behavior?

Posted by Martin Grigorov <mg...@apache.org>.
Accoring to
org.apache.wicket.markup.html.IHeaderResponse.renderString(CharSequence)
javadoc:

/**
 * Renders an arbitrary string to the header. The string is only rendered if
the same string
 * hasn't been rendered before.

Each sequence is rendered only once! So you need to pass the whole CSS in
one pass: open+body+close

On Tue, Jul 27, 2010 at 5:48 PM, Martin Makundi <
martin.makundi@koodaripalvelut.com> wrote:

> Hi!
>
> Is it abug or a feature that if I have the following:
>
>  public void renderHead(IHeaderResponse response) {
>      // Tweak 1
>      response.renderString(CssUtils.INLINE_OPEN_TAG);
>      response.renderString("div.upper-background-canvas { background:
> url(/images/template-bg.png) repeat-x rgb(55,115,130); } body {
> background: none rgb(68,68,20); } ");
>      response.renderString(CssUtils.INLINE_CLOSE_TAG);
>      // Tweak 2
>      response.renderString(CssUtils.INLINE_OPEN_TAG);
>      response.renderString("div.container-panel { width: 98%; }");
>      response.renderString(CssUtils.INLINE_CLOSE_TAG);
>  }
>
> The result rendered in browser is:
> <style type="text/css"><!--
> div.upper-background-canvas { background: url(/images/template-bg.png)
> repeat-x rgb(55,115,130); } body { background: none rgb(68,68,20); }
> --></style>
> div.container-panel { width: 98%; }
>
> This seems sensless... it considers the css script open/close tags
> duplicate and drops them from the rendering phase. I will do the same
> for any javascript line? For example if I had "alert(value);" in
> multiple places it would just strip them and I would get bizzearre
> results?
>
> Seems a bit over-optimized to me .... what do you think?
>
>
> **
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Bug or feature - strange behavior?

Posted by Igor Vaynberg <ig...@gmail.com>.
	/**
	 * Renders an arbitrary string to the header. The string is only
rendered if the same string
	 * hasn't been rendered before.
	 * <p>
	 * Note: This method is kind of dangerous as users are able to write
to the output whatever they
	 * like.
	 *
	 * @param string
	 *            string to be rendered to head
	 */
	public void renderString(CharSequence string);

-igor

On Tue, Jul 27, 2010 at 8:48 AM, Martin Makundi
<ma...@koodaripalvelut.com> wrote:
> Hi!
>
> Is it abug or a feature that if I have the following:
>
>  public void renderHead(IHeaderResponse response) {
>      // Tweak 1
>      response.renderString(CssUtils.INLINE_OPEN_TAG);
>      response.renderString("div.upper-background-canvas { background:
> url(/images/template-bg.png) repeat-x rgb(55,115,130); } body {
> background: none rgb(68,68,20); } ");
>      response.renderString(CssUtils.INLINE_CLOSE_TAG);
>      // Tweak 2
>      response.renderString(CssUtils.INLINE_OPEN_TAG);
>      response.renderString("div.container-panel { width: 98%; }");
>      response.renderString(CssUtils.INLINE_CLOSE_TAG);
>  }
>
> The result rendered in browser is:
> <style type="text/css"><!--
> div.upper-background-canvas { background: url(/images/template-bg.png)
> repeat-x rgb(55,115,130); } body { background: none rgb(68,68,20); }
> --></style>
> div.container-panel { width: 98%; }
>
> This seems sensless... it considers the css script open/close tags
> duplicate and drops them from the rendering phase. I will do the same
> for any javascript line? For example if I had "alert(value);" in
> multiple places it would just strip them and I would get bizzearre
> results?
>
> Seems a bit over-optimized to me .... what do you think?
>
>
> **
> Martin
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org