I want to make the img element inexpressible and unraggable because I use it as a window size control (clicking and dragging around the surrounding div resizes the window).
It works great as below:
noSelect[x].ondragstart = function() {return false};
But since this will be used in the firefox extension (3.6. *), Which uses an XPCNativeWrapper around each HTMLE element, I cannot use ".ondragstart" and must use ".addEventListener"
The problem is equivalent to the code above, does not work. Clicking and dragging img starts dragging the default image of firefox, instead of resizing my window in the following:
noSelect[x].addEventListener("dragstart", function () {return false}, false)
Are the two lines of code above not equivalent?
Full context for non-selectable objects:
var noSelect = document.getElementsByClassName("noSelect") for (x in noSelect) { if (x == "length") break noSelect[x].unselectable = "on"; noSelect[x].onselectstart = function(){return false}; noSelect[x].ondragstart = function() {return false}; noSelect[x].style.userSelect = "none";
javascript javascript-events dom-events firefox-addon drag-and-drop
TinyTimZamboni
source share