[jQuery] Can I somehow see what events are binded to a DOM element?

2009-10-28 Thread jayarjo

I wonder if I can see somewhere what events are binded to a DOM
element (in FireBug maybe). Maybe it's obvious, but I just don't know
yet if it's even possible.


[jQuery] Re: Can I somehow see what events are binded to a DOM element?

2009-10-28 Thread jayarjo


Looks interesting, also I couldn't find the way to query it for
specific DOM elements.

However, as I figured out events are just set on DOM elements
with .data() function. So it just a matter of some scripting to list
them all in the console. Pretty straightforward.

Firebug people are building an extension EventBug, although they can't
say when it will be ready or released: 
http://blog.getfirebug.com/2009/09/18/eventbug-rising/

This one turned out to be very useful - cuts down amount of scripting
needed to just one line: 
http://james.padolsey.com/javascript/debug-jquery-events-with-listhandlers/.
Thumbs up!

On Oct 28, 4:21 pm, Karl Swedberg k...@englishrules.com wrote:
 On Oct 28, 2009, at 7:45 AM, jayarjo wrote:



  I wonder if I can see somewhere what events are binded to a DOM
  element (in FireBug maybe). Maybe it's obvious, but I just don't know
  yet if it's even possible.

 this bookmarklet might help:

 http://www.sprymedia.co.uk/article/Visual+Event

 --Karl

 
 Karl Swedbergwww.englishrules.comwww.learningjquery.com


[jQuery] Storing reference to an object using jQuery.data - any problems expected?

2009-10-23 Thread jayarjo

I want to store a reference to a particular object using jQuery.data
on another object, can it potentially lead to memory leaks?

And another question. Those objects at some point are dynamically
removed and if that happens will the connection and associated data
automatically be released, or we got to do it manually?


[jQuery] Re: bubbling of triggered events... ?

2009-05-17 Thread jayarjo


I was trying to catch an event on body tag, for example this doesn't
work as expected:

head
script type=text/javascript src=js/jquery-1.3.2.min.js/script
/head

body onclick=alert('body!')

div id=one onclick=alert('div!') style=width:100px;height:
100px;border:1px solid gray;
!-- blank --
/div

script
$('#one').trigger('click');
/script
/body

although this one works:

head
script type=text/javascript src=js/jquery-1.3.2.min.js/script
/head

body

div  onclick=alert('body!')
div id=one onclick=alert('div!') style=width:
100px;height:100px;border:1px solid gray;
!-- blank --
/div
/div

script
$('#one').trigger('click');
/script
/body

it took me sometime to figure this out, ' cause it was not stated
anywhere. Why - body tag is not considered as parent?



On May 17, 2:49 am, Mike Nichols nichols.mik...@gmail.com wrote:
 can you show some code that isn't working

 On May 16, 6:21 am, jayarjo jaya...@gmail.com wrote:

  New in jQuery 1.3:

  All triggered events now bubble up the DOM tree. For example if you
  trigger an event on a paragraph then it will trigger on that element
  first, then on the parent element, and its parent, and so on up to the
  document. The event object will have a .target property equal to the
  original triggered element. You can prevent the bubbling by calling
  stopPropagation() or by returning false from your 
  callback.http://docs.jquery.com/Events/trigger#eventdata

  In other words triggered event should bubble up to it's parent
  container, should it? If yes, then I want to catch it on parents level
  and trigger it on another child of choice, and so on. But it doesn't
  seem to bubble... :(

  Any help appreciated.


[jQuery] Re: routing event to html map

2009-05-17 Thread jayarjo


Thanks. I've figured it out.The problem is, that the image getting
manually triggered click event doesn't route it further to the
associated html map (but it should, right? logically thinking). So my
solution was to catch the event on image and route it further
manually.

On May 16, 9:51 pm, infoaddicted jack.lapla...@gmail.com wrote:
 It would be helpful if you posted snippets of your HTML along with the
 JQuery code.

 On May 16, 12:26 pm, jayarjo jaya...@gmail.com wrote:

  I've got several map tags with custom areas defined and corresponding
  images with usemap attributes. The problem is that those images are
  covered with transparent div. I manually intercept events on that div
  and route them to the images underneath it. But maps do not seem to
  react to routed events anymore. Is it correctable somehow? Or maybe
  I'm doing something wrong? The structure cannot be altered,
  transparent div must be on top and images and their corresponding maps
  must get the click event somehow :(

  Any suggestions?


[jQuery] Re: routing event to html map

2009-05-17 Thread jayarjo


I've found out (that gave me another hard hour), that in IE click
event gets routed from image to associated map - automatically. I
guess this issue should be handled by jQuery guys somehow.

On May 17, 10:38 am, jayarjo jaya...@gmail.com wrote:
 Thanks. I've figured it out.The problem is, that the image getting
 manually triggered click event doesn't route it further to the
 associated html map (but it should, right? logically thinking). So my
 solution was to catch the event on image and route it further
 manually.

 On May 16, 9:51 pm, infoaddicted jack.lapla...@gmail.com wrote:

  It would be helpful if you posted snippets of your HTML along with the
  JQuery code.

  On May 16, 12:26 pm, jayarjo jaya...@gmail.com wrote:

   I've got several map tags with custom areas defined and corresponding
   images with usemap attributes. The problem is that those images are
   covered with transparent div. I manually intercept events on that div
   and route them to the images underneath it. But maps do not seem to
   react to routed events anymore. Is it correctable somehow? Or maybe
   I'm doing something wrong? The structure cannot be altered,
   transparent div must be on top and images and their corresponding maps
   must get the click event somehow :(

   Any suggestions?


[jQuery] bubbling of triggered events... ?

2009-05-16 Thread jayarjo

New in jQuery 1.3:

All triggered events now bubble up the DOM tree. For example if you
trigger an event on a paragraph then it will trigger on that element
first, then on the parent element, and its parent, and so on up to the
document. The event object will have a .target property equal to the
original triggered element. You can prevent the bubbling by calling
stopPropagation() or by returning false from your callback.
http://docs.jquery.com/Events/trigger#eventdata


In other words triggered event should bubble up to it's parent
container, should it? If yes, then I want to catch it on parents level
and trigger it on another child of choice, and so on. But it doesn't
seem to bubble... :(

Any help appreciated.


[jQuery] routing event to html map

2009-05-16 Thread jayarjo

I've got several map tags with custom areas defined and corresponding
images with usemap attributes. The problem is that those images are
covered with transparent div. I manually intercept events on that div
and route them to the images underneath it. But maps do not seem to
react to routed events anymore. Is it correctable somehow? Or maybe
I'm doing something wrong? The structure cannot be altered,
transparent div must be on top and images and their corresponding maps
must get the click event somehow :(

Any suggestions?