The Firebug inspector doesn't stop all events of an object, it only captures the click event<https://github.com/firebug/firebug/blob/8c1c521409f729d8ce8c493742190694c34698dd/extension/content/firebug/html/inspector.js#L505>. If that's enough for you, you can simply do that by setting the third parameter of addEventListener()<https://developer.mozilla.org/en-US/docs/Web/API/EventTarget.addEventListener>to true instead of false to trigger at the capturing phase of the event and then cancel the event.
Sebastian On Tuesday, October 1, 2013 12:59:53 AM UTC+2, Mike Priest wrote: > > I am working on a firebug like javascript element selector, but cannot > figure out how to stop all JavaScript events from firing when clicked. The > firebug lite plugin (https://getfirebug.com/firebuglite) is doing exactly > what I want, but cannot figure out what they are doing. > Any help would be appreciated. > > Senario: > > - User selects element inspector > - User clicks on element > - onClick, mousedown, mouseup should NOT fire > > I have tried the following with no luck: > > function stopEvents(el){ > > for(var key in window) { > if (key.indexOf("on") == 0) { > el.addEventListener(key.substr(2), stop, false); > } > } > } > > function StopEvent(pE) > { > stopEvents(pE); > > if (!pE) > if (window.event) > pE = window.event; > else > return; > if (pE.cancelBubble != null) > pE.cancelBubble = true; > if (pE.stopPropagation) > pE.stopPropagation(); > if (pE.preventDefault) > pE.preventDefault(); > if (window.event) > pE.returnValue = false; > if (pE.cancel != null) > pE.cancel = true; > } > > > > > > -- You received this message because you are subscribed to the Google Groups "Firebug" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/firebug. To view this discussion on the web visit https://groups.google.com/d/msgid/firebug/bda287f0-931f-445b-9f31-e9d9357f2ddd%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
