Skip to content
This repository was archived by the owner on Jan 10, 2024. It is now read-only.

Commit 3abd646

Browse files
author
Pat Patterson
committed
Use escape:false option rather than unescaping remote action result
1 parent 13d11f1 commit 3abd646

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

RemoteTK.component

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,9 @@ if (remotetk === undefined) {
3232
}
3333

3434
if (remotetk.Client === undefined) {
35-
function unescapeHTML(input) {
36-
var y = document.createElement('textarea');
37-
y.innerHTML = input;
38-
return y.value;
39-
}
40-
4135
function handleResult(result, callback, error, nullok) {
4236
if (result) {
43-
result = JSON.parse(unescapeHTML(result));
37+
result = JSON.parse(result);
4438
if ( Array.isArray(result) && result[0].message && result[0].errorCode ) {
4539
if ( typeof error === 'function' ) {
4640
error(result);
@@ -74,6 +68,8 @@ if (remotetk.Client === undefined) {
7468
remotetk.Client.prototype.describe = function(objtype, callback, error) {
7569
RemoteTKController.describe(objtype, function(result){
7670
handleResult(result, callback, error);
71+
}, {
72+
escape: false
7773
});
7874
}
7975

@@ -89,6 +85,8 @@ if (remotetk.Client === undefined) {
8985
remotetk.Client.prototype.create = function(objtype, fields, callback, error) {
9086
RemoteTKController.create(objtype, JSON.stringify(fields), function(result){
9187
handleResult(result, callback, error);
88+
}, {
89+
escape: false
9290
});
9391
}
9492

@@ -104,6 +102,8 @@ if (remotetk.Client === undefined) {
104102
remotetk.Client.prototype.retrieve = function(objtype, id, fieldlist, callback, error) {
105103
RemoteTKController.retrieve(objtype, id, fieldlist, function(result){
106104
handleResult(result, callback, error);
105+
}, {
106+
escape: false
107107
});
108108
}
109109

@@ -123,6 +123,8 @@ if (remotetk.Client === undefined) {
123123
remotetk.Client.prototype.upsert = function(objtype, externalIdField, externalId, fields, callback, error) {
124124
RemoteTKController.upser(objtype, externalIdField, externalId, JSON.stringify(fields), function(result){
125125
handleResult(result, callback, error, true);
126+
}, {
127+
escape: false
126128
});
127129
}
128130
*/
@@ -140,6 +142,8 @@ if (remotetk.Client === undefined) {
140142
remotetk.Client.prototype.update = function(objtype, id, fields, callback, error) {
141143
RemoteTKController.updat(objtype, id, JSON.stringify(fields), function(result){
142144
handleResult(result, callback, error, true);
145+
}, {
146+
escape: false
143147
});
144148
}
145149

@@ -154,6 +158,8 @@ if (remotetk.Client === undefined) {
154158
remotetk.Client.prototype.del = function(objtype, id, callback, error) {
155159
RemoteTKController.del(objtype, id, function(result){
156160
handleResult(result, callback, error, true);
161+
}, {
162+
escape: false
157163
});
158164
}
159165

@@ -167,6 +173,8 @@ if (remotetk.Client === undefined) {
167173
remotetk.Client.prototype.query = function(soql, callback, error) {
168174
RemoteTKController.query(soql, function(result){
169175
handleResult(result, callback, error);
176+
}, {
177+
escape: false
170178
});
171179
}
172180

@@ -180,6 +188,8 @@ if (remotetk.Client === undefined) {
180188
remotetk.Client.prototype.search = function(sosl, callback, error) {
181189
RemoteTKController.search(sosl, function(result){
182190
handleResult(result, callback, error);
191+
}, {
192+
escape: false
183193
});
184194
}
185195
}

0 commit comments

Comments
 (0)