anchor.diff:    return dir;
   }
   
  -void _validateElementName(String element) {
  -  if (!element.contains('-') || element.toLowerCase() != element) {
  -    throw new FormatException('element-name must be all lower case '
  -        'and contain at least 1 hyphen');
  -  }
  +bool _isDOMElement(String element) => (_htmlElementNames[element] != null);
  +
  +bool _isPolymerElement(String element) {
  +  return element.contains('-') && (element.toLowerCase() == element);
   }
   
   String _toCamelCase(String s) {
     return s[0].toUpperCase() + s.substring(1);
   }
   
  -void _createBoilerPlate(String element, String directory,
  +void _createBoilerPlate(String element, String superClass, String directory,
                           int distanceToPackageRoot) {
     var segments = element.split('-');
     var capitalizedName = segments.map((e) => _toCamelCase(e)).join('');
     var underscoreName = element.replaceAll('-', '_'); 
     var pathToPackages = '../' * distanceToPackageRoot;
  +  
  +  bool superClassIsPolymer = 
  +      (superClass == null ? false : _isPolymerElement(superClass));
  +
  +  var classDeclaration = '';
  +  var importDartHtml = '';
  +  var polymerCreatedString = '';
  +  var extendsElementString = '';
  +  var shadowString = '';
  +  
  +  if (superClass == null) {
  +    classDeclaration = '\nclass $capitalizedName extends PolymerElement {';
  +  } else if (superClassIsPolymer) {
  +    // The element being extended is a PolymerElement.
  +    var camelSuperClass =
  +        superClass.split('-').map((e) => _toCamelCase(e)).join('');
  +    classDeclaration = 'class $capitalizedName extends $camelSuperClass {';
  +    extendsElementString = ' extends="$superClass"';
  +    shadowString = 
  +        '\n    <!-- Render extended element\'s Shadow DOM here -->\n'
  +        '    <shadow>\n    </shadow>';
  +  } else {
  +    // The element being extended is a DOM Class.
  +    importDartHtml = "import 'dart:html';\n";
  +    classDeclaration = 
  +        'class $capitalizedName extends ${_htmlElementNames[superClass]} '
  +        'with Polymer, Observable {';
  +    polymerCreatedString = '\n    polymerCreated();';
  +    extendsElementString = ' extends="$superClass"';
  +  }
   
     String html = '''  
   <!-- import polymer-element's definition -->
   <link rel="import" href="${pathToPackages}packages/polymer/polymer.html">
   
  -<polymer-element name="$element">
  +<polymer-element name="$element"$extendsElementString>
     <template>
       <style>
  -      <!-- template styling here -->
  -    </style>
  -    <!-- template content here -->
  +      <!-- Template styling here -->
  +    </style>$shadowString
  +    <!-- Template content here -->
     </template>
     <script type="application/dart" src="${underscoreName}.dart"></script>
   </polymer-element>
  
positive.code:       distanceToPackageRoot--;
      }
    }
      
    try {
      _createBoilerPlate(element, outputDir, distanceToPackageRoot);
    } on Exception catch(e) {
      print('Error creating files in $outputDir');
      print('Exception: $e');
      exitCode = 1;
      return;
    }
  
negative.code:   var parser = new ArgParser(allowTrailingOptions: true);
    
    parser.addOption('output-dir', abbr: 'o', help: 'Output directory');
    parser.addOption('extends', abbr: 'e', 
        help: 'Extends polymer-element or DOM element (e.g., div, span)');
    
    var options, element;
    try {
      options = parser.parse(args);
      if (options.rest == null || options.rest.isEmpty) {
        throw new FormatException('No element specified');
      }
      element = options.rest[0];
      if (!_isPolymerElement(element)) {
        throw new FormatException('Must specify polymer-element to create.\n'
            'polymer-element must be all lowercase with at least 1 hyphen.');
      }
    } catch(e) {
      print('$e\n');
      print('Usage:');
      print('  pub run polymer:new_element [-o output_dir] [-e super-element] '
          'element-name');
      print(parser.getUsage());
      exitCode = 1;
      return;
    } 
  