Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed bug where send/@targetexpr was being evaluated multiple times.

  • Loading branch information...
commit c5c899f72eddceadd33e5e868bf7ff167eeac93a 1 parent f58c4df
@jbeard4 authored
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/core/util/code-gen.js
View
10 lib/core/util/code-gen.js
@@ -117,9 +117,12 @@ var actionTags = {
},
"send" : function(action){
- var target = (pm.platform.dom.hasAttribute(action,"targetexpr") ? pm.platform.dom.getAttribute(action,"targetexpr") : JSON.stringify(pm.platform.dom.getAttribute(action,"target")));
+ var target = (pm.platform.dom.hasAttribute(action,"targetexpr") ? pm.platform.dom.getAttribute(action,"targetexpr") : JSON.stringify(pm.platform.dom.getAttribute(action,"target"))),
+ targetVariableName = '_scionTargetRef',
+ targetDeclaration = 'var ' + targetVariableName + ' = ' + target + ';\n';
+
var event = "{\n" +
- "target: " + target + ",\n" +
+ "target: " + targetVariableName + ",\n" +
"name: " + (pm.platform.dom.hasAttribute(action,"eventexpr") ? pm.platform.dom.getAttribute(action,"eventexpr") : JSON.stringify(pm.platform.dom.getAttribute(action,"event"))) + ",\n" +
"type: " + (pm.platform.dom.hasAttribute(action,"typeexpr") ? pm.platform.dom.getAttribute(action,"typeexpr") : JSON.stringify(pm.platform.dom.getAttribute(action,"type"))) + ",\n" +
"data: " + constructSendEventData(action) + ",\n" +
@@ -127,7 +130,8 @@ var actionTags = {
"}";
var send =
- "if(" + target + " === '#_internal'){\n" +
+ targetDeclaration +
+ "if(" + targetVariableName + " === '#_internal'){\n" +
"$raise(" + event + ");\n" +
"}else{\n" +
"$send(" + event + ", {\n" +
Please sign in to comment.
Something went wrong with that request. Please try again.