@ -364,9 +364,41 @@ var IPython = (function (IPython) {
}
CodeCell . prototype . clear _output = function ( ) {
this . element . find ( "div.output" ) . html ( "" ) ;
this . outputs = [ ] ;
CodeCell . prototype . clear _output = function ( stdout , stderr , other ) {
var output _div = this . element . find ( "div.output" ) ;
if ( stdout && stderr && other ) {
// clear all, no need for logic
output _div . html ( "" ) ;
this . outputs = [ ] ;
return ;
}
// remove html output
// each output_subarea that has an identifying class is in an output_area
// which is the element to be removed.
if ( stdout ) {
output _div . find ( "div.output_stdout" ) . parent ( ) . remove ( ) ;
}
if ( stderr ) {
output _div . find ( "div.output_stderr" ) . parent ( ) . remove ( ) ;
}
if ( other ) {
output _div . find ( "div.output_subarea" ) . not ( "div.output_stderr" ) . not ( "div.output_stdout" ) . parent ( ) . remove ( ) ;
}
// remove cleared outputs from JSON list:
for ( var i = this . outputs . length - 1 ; i >= 0 ; i -- ) {
var out = this . outputs [ i ] ;
var output _type = out . output _type ;
if ( output _type == "display_data" && other ) {
this . outputs . splice ( i , 1 ) ;
} else if ( output _type == "stream" ) {
if ( stdout && out . stream == "stdout" ) {
this . outputs . splice ( i , 1 ) ;
} else if ( stderr && out . stream == "stderr" ) {
this . outputs . splice ( i , 1 ) ;
}
}
}
} ;