Thanks for the clarification (and the amazing responsiveness).

On Nov 6, 11:21 pm, Aaron Boodman <a...@chromium.org> wrote:
> On Fri, Nov 6, 2009 at 11:11 PM, Edwin Khodabakchian
>
>
>
>
>
> <edwin.khodabakch...@gmail.com> wrote:
>
> > Hello,
>
> > I have noticed a recent change in how some events are propagated in
> > the very latest dev channel and I am wondering if this is a regression
> > or if you have fixed a previous bug.
>
> > Here is the use case:
>
> > I have defined a content strip onhttp://www.feedly.com/home
>
> > Using the content script, I enrich the DOM with some additional
> > content (I just lookup a DOM element and use innerHTML to inject
> > content.
>
> > Part of the injected content is an <img src="..." onclick="this.
> > $controller(). loadPreviewPage('param1', 'param2'...) " />
>
> > this.$controller is a generic dispatch function I have defined in my
> > content script.
>
> > Up to recently, everything seem to work on Windows. In the latest dev
> > channel, I am getting "Uncaught TypeError: Object #<an Object> has no
> > method 'loadPreviewPage'" when the I click on the image.
>
> > Here is my question:
>
> > When innerHTML is called from within the content script with content
> > which has onclick, onmouse down and other types of event handler, in
> > which content will those event handlers be executed (the content of
> > the content script or the content of the page?).
>
> > I think that I can live with both answers (content script is easier
> > but if it is a content of page, I can set up a proxy and use a custom
> > DOM event to route it to the content script) I just need to know the
> > right answer so that we can align ourselves.
>
> They will be executed in the page's context. This isn't something that
> changed in the last release though, it should have been this way for
> several releases now.
>
> The suggested way to handle events is by attaching handlers using
> JavaScript, instead of inline event attributes. So instead of:
>
> foo.innerHTML = "<div onclick='alert(\"hi\")'>hi</div>";
>
> something like:
>
> foo.innerHTML = "<div></div>";
> foo.firstChild.onclick = function() { alert('hi') };
>
> - a
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to chromium-extensions@googlegroups.com
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to