background preloader

Html5

Facebook Twitter

HTML5 Custom Data Attributes (data-*) Have you ever found yourself using element class names or rel attributes to store arbitrary snippets of metadata for the sole purpose of making your JavaScript simpler? If you have, then I have some exciting news for you! If you haven't and you're thinking, Wow, that's a great idea! I implore you to rid your mind of that thought immediately and continue reading. Thanks to HTML5, we now have the ability to embed custom data attributes on all HTML elements. Attribute Name The data attribute name must be at least one character long and must be prefixed with 'data-'. Attribute Value The attribute value can be any string. Using this syntax, we can add application data to our markup as shown below: <ul id="vegetable-seeds"> <li data-spacing="10cm" data-sowing-time="March to June">Carrots</li> <li data-spacing="30cm" data-sowing-time="February to March">Celery</li> <li data-spacing="3cm" data-sowing-time="March to September">Radishes</li></ul> The spec says (emphasis ours): A word of warning Summary.

HTML 5 data- Attributes. A new feature being introduced in HTML 5 is the addition of custom data attributes. This is a, seemingly, bizarre addition to the specification – but actually provides a number of useful benefits. Simply, the specification for custom data attributes states that any attribute that starts with “data-” will be treated as a storage area for private data (private in the sense that the end user can’t see it – it doesn’t affect layout or presentation). This allows you to write valid HTML markup (passing an HTML 5 validator) while, simultaneously, embedding data within your page. A quick example: <li class="user" data-name="John Resig" data-city="Boston" data-lang="js" data-food="Bacon"> <b>John says:</b><span>Hello, how are you? The above will be perfectly valid HTML 5. Using HTML, but with a custom DTD.Using XHTML, with a specific namespace.

On top of this a simple JavaScript API is presented to access these attribute values (in addition to the normal get/setAttribute): Comments are closed. Should you be using HTML5 today? Despite all the hype about HTML5, there are still many people (mainly web developers!) Out there who are wondering whether or not they should use it in their next site. The main issues seem to be browser compatibility and the myth that HTML5 won’t be ready for mainstream usage until 2022. To begin with, let’s bust this myth once and for all. For any specification to be deemed “ready”, it supposedly needs to be fully implemented in two browsers. If this rule was true, CSS2.1 also wouldn’t be “ready”, and do you hear people advising you to hold off on using that?

No, and quite rightly so too. And the same should go for HTML5. As for browser compatibility, the latest versions of browsers such as Firefox, Chrome, Safari and Opera all support various parts of the HTML5 specification, and older versions of these browsers support bits of the spec. Pretty well, actually, and there are a lot of things you can do to ensure browser compatibility.

New elements Styling HTML5 Reset Modernizr No JavaScript? 4 The elements of HTML — HTML5. 4.2.1 The head element Categories: None. Contexts in which this element can be used: As the first element in an html element. Content model: If the document is an iframe srcdoc document or if title information is available from a higher-level protocol: Zero or more elements of metadata content, of which no more than one is a title element and no more than one is a base element. Otherwise: One or more elements of metadata content, of which exactly one is a title element and no more than one is a base element. Content attributes: Global attributes Tag omission in text/html: A head element's start tag may be omitted if the element is empty, or if the first thing inside the head element is an element. A head element's end tag may be omitted if the head element is not immediately followed by a space character or a comment. Allowed ARIA role attribute values: none Allowed ARIA state and property attributes: Global aria-* attributes DOM interface: interface HTMLHeadElement : HTMLElement {}; <!

<! 4.2.2 The title text . Code Standards | Isobar. Overview This document contains guidelines for web applications built by the Creative Technology (front end engineering) practice of Isobar. It is to be readily available to anyone who wishes to check the iterative progress of our best practices. This document's primary motivation is two- fold: 1) code consistency and 2) best practices.

By maintaining consistency in coding styles and conventions, we can ease the burden of legacy code maintenance, and mitigate risk of breakage in the future. By adhering to best practices, we ensure optimized page loading, performance and maintainable code. Pillars of Front-end Development◊ General Practices◊ Indentation◊ For all code languages, we require indentation to be done via soft tabs (using the space character).

Readability vs Compression◊ We prefer readability over file-size savings when it comes to maintaining existing files. The first component of any web page is the tag-based markup language of HTML. HTML5 is a new version of HTML and XHTML. 1. 1. 1. Html5 cross browser polyfills - Modernizr - GitHub. The No-Nonsense Guide to HTML5 Fallbacks So here we're collecting all the shims, fallbacks, and polyfills in order to implant HTML5 functionality in browsers that don't natively support them. The general idea is that: We, as developers, should be able to develop with the HTML5 APIs, and scripts can create the methods and objects that should exist.

Developing in this future-proof way means as users upgrade, your code doesn't have to change but users will move to the better, native experience cleanly. Looking to conditionally load these scripts (client-side), based on feature detects? See Modernizr.Looking for a guide to write your own polyfills? See Writing Cross-Browser JavaScript Polyfills.Looking for an alphabetical guide on HTML5, CSS3, etc. features, and how to use them? Svgweb by Brad Neuberg & others Fallback via FlashSnap.SVG from scratch by the author of Raphaël (Dmitry Baranovskiy) Abstracted API. FakeSmile by David Leunen Canvas Web Storage (LocalStorage and SessionStorage) Video. Using ColdFusion With Pusher - A Notification Service Powered By HTML5 WebSockets. The Wilderness Downtown.

HTML5 Peeks, Pokes and Pointers. Web Socket Server. Introduction I've been hearing about HTML5 for quite some time now, and I especially liked the idea of web sockets. Giving us the ability to send data directly to the user, instead of doing something like polling with AJAX requests seems like a very neat idea.

So the other day, I decided that I would try to make a small server and test it out on my localhost. As far as I can tell, only Google Chrome supports web sockets at the moment, but I sure hope that it will pick up. This screenshot is an example of how web sockets could be used (the code is in the attached zip file). Naturally, I started the development with a Google search; this however didn't really help much. Background The server is heavily based on sockets. Using the Code The code is organized into a couple of classes in a class library, which could be included as a project in your solution or compiled into an assembly.

The following is an example of how you could start the server: The constructor takes three arguments: So! A JSON event-based convention for WebSockets @ Bamboo Blog. HTML5 WebSockets are cool. Given a compliant server - and browser -, all you need to do is instantiate your socket object and start listening to server-pushed data. How awesome is that?! Your browser is now officially hooked-up to the server by a persistent, firewall-safe, bidirectional TCP connection. The server can send data to the browser at any time, via predefined callbacks, while talking back to the server is as straight-fordward as: 1 socket.send( "Thank you, Mr. server! " ); Think about it for a moment. 1 // Incoming messages 2 socket.onmessage = function(evt){ 3 // We use jQuery because life's too short for raw DOM scripting 4 $('#messages').prepend( "<li>" + evt.data + "</li>" ); 5 } 6 7 // Send message to chat server 8 $('form').submit(function(){ 9 socket.send( $(this).find('input.message').val() ); 10 return false; 11 }); We get a message from the server, we add it to the page.

SEND destination:/some/channel hello everybody ^@ See where I'm going with this? WTF just happened?!