Hi 2014-04-17 18:59 GMT+02:00 Sergiu Dumitriu <[email protected]>:
On 04/15/2014 06:09 AM, Guillaume "Louis-Marie" Delhumeau wrote:
(There is already a JIRA issue about this topic, see http://jira.xwiki.org/browse/XWIKI-7552 ).
The new skin, Flamingo, uses the Bootstrap Framework, which is designed to be used with HTML5. For example, the drop down buttons [1] use the attributes "data-*" that was introduced recently and that are not valid in XHTML 1.0 Strict. Since HTML5 is becoming the new standard, I think it's time to switch to HTML5, at least for Flamingo.
With the help of Thomas, I have already added an HTML5 validator in our build tools, based on validator.nu [2]. In the future, we need to change the enterprise tests suite to use this validator and the flamingo skin.
------------------------- What are the blockers ? -------------------------
----- Meta tags -----
In Colibri headers, we used to define some meta tags used by some javascript components. These tags are: - <meta name="document" content="Main.WebHome"/> - <meta name="wiki" content="xwiki"/> - ... and so on.
In my opinion, they are useless, because we also defines some variables: - XWiki.currentWiki = "xwiki"; - XWiki.currentSpace = "Main"; - XWiki.currentPage = "WebHome"; - ... and so on.
The JavaScript ones are actually the deprecated ones, not the other way around...
The problem is: these tags are not valid in HTML5 because the specification mentions that custom meta names should be registered on http://wiki.whatwg.org/wiki/MetaExtensions. See
http://www.whatwg.org/specs/web-apps/current-work/multipage/semantics.html#o...
.
Other problem: if we simply remove them, we will break some javascript codes.
----- Internet Explorer meta tag -----
Bootstrap defines the following meta-tag: <meta http-equiv="X-UA-Compatible" content="IE=edge">
It is used to prevent Internet Explorer from using the compatibility mode (which is the default setting on intranet sites). As before, this meta tag is not valid. It is interresting to notice that even the bootstrap site is not valid, because of that.
In my opinion, we need this meta-tag and we should ignore this HTML5 violation.
----- Use HTML5 or XHTML5? -----
XHTML5 is only a subset of HTML5 so that it is XML compliant. If we want to use it, we need to change the MIME type of our pages to "application/xhtml+xml" or "application/xml" [3]. But then, the browser is not error-tolerant anymore (I have only tested with Firefox and I hit the issue).
----- Update HTMLCleaner -----
HTML Cleaner generates this code: <img src="..."></img> which is not valid.
------------------------ Proposal ------------------------
1. Break the javascript compatibility and remove invalid <meta> tags, except the Internet Explorer specific one.
We still need a way to allow custom metadata to be entered (including by extensions), and the JS block is not a good practice. HTML5 allows any number of custom data-* attributes to be used for this purpose, so my proposal is to use them instead. Where? The <html> tag is a good candidate since it is guaranteed to be in the DOM before any script begins execution, so scripts don't have to wait for a dom:loaded event in order to be able to access them:
<html data-wiki="dev" data-space="DevGuide" data-page="WebHome"...>
Accessing them:
var space = document.documentElement.dataset.space;
If we agree on this approach, we should: - add Marius' compatibility script which adds meta elements - agree on a naming conversion (do we want a prefix, as in data-xwiki-space, to prevent collisions with other frameworks that might add their own data attributes?) - add a DataExtension plugin/service, similar to the other skin extension plugins, which would allow appications to add their own metadata
Good. I like this idea. But we need to indicate clearly what is deprecated and what is not, because at the end, we will have 3 different ways to have the same informations (ie: the current page, space, etc...).
2. Update the HTML Cleaner. 3. Use HTML5 to avoid the XML specific problems. We can change this in the future. 4. Do not touch the XWiki Rendering code because it generates XHTML, which is still valid in HTML5 [4]. Same for the WYSIWYG editor. 5. Update the enterprise test suite to also tests pages with the flamingo and the new HTML5 validator.
WDYT?
Louis-Marie
---------------------- Links ---------------------- [1] http://getbootstrap.com/components/#btn-dropdowns [2] http://jira.xwiki.org/browse/XWIKI-10249 [3] http://en.wikipedia.org/wiki/HTML5#XHTML5_.28XML-serialized_HTML5.29 [4] http://en.wikipedia.org/wiki/Polyglot_markup
-- Sergiu Dumitriu http://purl.org/net/sergiu _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs