function onPropertyChange(e) {
    var el = e.srcElement;

    switch (e.propertyName) {
      case 'width':
        el.getContext().clearRect();
        el.style.width = el.attributes.width.nodeValue + 'px';
        // In IE8 this does not trigger onresize.
        el.firstChild.style.width =  el.clientWidth + 'px';
        break;
      case 'height':
        el.getContext().clearRect();
        el.style.height = el.attributes.height.nodeValue + 'px';
        el.firstChild.style.height = el.clientHeight + 'px';
        break;
    }
  }
Public initializes a canvas element so that it can be used as canvas
element from now on. This is called automatically before the page is
loaded but if you are creating elements using createElement you need to
make sure this is called on the element.
@param {HTMLElement} el The canvas element to initialize.
@return {HTMLElement} the element that was created.