diff --git a/core/modules/utils/dom/dom.js b/core/modules/utils/dom/dom.js index fef4cb9f3..eefbc2be6 100644 --- a/core/modules/utils/dom/dom.js +++ b/core/modules/utils/dom/dom.js @@ -292,14 +292,17 @@ exports.collectDOMVariables = function(selectedNode,domNode,event) { $tw.utils.each(selectedNode.attributes,function(attribute) { variables["dom-" + attribute.name] = attribute.value.toString(); }); - // Add a variable with a popup coordinate string for the selected node - variables["tv-popup-coords"] = "(" + selectedNode.offsetLeft + "," + selectedNode.offsetTop +"," + selectedNode.offsetWidth + "," + selectedNode.offsetHeight + ")"; + + if(selectedNode.offsetLeft) { + // Add a variable with a popup coordinate string for the selected node + variables["tv-popup-coords"] = "(" + selectedNode.offsetLeft + "," + selectedNode.offsetTop +"," + selectedNode.offsetWidth + "," + selectedNode.offsetHeight + ")"; - // Add variables for offset of selected node - variables["tv-selectednode-posx"] = selectedNode.offsetLeft.toString(); - variables["tv-selectednode-posy"] = selectedNode.offsetTop.toString(); - variables["tv-selectednode-width"] = selectedNode.offsetWidth.toString(); - variables["tv-selectednode-height"] = selectedNode.offsetHeight.toString(); + // Add variables for offset of selected node + variables["tv-selectednode-posx"] = selectedNode.offsetLeft.toString(); + variables["tv-selectednode-posy"] = selectedNode.offsetTop.toString(); + variables["tv-selectednode-width"] = selectedNode.offsetWidth.toString(); + variables["tv-selectednode-height"] = selectedNode.offsetHeight.toString(); + } } if(event && event.clientX && event.clientY) { diff --git a/core/modules/widgets/eventcatcher.js b/core/modules/widgets/eventcatcher.js index 8dd4e261d..dad9503c6 100644 --- a/core/modules/widgets/eventcatcher.js +++ b/core/modules/widgets/eventcatcher.js @@ -52,7 +52,7 @@ EventWidget.prototype.render = function(parent,nextSibling) { selectedNode = event.target, selectedNodeRect, catcherNodeRect, - variables; + variables = {}; // Firefox can fire dragover and dragenter events on text nodes instead of their parents if(selectedNode.nodeType === 3) { selectedNode = selectedNode.parentNode;