Posts Tagged ‘Template’

Simple HTML5

Posted: April 27, 2011 in HTML
Tags: ,

I keep going back to look and see what is actually required as a minimum for HTML5 markup, so I thought I’d blog it for easy reference.

The non-normative minimum markup for HTML5 is:

<!DOCTYPE html>
<html>
 <head>
  <title></title>
 </head>
 <body>
 </body>
</html>

Notes:

  • The DOCTYPE is required for legacy reasons. Including the DOCTYPE in a document ensures that the browser makes a best-effort attempt at following the relevant specifications.
  • HTML is not case sensitive
  • A closing slash is not needed for self-closing elements
  • A link element must have a rel attribute. If the type attribute is omitted on an external reference it will default to the MIME type of the file being referenced. For example if the href is “mycss.css”, the type will become “text/css”.
  • If no type is defined for the style element, then it defaults to “text/css”
  • If no type attribute is defined for the script element, then it default to “text/javascript”

jQuery Templates

Posted: March 22, 2011 in JavaScript
Tags: , , , , ,

I decided to dig into the new official jQuery Template Plugin developed from Microsoft yesterday. After I finally got the darn thing to work it makes inserting formatted HTML populated with data way easier.

After doing some searches on Google I kept finding articles that announce that Templates would be built into the version 1.5 core. I continued down the path coding by example and researching the API Docs. However I kept running into “tmpl is not a function”. After some continued research I finally found a tiny little comment made by John Resig that it in fact did not make it into the 1.5 release. So now that error makes sense.

To resolve this issue you must still load the jQuery plugin. It appears the plugin is still in beta stages and is available for download from Github or the Microsoft CDN.

Before I’ve been unable to use Microsoft’s CDN because it did not have SSL. But I went ahead and tested to see if they now have it included, and they do!

Here’s how I use it:

<script src="//ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>

This will automatically call it via http or https depending upon the current browser protocol being used.

See a related blog for jQuery on Google’s CDN here.