spec/lib/jspec.js
function(results, options) {
        var id = option('reportToId') || 'jspec'
        var report = document.getElementById(id)
        var failuresOnly = option('failuresOnly')
        var classes = results.stats.failures ? 'has-failures' : ''
        if (!report) throw 'JSpec requires the element #' + id + ' to output its reports'
        
        function bodyContents(body) {
          return JSpec.
            escape(JSpec.contentsOf(body)).
            replace(/^ */gm, function(a){ return (new Array(Math.round(a.length / 3))).join(' ') }).
            replace(/\r\n|\r|\n/gm, '<br/>')
        }
        
        report.innerHTML = '<div id="jspec-report" class="' + classes + '"><div class="heading"> \
        <span class="passes">Passes: <em>' + results.stats.passes + '</em></span>                \
        <span class="failures">Failures: <em>' + results.stats.failures + '</em></span>          \
        <span class="passes">Duration: <em>' + results.duration + '</em> ms</span>          \
        </div><table class="suites">' + map(results.allSuites, function(suite) {
          var displaySuite = failuresOnly ? suite.ran && !suite.passed() : suite.ran
          if (displaySuite && suite.hasSpecs())
            return '<tr class="description"><td colspan="2">' + escape(suite.description) + '</td></tr>' +
              map(suite.specs, function(i, spec) {
                return '<tr class="' + (i % 2 ? 'odd' : 'even') + '">' +
                  (spec.requiresImplementation() ?
                    '<td class="requires-implementation" colspan="2">' + escape(spec.description) + '</td>' :
                      (spec.passed() && !failuresOnly) ?
                        '<td class="pass">' + escape(spec.description)+ '</td><td>' + spec.assertionsGraph() + '</td>' :
                          !spec.passed() ?
                            '<td class="fail">' + escape(spec.description) + 
  													map(spec.failures(), function(a){ return '<em>' + escape(a.message) + '</em>' }).join('') +
 														'</td><td>' + spec.assertionsGraph() + '</td>' :
                              '') +
                  '<tr class="body"><td colspan="2"><pre>' + bodyContents(spec.body) + '</pre></td></tr>'
              }).join('') + '</tr>'
        }).join('') + '</table></div>'
      }
function(results, options) {
        var id = option('reportToId') || 'jspec'
        var report = document.getElementById(id)
        var failuresOnly = option('failuresOnly')
        var classes = results.stats.failures ? 'has-failures' : ''
        if (!report) throw 'JSpec requires the element #' + id + ' to output its reports'
        
        function bodyContents(body) {
          return JSpec.
            escape(JSpec.contentsOf(body)).
            replace(/^ */gm, function(a){ return (new Array(Math.round(a.length / 3))).join(' ') }).
            replace(/\r\n|\r|\n/gm, '<br/>')
        }
        
        report.innerHTML = '<div id="jspec-report" class="' + classes + '"><div class="heading"> \
        <span class="passes">Passes: <em>' + results.stats.passes + '</em></span>                \
        <span class="failures">Failures: <em>' + results.stats.failures + '</em></span>          \
        <span class="passes">Duration: <em>' + results.duration + '</em> ms</span>          \
        </div><table class="suites">' + map(results.allSuites, function(suite) {
          var displaySuite = failuresOnly ? suite.ran && !suite.passed() : suite.ran
          if (displaySuite && suite.hasSpecs())
            return '<tr class="description"><td colspan="2">' + escape(suite.description) + '</td></tr>' +
              map(suite.specs, function(i, spec) {
                return '<tr class="' + (i % 2 ? 'odd' : 'even') + '">' +
                  (spec.requiresImplementation() ?
                    '<td class="requires-implementation" colspan="2">' + escape(spec.description) + '</td>' :
                      (spec.passed() && !failuresOnly) ?
                        '<td class="pass">' + escape(spec.description)+ '</td><td>' + spec.assertionsGraph() + '</td>' :
                          !spec.passed() ?
                            '<td class="fail">' + escape(spec.description) + 
  													map(spec.failures(), function(a){ return '<em>' + escape(a.message) + '</em>' }).join('') +
 														'</td><td>' + spec.assertionsGraph() + '</td>' :
                              '') +
                  '<tr class="body"><td colspan="2"><pre>' + bodyContents(spec.body) + '</pre></td></tr>'
              }).join('') + '</tr>'
        }).join('') + '</table></div>'
      }
function ( results , options ) { var id = option ( 'reportToId' ) || 'jspec' var report = document . getElementById ( id ) var failuresOnly = option ( 'failuresOnly' ) var classes = results . stats . failures ? 'has-failures' : '' if ( ! report ) throw 'JSpec requires the element #' + id + ' to output its reports' function bodyContents ( body ) { return JSpec . escape ( JSpec . contentsOf ( body ) ) . replace ( / ^ * / gm , function ( a ) { return ( new Array ( Math . round ( a . length / 3 ) ) ) . join ( ' ' ) } ) . replace ( / \r\n|\r|\n / gm , '<br/>' ) } report . innerHTML = '<div id="jspec-report" class="' + classes + '"><div class="heading"> \
        <span class="passes">Passes: <em>' + results . stats . passes + '</em></span>                \
        <span class="failures">Failures: <em>' + results . stats . failures + '</em></span>          \
        <span class="passes">Duration: <em>' + results . duration + '</em> ms</span>          \
        </div><table class="suites">' + map ( results . allSuites , function ( suite ) { var displaySuite = failuresOnly ? suite . ran && ! suite . passed ( ) : suite . ran if ( displaySuite && suite . hasSpecs ( ) ) return '<tr class="description"><td colspan="2">' + escape ( suite . description ) + '</td></tr>' + map ( suite . specs , function ( i , spec ) { return '<tr class="' + ( i % 2 ? 'odd' : 'even' ) + '">' + ( spec . requiresImplementation ( ) ? '<td class="requires-implementation" colspan="2">' + escape ( spec . description ) + '</td>' : ( spec . passed ( ) && ! failuresOnly ) ? '<td class="pass">' + escape ( spec . description ) + '</td><td>' + spec . assertionsGraph ( ) + '</td>' : ! spec . passed ( ) ? '<td class="fail">' + escape ( spec . description ) + map ( spec . failures ( ) , function ( a ) { return '<em>' + escape ( a . message ) + '</em>' } ) . join ( '' ) + '</td><td>' + spec . assertionsGraph ( ) + '</td>' : '' ) + '<tr class="body"><td colspan="2"><pre>' + bodyContents ( spec . body ) + '</pre></td></tr>' } ) . join ( '' ) + '</tr>' } ) . join ( '' ) + '</table></div>' }
Default reporter, outputting to the DOM.

Options:
- reportToId    id of element to output reports to, defaults to 'jspec'
- failuresOnly  displays only suites with failing specs

@api public
Default reporter outputting to the DOM .