Skip to content

Commit f3e15f2

Browse files
author
Dmytro Voskoboinikov
committed
MAGETWO-72021: Wysiwyg editor incorrectly processes attributes of HTML5 tags
1 parent 02aaccb commit f3e15f2

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

lib/web/mage/adminhtml/wysiwyg/tiny_mce/html5-schema.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,19 @@ define([
186186
});
187187

188188
_.each(compiled, function (node, nodeName) {
189-
var attributes = node.attributes.join('|'),
190-
children = node.children.join('|');
189+
var filteredAttributes = [];
191190

192-
validElements.push(nodeName + '[' + attributes + ']');
193-
validChildren.push(nodeName + '[' + children + ']');
191+
_.each(node.attributes, function (attribute) { //eslint-disable-line max-nested-callbacks
192+
// Disallowing usage of 'on*' attributes.
193+
if (!/^on/.test(attribute)) {
194+
filteredAttributes.push(attribute);
195+
}
196+
});
197+
198+
node.attributes = filteredAttributes;
199+
200+
validElements.push(nodeName + '[' + node.attributes.join('|') + ']');
201+
validChildren.push(nodeName + '[' + node.children.join('|') + ']');
194202
});
195203

196204
return {

0 commit comments

Comments
 (0)