+1 if all tests pass Please add a new test case out of the attached quickstart in the ticket so it won't regress in the future.
Thanks Andrea! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Fri, Aug 14, 2015 at 11:13 AM, Andrea Del Bene <[email protected]> wrote: > Hi, > > for the issue in the subject I think we should use an IAutoComponentFactory > for header sections to dequeue it inside > MarkupContainer#dequeueAutoComponents. > This change is quite small and involves just HtmlHeaderSectionHandler (see > the diff at he bottom). I've tested it with Wicket Examples (mostly with > AJAX example) and everything is ok, but I want to know if any of you is > concerned about it. > > Here it is: > > > > diff --git > > a/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/HtmlHeaderSectionHandler.java > > b/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/HtmlHeaderSectionHandler.java > index 0ea0002..5b79f80 100644 > --- > > a/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/HtmlHeaderSectionHandler.java > +++ > > b/wicket-core/src/main/java/org/apache/wicket/markup/parser/filter/HtmlHeaderSectionHandler.java > @@ -18,11 +18,16 @@ > > import java.text.ParseException; > > +import org.apache.wicket.Component; > +import org.apache.wicket.MarkupContainer; > import org.apache.wicket.markup.ComponentTag; > +import org.apache.wicket.markup.ComponentTag.IAutoComponentFactory; > import org.apache.wicket.markup.Markup; > import org.apache.wicket.markup.MarkupElement; > import org.apache.wicket.markup.MarkupException; > import org.apache.wicket.markup.MarkupStream; > +import org.apache.wicket.markup.html.internal.HtmlHeaderContainer; > +import org.apache.wicket.markup.html.internal.HtmlHeaderItemsContainer; > import org.apache.wicket.markup.parser.AbstractMarkupFilter; > import org.apache.wicket.markup.parser.XmlTag.TagType; > import org.apache.wicket.markup.resolver.HtmlHeaderResolver; > @@ -72,6 +77,24 @@ > /** The Markup available so far for the resource */ > private final Markup markup; > > + private static final IAutoComponentFactory HTML_HEADER_FACTORY = new > IAutoComponentFactory() > + { > + @Override > + public Component newComponent(MarkupContainer container, > ComponentTag tag) > + { > + return new HtmlHeaderContainer(tag.getId()); > + } > + }; > + > + private static final IAutoComponentFactory HTML_HEADER_ITEMS_FACTORY = > new IAutoComponentFactory() > + { > + @Override > + public Component newComponent(MarkupContainer container, > ComponentTag tag) > + { > + return new HtmlHeaderItemsContainer(tag.getId()); > + } > + }; > + > /** > * Construct. > * > @@ -164,6 +187,7 @@ > tag.setId(HEADER_ID); > tag.setAutoComponentTag(true); > tag.setModified(true); > + tag.setAutoComponentFactory(HTML_HEADER_ITEMS_FACTORY); > } > > /** > @@ -188,6 +212,7 @@ > tag.setId(HEADER_ID); > tag.setAutoComponentTag(true); > tag.setModified(true); > + tag.setAutoComponentFactory(HTML_HEADER_FACTORY); > } > } > else if (tag.isClose()) > @@ -201,6 +226,7 @@ > headOpenTag.setAutoComponentTag(false); > headOpenTag.setModified(false); > headOpenTag.setFlag(ComponentTag.RENDER_RAW, true); > + headOpenTag.setAutoComponentFactory(null); > } > > foundClosingHead = true; > @@ -217,6 +243,7 @@ > openTag.setId(HEADER_ID); > openTag.setAutoComponentTag(true); > openTag.setModified(true); > + openTag.setAutoComponentFactory(HTML_HEADER_FACTORY); > > final ComponentTag closeTag = new ComponentTag(HEAD, > TagType.CLOSE); > closeTag.setOpenTag(openTag); >
