code: function htmlSanitizeWriter(buf, uriValidator){
      var ignore = false;
      var out = bind(buf, buf.push);
      return {
        start: function(tag, attrs, unary){
          tag = lowercase(tag);
          if (!ignore && specialElements[tag]) {
            ignore = tag;
          }
          if (!ignore && validElements[tag] === true) {
            out('<');
            out(tag);
            forEach(attrs, function(value, key){
              var lkey = lowercase(key);
              var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
              if (validAttrs[lkey] === true &&
                (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
                out(' ');
                out(key);
                out('="');
                out(encodeEntities(value));
                out('"');
              }
            });
            out(unary ? '/>' : '>');
          }
        },
        end: function(tag){
            tag = lowercase(tag);
            if (!ignore && validElements[tag] === true) {
              out('</');
              out(tag);
              out('>');
            }
            if (tag == ignore) {
              ignore = false;
            }
          },
        chars: function(chars){
            if (!ignore) {
              out(encodeEntities(chars));
            }
          }
      };
    }
docs: create an HTML/XML writer which writes to buffer
  @param {Array} buf use buf.jain('') to get out sanitized html string
  @returns {object} in the form of {
  start: function(tag, attrs, unary) {},
  end: function(tag) {},
  chars: function(text) {},
  comment: function(text) {}
  }