impressive markup clean-up - wrapper elements now automagically generate themselves

This commit is contained in:
Bartek Szopka
2011-12-30 14:01:16 +01:00
parent 118f92e33c
commit 3a67355863
2 changed files with 15 additions and 4 deletions

View File

@@ -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);