From 3a67355863a0f7df1cc3512248cb50ff315169d0 Mon Sep 17 00:00:00 2001 From: Bartek Szopka Date: Fri, 30 Dec 2011 14:01:16 +0100 Subject: [PATCH] impressive markup clean-up - wrapper elements now automagically generate themselves --- index.html | 4 ++-- js/impress.js | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 74fdd7f..30bf229 100644 --- a/index.html +++ b/index.html @@ -13,7 +13,7 @@ -
+
Aren't you just bored with all those slides-based presentations? @@ -39,7 +39,7 @@ and based on the power of CSS3 transforms and transitions in modern browsers.

-
+
diff --git a/js/impress.js b/js/impress.js index c74df85..5a1b475 100644 --- a/js/impress.js +++ b/js/impress.js @@ -29,6 +29,10 @@ })(); + var arrayify = function ( a ) { + return [].slice.call( a ); + }; + var css = function ( el, props ) { var key, pkey; for ( key in props ) { @@ -49,7 +53,7 @@ var $$ = function ( selector, context ) { context = context || document; - return [].slice.call( context.querySelectorAll(selector) ); + return arrayify( context.querySelectorAll(selector) ); }; var translate = function ( t ) { @@ -71,7 +75,14 @@ // DOM ELEMENTS var impress = document.getElementById("impress"); - var canvas = $(".canvas", impress); + + var canvas = document.createElement("div"); + canvas.className = "canvas"; + + arrayify( impress.childNodes ).forEach(function ( el ) { + canvas.appendChild( el ); + }); + impress.appendChild(canvas); var steps = $$(".step", impress);