Skip to content

Commit ddb9acb

Browse files
author
Mateusz Krzeszowiak
committed
Fix document elements check to prevent WYSIWYG error on IE
When creating a document using DomParser's parseFromString method from an empty string, IE 11 returns a document which both head and body elements are null, which caused the errors. Fixes #13209
1 parent 2cc9d29 commit ddb9acb

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentovariable/editor_plugin.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,8 @@ define([
196196
}
197197
});
198198

199-
returnval += doc.head.innerHTML ?
200-
doc.head.innerHTML.replace(/"/g, '"') : '';
201-
returnval += doc.body.innerHTML ?
202-
doc.body.innerHTML.replace(/"/g, '"') : '';
199+
returnval += doc.head ? doc.head.innerHTML.replace(/"/g, '"') : '';
200+
returnval += doc.body ? doc.body.innerHTML.replace(/"/g, '"') : '';
203201

204202
return returnval ? returnval : content;
205203
},

lib/web/mage/adminhtml/wysiwyg/tiny_mce/plugins/magentowidget/editor_plugin.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,8 @@ define([
212212
widgetEl.parentNode.removeChild(widgetEl);
213213
});
214214

215-
returnval += doc.head.innerHTML ?
216-
doc.head.innerHTML.replace(/"/g, '"') : '';
217-
returnval += doc.body.innerHTML ?
218-
doc.body.innerHTML.replace(/"/g, '"') : '';
215+
returnval += doc.head ? doc.head.innerHTML.replace(/"/g, '"') : '';
216+
returnval += doc.body ? doc.body.innerHTML.replace(/"/g, '"') : '';
219217

220218
return returnval ? returnval : content;
221219
},

0 commit comments

Comments
 (0)