New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emit event on appended element on dom #4774
Conversation
(haha this pull request is 4774 and is suppose to fixed 4747) |
just a note that this should probably wait for #4533 since it touches some of the same code, and it would be easier to rebase this on that rather than the other way around, in case there is a conflict. |
This is a minor change, but I don't think we should add events unless there is a clear, broad need for them. I would like to better understand the actual usage case first. @gibiansky |
@ellisonbg is there a significant cost to events? I think we should definitely air on the side of more events rather than fewer, unless there is a clear cost. |
For instance, this event would be useful in the test suite. I have found while writing js tests that I want many more events in our js than we have. |
Rebased, but apparently travis is not running the tests. |
@@ -655,6 +662,7 @@ var IPython = (function (IPython) { | |||
var toinsert = this.create_output_subarea(md, "output_latex", type); | |||
toinsert.append(latex); | |||
element.append(toinsert); | |||
return toinsert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semicolons!
Comments:
|
updated to take comment into account. The |
@@ -1 +1 @@ | |||
Subproject commit 1977b852048ecb05f66d3b8980221080c5decc49 | |||
Subproject commit d153657b19789ceeb3108f11e871e153d8f6c2d9 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I know I will uncommit this change.
Fixed, rebase, whats new and put all class properties in one section just after constructor. |
failures look real, can you check? |
I agree that the tests failures look real. |
one of the error was that
Was at the beginning hence the map was registering undefined. |
These probably shouldn't be prototype methods at all. Overriding append behavior should be done with OutputArea.append_map, not through prototype override. So there's no problem that prototype overrides don't work. |
Tests are passing now - does anyone want to review this any further? |
I think this looks good, but @minrk mentioned wanting the |
The prototype conversation is unrelated to this PR. Merging. |
emit event on appended element on dom
append_map is a class attribute, mapping mime-type keys to functions. To change the append behavior, you register new functions in this mapping, not by overriding prototype methods. That's all I meant by it. So I wasn't saying that these shouldn't be prototype methods, only that it shouldn't matter whether they are or not, since the general behavior of prototyping is irrelevant. |
emit event on appended element on dom
Start working on #4747,
I'm wondering if we shouldn't have the
this['append_'+type](json[type], md, element)
return (a reference to) the inner element it happends topass it to the event.
I'm also wondering if I should pass the mimetype as a parameter of the
event, or dynamically create the event-name based on the mime-type.
Last possibility is that each of the
append_xxx(xxx, md, element)
(except JS) seem to end with
element.append(toinsert)
we could hvethem return the
toinsert
and moveelement.append(toinsert)
toappend mimetype.
Thoughts ?