You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Peter Henderson <pe...@starjar.com> on 2016/07/07 10:24:09 UTC

Style Sheet in page head

Hello,


I might have found a small bug.

I have a control which has a style sheet link in its head section.
This control is used within a ListView but is initially hidden.
An ajax action causes the control to become visible.

The style sheet link added to the page head looks malformed.

<head>
  <link type="null" href="status.css" rel="stylesheet" id="null">
</head>

Full page reload corrects the header link.

<head>
  <link href="status.css" rel="stylesheet">
</head>

Am I doing something wrong or is this a bug?


I've created a quick start which is available
https://github.com/bollinger/wicket-style-bug


Thanks

-- 
Peter Henderson

Director
Starjar Ltd.
www.starjar.com
0330 088 1662

Re: Style Sheet in page head

Posted by Martin Grigorov <mg...@apache.org>.
Fixed with https://issues.apache.org/jira/browse/WICKET-6204
Thank you for the report, investigation and the pull request!

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Thu, Jul 7, 2016 at 4:12 PM, Peter Henderson <peter.henderson@starjar.com
> wrote:

> On Thu, Jul 7, 2016 at 2:02 PM, Francois Meillet <
> francois.meillet@gmail.com
> > wrote:
>
> > If you look at what is sent by Wicket   (open the Wicket Ajax Debug panel
> > or use a debugging proxy like Charles Proxy),
> > you will see
> >
> >
> > <ajax-response>
> >         <component id="tableWMC2">
> >                 <![CDATA[<tbody wicket:id="tableWMC" id="tableWMC2">
> >                 <tr wicket:id="row">
> >                 <td wicket:id="name">apple</td>
> >                 <td>
> >                 <wicket:container wicket:id="status"><wicket:panel>
> >                 <span wicket:id="label" class="status RED">STATUS
> > HERE</span>
> >                 </wicket:panel></wicket:container>
> >                 </td>
> >                 </tr><tr wicket:id="row">
> >                 <td wicket:id="name">orange</td>
> >                 <td>
> >                 <wicket:container wicket:id="status"><wicket:panel>
> >                 <span wicket:id="label" class="status RED">STATUS
> > HERE</span>
> >                 </wicket:panel></wicket:container>
> >                 </td>
> >                 </tr><tr wicket:id="row">
> >                 <td wicket:id="name">grape</td>
> >                 <td>
> >                 <wicket:container wicket:id="status"><wicket:panel>
> >                 <span wicket:id="label" class="status RED">STATUS
> > HERE</span>
> >                 </wicket:panel></wicket:container>
> >                 </td>
> >                 </tr>
> >                 </tbody>]]>
> >         </component>
> >         <header-contribution>
> >                 <![CDATA[<head xmlns:wicket="http://wicket.apache.org">
> >                 <link href="status.css" rel="stylesheet"/>
> >                 </head>]]>
> >         </header-contribution>
> > </ajax-response>
> >
> >
> > The id and type with null value are just extrapolated and added by tools
> > (firebugs and so on), but are not in the html page.
> >
>
> Beautiful.
>
> The wicket server side code creates the correct response. The problem lies
> in
> wicket-ajax-jquery.js line 2121
>
> // copy required attributes
> css.id = node.getAttribute("id");
> css.rel = node.getAttribute("rel");
> css.href = node.getAttribute("href");
> css.type = node.getAttribute("type");
>
> // add element to head
> Wicket.Head.addElement(css);
>
> This code assumes the header item has attributes "id" and "type" and
> blindly adds them to the new DOM.
>
> Thanks François
>
>
>
>
>
>
>
> > François
> >
> >
> >
> > > Le 7 juil. 2016 à 13:12, Peter Henderson <pe...@starjar.com>
> > a écrit :
> > >
> > > Thanks François
> > >
> > >
> > >
> > > On Thu, Jul 7, 2016 at 11:51 AM, Francois Meillet <
> > > francois.meillet@gmail.com <ma...@gmail.com>> wrote:
> > >
> > >> You don't define id and type so there are null.
> > >>
> > >> just add id="yourid" type="text/css"
> > >>
> > >> <wicket:head>
> > >>  <link href="status.css" rel="stylesheet" id="yourid"
> type="text/css"/>
> > >> </wicket:head>
> > >>
> > >>
> > > Although MDN shows examples without an id or type [1].
> > > The examples shown by the  html5 standards [2] page also don't have
> type
> > > and id for style sheets.
> > >
> > >
> > >
> > > [1]
> > https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#Examples
> <
> > https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#Examples>
> > > [2]https://www.w3.org/TR/html5/document-metadata.html#the-link-element
> <
> > https://www.w3.org/TR/html5/document-metadata.html#the-link-element>
> > >
> > >
> > >
> > >
> > >> François
> > >>
> > >>
> > >>
> > >>> Le 7 juil. 2016 à 12:24, Peter Henderson <
> peter.henderson@starjar.com>
> > >> a écrit :
> > >>>
> > >>> Hello,
> > >>>
> > >>>
> > >>> I might have found a small bug.
> > >>>
> > >>> I have a control which has a style sheet link in its head section.
> > >>> This control is used within a ListView but is initially hidden.
> > >>> An ajax action causes the control to become visible.
> > >>>
> > >>> The style sheet link added to the page head looks malformed.
> > >>>
> > >>> <head>
> > >>> <link type="null" href="status.css" rel="stylesheet" id="null">
> > >>> </head>
> > >>>
> > >>> Full page reload corrects the header link.
> > >>>
> > >>> <head>
> > >>> <link href="status.css" rel="stylesheet">
> > >>> </head>
> > >>>
> > >>> Am I doing something wrong or is this a bug?
> > >>>
> > >>>
> > >>> I've created a quick start which is available
> > >>> https://github.com/bollinger/wicket-style-bug
> > >>>
> > >>>
> > >>> Thanks
> > >>>
> > >>> --
> > >>> Peter Henderson
> > >>>
> > >>> Director
> > >>> Starjar Ltd.
> > >>> www.starjar.com
> > >>> 0330 088 1662
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org <mailto:
> > users-unsubscribe@wicket.apache.org>
> > >> For additional commands, e-mail: users-help@wicket.apache.org
> <mailto:
> > users-help@wicket.apache.org>
> > >>
> > >>
> > >
> > >
> > > --
> > > Peter Henderson
> > >
> > > Director
> > > Starjar Ltd.
> > > www.starjar.com <http://www.starjar.com/>
> > > 0330 088 1662
> >
> >
>
>
> --
> Peter Henderson
>
> Director
> Starjar Ltd.
> www.starjar.com
> 0330 088 1662
>

Re: Style Sheet in page head

Posted by Peter Henderson <pe...@starjar.com>.
On Thu, Jul 7, 2016 at 2:02 PM, Francois Meillet <francois.meillet@gmail.com
> wrote:

> If you look at what is sent by Wicket   (open the Wicket Ajax Debug panel
> or use a debugging proxy like Charles Proxy),
> you will see
>
>
> <ajax-response>
>         <component id="tableWMC2">
>                 <![CDATA[<tbody wicket:id="tableWMC" id="tableWMC2">
>                 <tr wicket:id="row">
>                 <td wicket:id="name">apple</td>
>                 <td>
>                 <wicket:container wicket:id="status"><wicket:panel>
>                 <span wicket:id="label" class="status RED">STATUS
> HERE</span>
>                 </wicket:panel></wicket:container>
>                 </td>
>                 </tr><tr wicket:id="row">
>                 <td wicket:id="name">orange</td>
>                 <td>
>                 <wicket:container wicket:id="status"><wicket:panel>
>                 <span wicket:id="label" class="status RED">STATUS
> HERE</span>
>                 </wicket:panel></wicket:container>
>                 </td>
>                 </tr><tr wicket:id="row">
>                 <td wicket:id="name">grape</td>
>                 <td>
>                 <wicket:container wicket:id="status"><wicket:panel>
>                 <span wicket:id="label" class="status RED">STATUS
> HERE</span>
>                 </wicket:panel></wicket:container>
>                 </td>
>                 </tr>
>                 </tbody>]]>
>         </component>
>         <header-contribution>
>                 <![CDATA[<head xmlns:wicket="http://wicket.apache.org">
>                 <link href="status.css" rel="stylesheet"/>
>                 </head>]]>
>         </header-contribution>
> </ajax-response>
>
>
> The id and type with null value are just extrapolated and added by tools
> (firebugs and so on), but are not in the html page.
>

Beautiful.

The wicket server side code creates the correct response. The problem lies
in
wicket-ajax-jquery.js line 2121

// copy required attributes
css.id = node.getAttribute("id");
css.rel = node.getAttribute("rel");
css.href = node.getAttribute("href");
css.type = node.getAttribute("type");

// add element to head
Wicket.Head.addElement(css);

This code assumes the header item has attributes "id" and "type" and
blindly adds them to the new DOM.

Thanks François







> François
>
>
>
> > Le 7 juil. 2016 à 13:12, Peter Henderson <pe...@starjar.com>
> a écrit :
> >
> > Thanks François
> >
> >
> >
> > On Thu, Jul 7, 2016 at 11:51 AM, Francois Meillet <
> > francois.meillet@gmail.com <ma...@gmail.com>> wrote:
> >
> >> You don't define id and type so there are null.
> >>
> >> just add id="yourid" type="text/css"
> >>
> >> <wicket:head>
> >>  <link href="status.css" rel="stylesheet" id="yourid" type="text/css"/>
> >> </wicket:head>
> >>
> >>
> > Although MDN shows examples without an id or type [1].
> > The examples shown by the  html5 standards [2] page also don't have type
> > and id for style sheets.
> >
> >
> >
> > [1]
> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#Examples <
> https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#Examples>
> > [2]https://www.w3.org/TR/html5/document-metadata.html#the-link-element <
> https://www.w3.org/TR/html5/document-metadata.html#the-link-element>
> >
> >
> >
> >
> >> François
> >>
> >>
> >>
> >>> Le 7 juil. 2016 à 12:24, Peter Henderson <pe...@starjar.com>
> >> a écrit :
> >>>
> >>> Hello,
> >>>
> >>>
> >>> I might have found a small bug.
> >>>
> >>> I have a control which has a style sheet link in its head section.
> >>> This control is used within a ListView but is initially hidden.
> >>> An ajax action causes the control to become visible.
> >>>
> >>> The style sheet link added to the page head looks malformed.
> >>>
> >>> <head>
> >>> <link type="null" href="status.css" rel="stylesheet" id="null">
> >>> </head>
> >>>
> >>> Full page reload corrects the header link.
> >>>
> >>> <head>
> >>> <link href="status.css" rel="stylesheet">
> >>> </head>
> >>>
> >>> Am I doing something wrong or is this a bug?
> >>>
> >>>
> >>> I've created a quick start which is available
> >>> https://github.com/bollinger/wicket-style-bug
> >>>
> >>>
> >>> Thanks
> >>>
> >>> --
> >>> Peter Henderson
> >>>
> >>> Director
> >>> Starjar Ltd.
> >>> www.starjar.com
> >>> 0330 088 1662
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org <mailto:
> users-unsubscribe@wicket.apache.org>
> >> For additional commands, e-mail: users-help@wicket.apache.org <mailto:
> users-help@wicket.apache.org>
> >>
> >>
> >
> >
> > --
> > Peter Henderson
> >
> > Director
> > Starjar Ltd.
> > www.starjar.com <http://www.starjar.com/>
> > 0330 088 1662
>
>


-- 
Peter Henderson

Director
Starjar Ltd.
www.starjar.com
0330 088 1662

Re: Style Sheet in page head

Posted by Francois Meillet <fr...@gmail.com>.
If you look at what is sent by Wicket   (open the Wicket Ajax Debug panel or use a debugging proxy like Charles Proxy),
you will see 


<ajax-response>
	<component id="tableWMC2">
		<![CDATA[<tbody wicket:id="tableWMC" id="tableWMC2">
		<tr wicket:id="row">
		<td wicket:id="name">apple</td>
		<td>
		<wicket:container wicket:id="status"><wicket:panel>
		<span wicket:id="label" class="status RED">STATUS HERE</span>
		</wicket:panel></wicket:container>
		</td>
		</tr><tr wicket:id="row">
		<td wicket:id="name">orange</td>
		<td>
		<wicket:container wicket:id="status"><wicket:panel>
		<span wicket:id="label" class="status RED">STATUS HERE</span>
		</wicket:panel></wicket:container>
		</td>
		</tr><tr wicket:id="row">
		<td wicket:id="name">grape</td>
		<td>
		<wicket:container wicket:id="status"><wicket:panel>
		<span wicket:id="label" class="status RED">STATUS HERE</span>
		</wicket:panel></wicket:container>
		</td>
		</tr>
		</tbody>]]>
	</component>
	<header-contribution>
		<![CDATA[<head xmlns:wicket="http://wicket.apache.org">
		<link href="status.css" rel="stylesheet"/>
		</head>]]>
	</header-contribution>
</ajax-response>


The id and type with null value are just extrapolated and added by tools (firebugs and so on), but are not in the html page.

François



> Le 7 juil. 2016 à 13:12, Peter Henderson <pe...@starjar.com> a écrit :
> 
> Thanks François
> 
> 
> 
> On Thu, Jul 7, 2016 at 11:51 AM, Francois Meillet <
> francois.meillet@gmail.com <ma...@gmail.com>> wrote:
> 
>> You don't define id and type so there are null.
>> 
>> just add id="yourid" type="text/css"
>> 
>> <wicket:head>
>>  <link href="status.css" rel="stylesheet" id="yourid" type="text/css"/>
>> </wicket:head>
>> 
>> 
> Although MDN shows examples without an id or type [1].
> The examples shown by the  html5 standards [2] page also don't have type
> and id for style sheets.
> 
> 
> 
> [1]https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#Examples <https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#Examples>
> [2]https://www.w3.org/TR/html5/document-metadata.html#the-link-element <https://www.w3.org/TR/html5/document-metadata.html#the-link-element>
> 
> 
> 
> 
>> François
>> 
>> 
>> 
>>> Le 7 juil. 2016 à 12:24, Peter Henderson <pe...@starjar.com>
>> a écrit :
>>> 
>>> Hello,
>>> 
>>> 
>>> I might have found a small bug.
>>> 
>>> I have a control which has a style sheet link in its head section.
>>> This control is used within a ListView but is initially hidden.
>>> An ajax action causes the control to become visible.
>>> 
>>> The style sheet link added to the page head looks malformed.
>>> 
>>> <head>
>>> <link type="null" href="status.css" rel="stylesheet" id="null">
>>> </head>
>>> 
>>> Full page reload corrects the header link.
>>> 
>>> <head>
>>> <link href="status.css" rel="stylesheet">
>>> </head>
>>> 
>>> Am I doing something wrong or is this a bug?
>>> 
>>> 
>>> I've created a quick start which is available
>>> https://github.com/bollinger/wicket-style-bug
>>> 
>>> 
>>> Thanks
>>> 
>>> --
>>> Peter Henderson
>>> 
>>> Director
>>> Starjar Ltd.
>>> www.starjar.com
>>> 0330 088 1662
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org <ma...@wicket.apache.org>
>> For additional commands, e-mail: users-help@wicket.apache.org <ma...@wicket.apache.org>
>> 
>> 
> 
> 
> -- 
> Peter Henderson
> 
> Director
> Starjar Ltd.
> www.starjar.com <http://www.starjar.com/>
> 0330 088 1662


Re: Style Sheet in page head

Posted by Peter Henderson <pe...@starjar.com>.
Thanks François



On Thu, Jul 7, 2016 at 11:51 AM, Francois Meillet <
francois.meillet@gmail.com> wrote:

> You don't define id and type so there are null.
>
> just add id="yourid" type="text/css"
>
> <wicket:head>
>   <link href="status.css" rel="stylesheet" id="yourid" type="text/css"/>
> </wicket:head>
>
>
Although MDN shows examples without an id or type [1].
The examples shown by the  html5 standards [2] page also don't have type
and id for style sheets.



[1]https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#Examples
[2]https://www.w3.org/TR/html5/document-metadata.html#the-link-element




> François
>
>
>
> > Le 7 juil. 2016 à 12:24, Peter Henderson <pe...@starjar.com>
> a écrit :
> >
> > Hello,
> >
> >
> > I might have found a small bug.
> >
> > I have a control which has a style sheet link in its head section.
> > This control is used within a ListView but is initially hidden.
> > An ajax action causes the control to become visible.
> >
> > The style sheet link added to the page head looks malformed.
> >
> > <head>
> >  <link type="null" href="status.css" rel="stylesheet" id="null">
> > </head>
> >
> > Full page reload corrects the header link.
> >
> > <head>
> >  <link href="status.css" rel="stylesheet">
> > </head>
> >
> > Am I doing something wrong or is this a bug?
> >
> >
> > I've created a quick start which is available
> > https://github.com/bollinger/wicket-style-bug
> >
> >
> > Thanks
> >
> > --
> > Peter Henderson
> >
> > Director
> > Starjar Ltd.
> > www.starjar.com
> > 0330 088 1662
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>


-- 
Peter Henderson

Director
Starjar Ltd.
www.starjar.com
0330 088 1662

Re: Style Sheet in page head

Posted by Francois Meillet <fr...@gmail.com>.
You don't define id and type so there are null.

just add id="yourid" type="text/css"

<wicket:head>
  <link href="status.css" rel="stylesheet" id="yourid" type="text/css"/>
</wicket:head>

François



> Le 7 juil. 2016 à 12:24, Peter Henderson <pe...@starjar.com> a écrit :
> 
> Hello,
> 
> 
> I might have found a small bug.
> 
> I have a control which has a style sheet link in its head section.
> This control is used within a ListView but is initially hidden.
> An ajax action causes the control to become visible.
> 
> The style sheet link added to the page head looks malformed.
> 
> <head>
>  <link type="null" href="status.css" rel="stylesheet" id="null">
> </head>
> 
> Full page reload corrects the header link.
> 
> <head>
>  <link href="status.css" rel="stylesheet">
> </head>
> 
> Am I doing something wrong or is this a bug?
> 
> 
> I've created a quick start which is available
> https://github.com/bollinger/wicket-style-bug
> 
> 
> Thanks
> 
> -- 
> Peter Henderson
> 
> Director
> Starjar Ltd.
> www.starjar.com
> 0330 088 1662


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