Check to see if there's an event listener somewhere else in the page 
(specifically one attached to an ancestor of the deep-DOM button) that's 
calling stopPropagation 
(https://developer.mozilla.org/en/DOM/event.stopPropagation). That's the 
only thing I can think of that might cause this behavior.

[email protected] wrote:
> Thanks for the reply qufighter.  Thats not the issue though.   I don't
> have the code in front of me, but I am doing something "like":
> this works and the button, where it is located generates the event
> now:
> //create div in div2 variable up here
>
> body.appendChild(div2)
> div2.addEventListener('click', doNothing, false);
>
> if i change the LOCATION of where the generated element is inserted
> into the DOM tree (ie, I comment out the body.appendChild())
>
> //body.appendChild(div2)   // Comment this out and add the below two
> lines to put the new
> // node in a new location
> var giftNodes = document.evaluate('//d...@class="tab_box"]/div[2]/
> div',document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
> giftNodes.snapshotItem(0).appendChild(div2);
>
> div2.addEventListener('click', doNothing, false);
>
> then the button is still generated correctly, BUT won't fire the
> event.  So all I am doing is changing the location where I insert the
> new div node, not moving it after it is part of the DOM.  Heck, if I
> leave the original appendChild in there so I can get the button in
> both places, the original (bottom of the body of the page) still fires
> the event but the one deep into the DOM does not.  It just does not
> make any sense to me....
>
>
>
> On Jul 24, 12:53 am, qufighter <[email protected]> wrote:
>   
>> if you try to change the location of an element, you typically have to
>> reattach the event listener, unless there were some method to move it
>> in the tree without loosing the attached events. MDC_moveElement
>> (elmx,target_ElmY) would be a great addition to not disrupt playing
>> video or event listeners would provide many new possibilities for
>> reshaping webpages without covering content... or innerHTML onclick
>> events in firefox...
>>
>> On Jul 23, 11:05 pm, "[email protected]" <[email protected]>
>> wrote:
>>
>>     
>>> Thanks everyone for the help.  I got it working on my test page.  On
>>> the site I am trying to get my final working, the above works when it
>>> is added to the bottom of the body and generates the click event.  As
>>> soon as I change the div location to somewhere within the tree where I
>>> need it to be, the click event no longer works.  Any ideas?  It seems
>>> somehow that after a certain point (I have not tested how far down the
>>> tree it needs to get yet) deep into the DOM tree, the event no longer
>>> fires.   Is there any possible way for this to be the case?  If so, is
>>> there a way I can actually fix the issue programmaticly in GM?
>>>       
>>> Thanks...
>>>       
> >
>
> ____________________________________________________________________________________
> Click here for free information on business phone systems from top companies.
> http://ads.lavabit.com/fc/BLSrjwr4LzVHADBJCZZfQBhfvM8qoLbLSa6NZnQmih9ku9HKeD1ZdDvniWM/
> ____________________________________________________________________________________
>   


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"greasemonkey-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/greasemonkey-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to