(1) Enable IPython.notebook.kernel.execute to publish display_* even it is not called with a code cell and (2) remove empty html element when execute "display_*" #1441
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(1) If "IPython.notebook.kernel.execute" is called without a cell attached, the "display_javascript" or "display_html" is currently ignored by Notebook.prototype.handle_shell_reply() since there is no cell associated with the python code execution request. The patch allows the message type "display_data" to be accepted by Notebook.prototype.handle_shell_reply() even there is no "cell" attached with the initial IPython.notebook.kernel.execute() request. (For a better design, we might consider to assign such call with special cell id, or make a new type of message.)
(2) Removing html insertion for "display_*" calls. If we put "display_javascript" in a loop, the current noteboot will insert empty html elements and the output cell might become longer (and empty) than necessary. It looks cleaner not generating those empty element.
The patches can allow to execute python through html element, e.g., a button created with javascript in an ipython html notebook. (one example: https://github.com/cschin/IPython-Notebook---d3.js-mashup/blob/master/GDP_CO2_Example.ipynb )