Skip to content
This repository has been archived by the owner on Nov 26, 2017. It is now read-only.

Add some simple HTML5 support to JDocument. #699

Merged
merged 1 commit into from Feb 20, 2012

Conversation

realityking
Copy link
Contributor

Another split off #683.

After a discussion with Christophe I think this is to tightly couple to the CMS. This will do, we can do the template magic in JApplicationSite.

@joomla-jenkins
Copy link

Unit testing complete. There were 0 failures and 0 errors from 1971 tests and 11145 assertions.
Checkstyle analysis reported 199 warnings and 1 errors.

@@ -60,8 +60,14 @@ public function fetchHead(&$document)
$tab = $document->_getTab();
$tagEnd = ' />';
$buffer = '';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whitespace ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Thanks.

@piotr-cz
Copy link
Contributor

piotr-cz commented Jan 3, 2012

great!
what do you think about more html5 stuff like simplified < script > and < link > tags?
That doesn't add much in terms of functionality but html is more readable & elegant :)

@realityking
Copy link
Contributor Author

@piotr-cz
What do you mean be simplify script elements? I don't think they can be simplified with HTML5.
For the link element you probably mean to take off the "/". I'm kinda against this because someone may wanna use the platform (or even the CMS) to output XHTML5 - and it doesn't really hurt either.

@joomla-jenkins
Copy link

Build triggered by changes to the head.

Unit testing complete. There were 0 failures and 0 errors from 1971 tests and 11145 assertions.
Checkstyle analysis reported 199 warnings and 0 errors.

@bigbangireland
Copy link

@realityking I think @piotr-cz means that the type attribute is unnecessary for style, script and links when they are default values in HTML5.

<style type="text/css">
to
<style>

<script type="text/javascript">
to
<script>

<link rel="stylesheet" href="css/style.css" type="text/css" />
to
<link rel="stylesheet" href="css/style.css">

<script src="js/scripts.js" type="text/javascript"></script>
to
<script src="js/scripts.js""></script>

@chdemko
Copy link
Contributor

chdemko commented Jan 3, 2012

I think it will be for P!12.x (need to release P!11.4 for now)

@realityking
Copy link
Contributor Author

Sure. We can back port it to the CMS if we want to later on.

@piotr-cz
Copy link
Contributor

piotr-cz commented Jan 4, 2012

yes, I've had in mind exactly what bigbangireland gave example of, now since we have html5 switch (is it going to be set in plugin/ configuration.php/ somewhere else?).
I'd also love to use some of the html5 forms functionality in JForm (I found the placeholder attribute extremely handy) but this would require proper discussion and probably it doesn't hurt to implement it later this year when more users move to html5 compatible browsers (ref: http://www.html5rocks.com/en/tutorials/forms/html5forms/). Anyway this isn't part of this pull request

@bigbangireland
Copy link

A detailed discussion on HTML5 is needed well before Joomla! 3.0.

As @piotr-cz says JForm can not currently handle many new attributes. eg. "pattern" could be useful when used with a JS class.

Greater thought is also needed in regards to microdata and handling tags (aside, section, nav, etc) on modules.

@piotr-cz
Copy link
Contributor

piotr-cz commented Jan 4, 2012

Question: from where to switch the $html5 variable? For me it would make most sense to use JConfig, as it's now in the platform.

bigbangireland > I've been thinking about exactly this for a while, I guess we could start a discussion on Platform group to share implementation experiences and thoughts (Sorry to write it here, but it's not possible to message you on GitHub).

@bigbangireland
Copy link

@piotr-cz there was a discussion on the ideas forum a few months back. goo.gl/g1md6

Something like this:
templates/TEMPLATE_NAME/templateDetails.xml

    <html5>true</html5> or <doctype>html5</doctype>

I've temporarily added my email address to my public profile.

@realityking
Copy link
Contributor Author

I don't really wanna go into a lengthy discussion about the CMS stuff here so just a couple of points:

The way I see it the isHTML5() check is mainly for platform related stuff, including JForm. However we have to be careful that everything keeps working when isHTML5 returns false. So I'd like to take us the conservative approach. One things that we could due for starters is output the required attribute when isHTML5() returns true.

I really don't see this used for components or modules. I think template overrides are way better here. Of course nothing stops an extension dev from using it in this way.

If this gets committed I'll submit code for JApplicationSite and JApplicationAdmin that lets you set the value trough a parameter of the template. I originally had that code right in JDocument but it couples the platform to tightly to the CMS. The global configuration (JConfig) is a really poor place for it since you may have both HTML5 and XHTML templates (e.g. one admin one site or two different site templates)

@piotr-cz
Copy link
Contributor

piotr-cz commented Jan 4, 2012

realityking > Thanks this explanation, I get it now. You are correct about not using JConfig.

@fevangelou
Copy link

We (JoomlaWorks) run a quick check on core code to see how it could be possible for Joomla! to read a template param (e.g. html5) and decide whether it should convert its output. I'm afraid this is not possible as it seems components may have already executed and therefore we cannot have full control of the output.

It's a lot easier to do this with a system plugin and it's what we're going for. Check the source code of this page to see the plugin in action: http://dev.joomlaworks.net/

The code is actually pretty small and conforms to this: http://dev.w3.org/html5/html4-differences/

* @var boolean
* @since 11.1
*/
private $_html5 = null;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understood right, even private member vars should go without a leading underscore. see this comment. I think they are ugly ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either way works for me, it should just be written down some place so we eventually get a consistent code style. (The good thing about private variables is however that we can rename them at will)

@joomla-jenkins
Copy link

Build triggered by changes to the head.

Unit testing complete. There were 0 failures and 0 errors from 1971 tests and 11146 assertions.
Checkstyle analysis reported 199 warnings and 0 errors.

@joomla-jenkins
Copy link

Build triggered by changes to the head.

Unit testing complete. There were 0 failures and 0 errors from 1941 tests and 11081 assertions.
Checkstyle analysis reported 165 warnings and 0 errors.

@joomla-jenkins
Copy link

Build triggered by changes to the head.

Unit testing complete. There were 0 failures and 0 errors from 1905 tests and 11045 assertions.
Checkstyle analysis reported 165 warnings and 0 errors.

@joomla-jenkins
Copy link

Build triggered by changes to the head.

Unit testing complete. There were 0 failures and 0 errors from 1991 tests and 11149 assertions.
Checkstyle analysis reported 165 warnings and 0 errors.

@joomla-jenkins
Copy link

Build triggered by changes to the head.

Unit testing complete. There were 0 failures and 0 errors from 1991 tests and 11151 assertions.
Checkstyle analysis reported 165 warnings and 0 errors.

@joomla-jenkins
Copy link

Build triggered by changes to the head.

Unit testing complete. There were 0 failures and 0 errors from 1994 tests and 11169 assertions.
Checkstyle analysis reported 165 warnings and 0 errors.

@realityking
Copy link
Contributor Author

Any news on this?

@joomla-jenkins
Copy link

Build triggered by changes to the head.

Unit testing complete. There were 0 failures and 0 errors from 1994 tests and 11169 assertions.
Checkstyle analysis reported 164 warnings and 0 errors.

@joomla-jenkins
Copy link

Build triggered by changes to the head.

Unit testing complete. There were 0 failures and 0 errors from 2062 tests and 11351 assertions.
Checkstyle analysis reported 164 warnings and 0 errors.

LouisLandry added a commit that referenced this pull request Feb 20, 2012
Add some simple HTML5 support to JDocument.
@LouisLandry LouisLandry merged commit 3ac2347 into joomla:staging Feb 20, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants