[PLIP-Advisories] [Plone] #11300: Switch to HTML5
Change notifications for Plone PLIPs on Trac.
plone-plip-advisories at lists.plone.org
Tue Jun 21 11:26:34 UTC 2011
#11300: Switch to HTML5
---------------------------+------------------------------------------------
Reporter: spliter | Owner: spliter
Type: PLIP | Status: assigned
Priority: major | Milestone: 4.2
Component: Templates/CSS | Keywords:
---------------------------+------------------------------------------------
Comment(by spliter):
Replying to [comment:57 robgietema]:
> (In [50595]) Added review for plip 11300. refs #11300
Thanks for the review, Rob. Would like to give some comments and
explanations on it.
Replying to [comment:57 robgietema]:
> The conditional html tag at the end uses "if gt IE 8" better would be
"if (gt IE 8)|!(IE)".
No other browser understands conditional comments except IE, so !(IE) part
doesn't make sense to me. Rob, do you know why that addition would be
useful?
Replying to [comment:57 robgietema]:
> The code changes look good. What I don't understand is why modernizr is
used. The comments in the css suggest that modernizr adds the ie6, ie7 etc
classes to the html document but that is not the case, they are added
using conditional html comments. The PLIP states modernizr is used to
strip out HTML5 specific tags but as far as I can see none are used right
now. Please explain why we need modernizr at this time.
First of all, the task of this PLIP was not to introduce the new HTML5
elements, but to give a kick-start to that process by just switching to
the new doctype and let end-integrators do more if they need.
Modernizr, doesn't add those classes indeed and they are added with the
conditional comments. That's right. Maybe I was not clear in my
explanations of what Modernizr does for IE. Will try again. The issue is
that Internet Explorer, when seeing unknown element, ignores it completely
and does not allow one to apply any styling to such elements. Since new
HTML5 elements are aliens at the moment, they fail under this exact case —
end-integrators wish to go further in HTML5 implementation in their Plone
theme, do add new HTML5 elements. Out of the box, they will not be able to
style those in IE since the browser simply will not be able to understand
what are those. So, for Internet Explorer we do one of the following:
* manually write JS that would add fake instances of all new HTML5
elements and then remove them. In this case, IE will be triggered to
"this-guy-looks-familiar mode" when the new elements are added in the
HTML. It will not give them any structural meaning of course, but at least
end-users will be able to style new HTML5 elements.
* use one of the shims (shivs) available out there that do this
automatically for IE like http://code.google.com/p/html5shim/
Modernizr has such shim built-in. So, Modernizr in this case is used to
convince IE that the new elements are not aliens and it's ok to style
those. More on this — http://www.modernizr.com/docs/#html5inie
Next question is why Modernizr and not some shim-only solution. Modernizr
is *the* feature detection solution these days. It's the only library that
can detect certain features, a browser understands from HTML5/CSS3 and
related technologies (like HTML5 javascript APIs, for example). In order
to build a future-proof (for the browsers of the future) and backwards-
compatible (with less capable browsers) HTML5 solution these days, one has
to rely on feature detection. So, if we switch to HTML5, we need to give
those, who is working with HTML5 sites a more or less solid ground to
build their applications.
If we don't add Modernizr, the whole switch would not make a lot of sense,
since end-integrators will need to add it to their themes anyway if they
care about more than just cutting-edge browsers. In addition, once we
start transition to HTML5 in Plone, we, ourselves, need the basis for
extending this integration to include new elements and new attributes to
Plone itself. Once again, we will have to add Modernizr later in this
case.
But Modernizr has even more http://www.modernizr.com/docs/. The good thing
is that with all it's features it is packed in a quite small file size
(13.4KB).
In my other PLIP #9352 I have already assumed we have Modernizr available
in Plone that let's me fork the code for contemporary and not-so browsers
in [50545] line 62. Well, the fallback for less capable browsers is still
not there but you get the idea, I hope.
--
Ticket URL: <http://dev.plone.org/plone/ticket/11300#comment:58>
Plone <http://plone.org>
Plone Enterprise Content Management System
More information about the PLIP-Advisories
mailing list