Please review r1044240. Now markup inheritance is supported too. In your first mail you said : "In any case it returns the DOCTYPE of the page only, irrespective of Panel or Border etc." but current logic in MarkupUtil.isMarkupHtml5Compliant() uses a visitor to read their doctype and returns false if any of the inner markup containers is not html5. Maybe this visitor is not needed ?
On Fri, Dec 10, 2010 at 8:09 AM, Juergen Donnerstag < [email protected]> wrote: > I'll check it over the weekend > > Juergen > > On Thu, Dec 9, 2010 at 12:22 PM, Martin Grigorov <[email protected]> > wrote: > > It appeared that this helper doesn't work correctly for page inheritance. > > The base page has <!DOCTYPE html> but the child page has just > > "<wicket:extend> ... </wicket:extend>". > > See > org.apache.wicket.markup.WicketNamespaceTest.XXtestDoctype_InheritedPage(). > > > > On Wed, Dec 8, 2010 at 5:53 PM, Martin Grigorov <[email protected] > >wrote: > > > >> Correction, my bad. > >> > >> The Form's getMarkup() returns just : > >> <form wicket:id="form"> > >> <input wicket:id="number" type="number" min="3.0" max="10.0" > >> onchange="console.log(this.value)"/><br/> > >> <input type="submit" value="Submit"/> > >> </form> > >> > >> so there is no doctype. > >> > >> On Wed, Dec 8, 2010 at 5:48 PM, Martin Grigorov <[email protected] > >wrote: > >> > >>> The NPE happens with #getAssociatedMarkup() and at this point the > >>> MarkupContainer is a Form > >>> Replacing it with #getMarkup() returned the page's markup, i.e. all > html, > >>> and its markupstream had 'null' doctype. > >>> > >>> I'll investigate further but you can also take a look at the > application. > >>> It is in wicketstuff's SVN repo (link below). > >>> > >>> > >>> On Wed, Dec 8, 2010 at 5:41 PM, Juergen Donnerstag < > >>> [email protected]> wrote: > >>> > >>>> Interesting. I thought I had a testcase with exactly that DOCTYPE. In > >>>> any case it returns the DOCTYPE of the page only, irrespective of > >>>> Panel or Border etc. > >>>> getMarkup() returning null means no markup found which would explain > >>>> the NPE as well. You are sure about your source code and markup? > >>>> > >>>> Juergen > >>>> > >>>> > >>>> On Wed, Dec 8, 2010 at 5:27 PM, Martin Grigorov > >>>> <[email protected]> wrote: > >>>> > Hi Juergen, > >>>> > > >>>> > I just tried to use MarkupUtil.isMarkupHtml5Compliant() for the new > >>>> HTML5 > >>>> > input types and it failed with: > >>>> > > >>>> > Caused by: java.lang.NullPointerException > >>>> > at > >>>> > org.apache.wicket.markup.html.MarkupUtil$1.component(MarkupUtil.java:56) > >>>> > at > >>>> > org.apache.wicket.markup.html.MarkupUtil$1.component(MarkupUtil.java:1) > >>>> > at > org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:142) > >>>> > at > org.apache.wicket.util.visit.Visits.visitChildren(Visits.java:118) > >>>> > at > >>>> > org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:919) > >>>> > at > >>>> > > >>>> > org.apache.wicket.markup.html.MarkupUtil.isMarkupHtml5Compliant(MarkupUtil.java:52) > >>>> > at > >>>> > > >>>> > org.wicketstuff.html5.markup.html.form.NumberField.onInitialize(NumberField.java:38) > >>>> > at org.apache.wicket.Component.fireInitialize(Component.java:989) > >>>> > at > >>>> org.apache.wicket.MarkupContainer.initialize(MarkupContainer.java:992) > >>>> > at > >>>> > > >>>> > org.apache.wicket.MarkupContainer.addedComponent(MarkupContainer.java:972) > >>>> > at org.apache.wicket.MarkupContainer.add(MarkupContainer.java:162) > >>>> > at > >>>> > > >>>> > org.wicketstuff.html5.markup.html.form.NumberFieldDemo.<init>(NumberFieldDemo.java:19) > >>>> > > >>>> > > >>>> > So I changed MarkupUtil line 56: > >>>> > MarkupResourceStream rs = > >>>> > comp.getAssociatedMarkup().getMarkupResourceStream(); > >>>> > with > >>>> > MarkupResourceStream rs = > comp.getMarkup().getMarkupResourceStream(); > >>>> > > >>>> > and now there is no NPE but it returns "null" for doctype. > >>>> > > >>>> > The page HTML looks like: > >>>> > > >>>> > http://pastie.org/1359239 > >>>> > > >>>> > The code is at > >>>> > > >>>> > https://wicket-stuff.svn.sourceforge.net/svnroot/wicket-stuff/trunk/wicketstuff-core/jdk-1.6-parent/wicket-html5-parent > >>>> > see NumberFieldDemo in examples and NumberField in impl project. > >>>> > > >>>> > martin-g > >>>> > > >>>> > >>> > >>> > >> > > >
