Christian Heilmann

You are currently browsing the archives for the General category.

Archive for the ‘General’ Category

Accessibility 2.0 Podcasts and Transcriptions available

Friday, August 22nd, 2008

The conference that inspired me to start Scripting Enabled, Accessibility2.0 just released transcripts and audio files of all the presentations, including my “Fencing in the habitat”:

[slideshare id=372843&doc=fencinginthehabitat-1209163055552778-9&w=425]

Thanks to AbilityNet for releasing all the transcripts and offering them for us to enjoy. There were some really good presentations at this event, hope you find something!

Creating progressively enhanced DOM applications with ViewsHandler

Tuesday, August 19th, 2008

When I taught a bunch of students last month the ways of the DOM and explained progressive enhancement they were very happy about the ideas but rightfully exclaimed that DOM scripting can get verbose and repetitive. This is when I had to idea to write ViewsHandler , a small framework to write DOM applications.

ViewsHandler is not meant to be a JavaScript templating engine, as I found that whilst you have to create a lot of HTML with DOM, the parts that change in the app are not that many. Templating engines would replace the whole view, ViewsHandler instead offers you to create HTML, add it to a shell or application canvas and store references to the parts that change. That way you only create your HTML once and then only do minor changes to cached DOM elements when you need to.

As a demo I created a small Flickr slide show using ViewsHandler which was exactly the task that I had given my class :)

What do you think?

Scripting Enabled – how accessibilty concerns can fuel mashup innovation

Friday, August 15th, 2008

I just came back from Stanford where I talked about Scripting Enabled, what lead to it, how I build Easy YouTube and generally how giving hack events and unconferences an accessiblity spin can rejuvenate the movement and drive innovation. The slides are available here and the video will follow once Stanford has finished captioning it.

[slideshare id=553629&doc=scriptingenabled-1218646262025037-8&w=425]

Talking about Scripting Enabled and accessibility hacking at Stanford

Friday, August 8th, 2008

Next Thursday, the 14th of August I’ll be guest at Stanford University to give a talk about accessibility hacking and Scripting Enabled.

Get all the details on the Stanford Online Accessibility Program Site

How to get all IDs and classes used in a document?

Monday, August 4th, 2008

This was a question from one of the attendees of my JavaScript course, and here is one solution:

 function getIDsAndClasses(elm,parent){
   var elm = elm || '*';
   if(typeof parent !== 'undefined'){
     if(typeof parent === 'string'){
       var parent = document.getElementById(parent) || document;
     }
   } else {
     var parent = document;
   }
   var elms = parent.getElementsByTagName(elm);
   var ids = [];
   var classesFilter = {};
   var i = elms.length;while(i--){
     if(elms[i].id !== ''){
       ids.push(elms[i].id);
     }
     if(elms[i].className !== ''){
       var singles = elms[i].className.split(' ');
       var j = singles.length;while(j--){
         classesFilter[singles[j]] = singles[j];
       }
     }
   }
   var classes = [];
   for(var i in classesFilter){
    classes[classes.length]=classesFilter[i];
   }
   return {ids:ids,classes:classes}
 }

You can call this method either with no parameters or filter it down by providing an element name and a parent element. The parent element could be a DOM reference or a string, both work.

In any case, the output is an object with a property of ids containing an array of ID names and a property called classes with an array of class names.

The script filters out duplicate classes and gets all applied classes – provided they are space separated.

You can see it in action (in the FireBug console) here: Test getIDsAndClasses

I tried using regex to get the IDs and classes, but that turned out to be a mess in JavaScript.

Any faster way?