On Thu, Apr 17, 2014 at 7:59 PM, Sergiu Dumitriu <sergiu(a)xwiki.org> wrote:
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#…
.
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:
We should probably provide a JavaScript 'service' to access this meta
data. This way we can change the way we pass this meta data from the
client to the server without affecting the extensions. This 'service'
could also hide the prefix: XWiki.data.get('space') would look for
data-xwiki-space attribute on the HTML element. Of course, we'd need
to make sure this 'service' is defined before the rest of the scripts
are executed.
Thanks,
Marius
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
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
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs