Hello.
Some months ago, I created a topic about switching to HTML5 [1]. One of my
concerns was that we currently use custom meta tags to store XWiki
metadata, such as the current space, the current page, etc... [2]. These
meta tags are not allowed anymore in HTML5 so we need to remove them.
In this topic, you suggested some good ideas and I am making this proposal
to recap them.
1/ Remove the invalid meta tags from the HTML, so it will pass our HTML
validation tools.
2/ Put them back, dynamically, with JavaScript, on the client-side, to
ensure retro-compatibility (and before any other script is started),
because some extensions can rely on them. Also, they will be deprecated.
3/ Store the meta-data that we need in the <html> tag, via the data-*
property that HTML5 allows. The prefix "xwiki" should be used to not
collide with other extensions.
For example:
<html data-xwiki-space="the-current-space"
data-xwiki-form-token="the-token" ...>
4/ Create a JS service that looks for this information and return them to
other script. So if you change again the way we store the metadata, it
won't break the extensions. This service should also be loaded before other
scripts, and should be available to all scripts (which use jQuery,
Prototype, or something else).
For example:
XWiki.getMetadata('space') (without the prefix)
XWiki.getMetadata('form-token')
Or it could be:
XWiki.getSpace()
XWiki.getFormToken()
Actually I don't know how will be the implementation details yet, but I
just would like to have your agreement on the principle.
WDYT?
Thanks,
[1]
http://markmail.org/message/4yhdlcxswbqdg3wv ([Proposal] Use HTML5 in
Flamingo)
[2]
https://github.com/xwiki/xwiki-platform/blob/22ae6ec5b0ab3125486a0f55ab76ce…
(XWiki metadata)
--
Guillaume Delhumeau (gdelhumeau(a)xwiki.com)
Research & Development Engineer at XWiki SAS
Committer on the
XWiki.org project