+1
How about:
require(['xwiki.meta', function(xm) {
console.log(xm['form-token']);
});
?
On 10/02/2014 10:58 AM, Thomas Mortagne wrote:
> +1
>
> On Thu, Oct 2, 2014 at 10:50 AM, Marius Dumitru Florea
> <[email protected]> wrote:
>> +1
>>
>> Thanks,
>> Marius
>>
>> On Wed, Oct 1, 2014 at 4:31 PM, Guillaume "Louis-Marie" Delhumeau
>> <[email protected]> wrote:
>>> 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/22ae6ec5b0ab3125486a0f55ab76cebe329e6da2/xwiki-platform-core/xwiki-platform-flamingo/xwiki-platform-flamingo-skin/src/main/resources/flamingo/htmlheader.vm#L76
>>> (XWiki metadata)
>>>
>>> --
>>> Guillaume Delhumeau ([email protected])
>>> Research & Development Engineer at XWiki SAS
>>> Committer on the XWiki.org project
>>> _______________________________________________
>>> devs mailing list
>>> [email protected]
>>> http://lists.xwiki.org/mailman/listinfo/devs
>> _______________________________________________
>> devs mailing list
>> [email protected]
>> http://lists.xwiki.org/mailman/listinfo/devs
>
>
>
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs