template mode set to HTML5 but output treats as strict

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

template mode set to HTML5 but output treats as strict

jszczepankiewicz
Using thymeleaf 2.0.7 (but probably the same on the newest).

I am using standalone Thymeleaf, I initialize engine with:

.......................................................
resolver = new FileTemplateResolver();
resolver.setTemplateMode("HTML5");
resolver.setPrefix(ConfigurationProvider.getWebTemplatesPath());
resolver.setSuffix(".html");
resolver.setCacheable(true);
resolver.setCacheTTLMs(Long.valueOf(1000 * 60 * 60 * 24)); // 24h
resolver.setCharacterEncoding("utf-8");
resolver.initialize();
templateEngine = new TemplateEngine();
templateEngine.setTemplateResolver(resolver);
templateEngine.setMessageResolver(new CustomMessageResolver());
.......................................................

The problem is that in the rendered output there are attributes not complied with HTML5,
<a shape="rect" ...

I have read the documentation and there is info that it is a result of using XHTML Strict mode.

Currently my site is not w3c valid because of that. How can I get rid of that additional stuff?

Thanks in advance,


Reply | Threaded
Open this post in threaded view
|

Re: template mode set to HTML5 but output treats as strict

Emanuel
Administrator
What does your Thymeleaf template that generates the <a shape="rect"... look like?  Thymeleaf shouldn't add elements/attributes unless you tell it to in your template, so I'm wondering if you're adding that shape="rect" part yourself.
Reply | Threaded
Open this post in threaded view
|

Re: template mode set to HTML5 but output treats as strict

danielfernandez
Administrator
In reply to this post by jszczepankiewicz
Those are required attributes, according to the XHTML specification. They should not appear if you are not using the XHTML DOCTYPE declarations...

Could it be that you are specifying an XHTML DOCTYPE in your template, instead of an HTML5 one? This would make the parser automatically add those attributes even if you are resolving your templates using the HTML5 template mode...

Regards,
Daniel.