docs: function define(className, opt_parentConstructor, opt_tagNS) {
      if (typeof className == 'function') {
        throw new Error('Passing functions as className is deprecated. Please ' +
                        'use (className, opt_parentConstructor) to subclass');
      }
  
      var className = className.toLowerCase();
      if (opt_parentConstructor && !opt_parentConstructor.tagName)
        throw new Error('opt_parentConstructor was not ' +
                        'created by tr.ui.b.define');
  
      // Walk up the parent constructors until we can find the type of tag
      // to create.
      var tagName = className;
      var tagNS = undefined;
      if (opt_parentConstructor) {
        if (opt_tagNS)
          throw new Error('Must not specify tagNS if parentConstructor is given');
        var parent = opt_parentConstructor;
        while (parent && parent.tagName) {
          tagName = parent.tagName;
          tagNS = parent.tagNS;
          parent = parent.parentConstructor;
        }
      } else {
        tagNS = opt_tagNS;
      }
  
      /**
       * Creates a new UI element constructor.
       * Arguments passed to the constuctor are provided to the decorate method.
       * You will need to call the parent elements decorate method from within
       * your decorate method and pass any required parameters.
       * @constructor
       */
      function f() {
        if (opt_parentConstructor &&
            f.prototype.__proto__ != opt_parentConstructor.prototype) {
          throw new Error(
              className + ' prototye\'s __proto__ field is messed up. ' +
              'It MUST be the prototype of ' + opt_parentConstructor.tagName);
        }
  
        var el;
        if (tagNS === undefined)
          el = tr.doc.createElement(tagName);
        else
          el = tr.doc.createElementNS(tagNS, tagName);
        f.decorate.call(this, el, arguments);
        return el;
      }
  
      /**
       * Decorates an element as a UI element class.
       * @param {!Element} el The element to decorate.
       */
      f.decorate = function(el) {
        el.__proto__ = f.prototype;
        el.decorate.apply(el, arguments[1]);
        el.constructor = f;
      };
  
      f.className = className;
      f.tagName = tagName;
      f.tagNS = tagNS;
      f.parentConstructor = (opt_parentConstructor ? opt_parentConstructor :
                                                     undefined);
      f.toString = function() {
        if (!f.parentConstructor)
          return f.tagName;
        return f.parentConstructor.toString() + '::' + f.className;
      };
  
      return f;
    }