Issue #3314478 by Wim Leers, pooja saraah, smustgrave, lauriii, alexpott:...
Issue #3314478 by Wim Leers, pooja saraah, smustgrave, lauriii, alexpott: Follow-up for #3231334: global attributes should result in HTMLRestrictions becoming simplified
(cherry picked from commit e7943531)
@@ -1193,6 +1193,7 @@ public function providerPair(): array {
],
],
'violations'=>[
'filters.filter_html'=>'The current CKEditor 5 build requires the following elements and attributes: <br><code><br> <p onhover style> <* dir="ltr rtl" lang> <img on*> <blockquote style> <marquee> <a onclick="javascript:*"> <code style="foo: bar;"></code><br>The following elements are missing: <br><code><p onhover style> <img on*> <blockquote style> <code style="foo: bar;"></code>',
'settings.plugins.ckeditor5_sourceEditing.allowed_tags.0'=>'The following tag in the Source Editing "Manually editable HTML tags" field is a security risk: <em class="placeholder"><p onhover></em>.',
'settings.plugins.ckeditor5_sourceEditing.allowed_tags.1'=>'The following tag in the Source Editing "Manually editable HTML tags" field is a security risk: <em class="placeholder"><img on*></em>.',
'settings.plugins.ckeditor5_sourceEditing.allowed_tags.2'=>'The following tag in the Source Editing "Manually editable HTML tags" field is a security risk: <em class="placeholder"><blockquote style></em>.',
@@ -133,6 +133,24 @@ public function providerConstruct(): \Generator {
['*'=>['foo'=>['a'=>FALSE,'b'=>FALSE]]],
'The "*" HTML tag has attribute restriction "foo", but it is not an array of key-value pairs, with HTML tag attribute values as keys and TRUE as values.',
];
// Invalid overrides of globally disallowed attributes.
yield'INVALID: <foo bar> when "bar" is globally disallowed'=>[
'The attribute restrictions in "<foo style>" are allowing attributes "bar", "style" that are disallowed by the special "*" global attribute restrictions',
];
yield'INVALID: <foo on*> when "on*" is globally disallowed'=>[
'The attribute restrictions in "<foo on*>" are allowing attributes "bar", "style", "on*" that are disallowed by the special "*" global attribute restrictions',
];
yield'INVALID: <foo ontouch> when "on" is globally disallowed'=>[
'The attribute restrictions in "<foo ontouch>" are allowing attributes "bar", "style", "on*" that are disallowed by the special "*" global attribute restrictions',
];
}
/**
@@ -507,6 +525,105 @@ public function providerConvenienceConstructors(): \Generator {
'<h2 id="jump-*">',
['h2'=>['id'=>['jump-*'=>TRUE]]],
];
// Attribute restrictions that match the global attribute restrictions
// should be omitted from concrete tags.
yield'<p> <* foo>'=>[
'<p> <* foo>',
['p'=>FALSE,'*'=>['foo'=>TRUE]],
];
yield'<p foo> <* foo> results in <p> getting simplified'=>[
'<p foo> <* foo>',
['p'=>FALSE,'*'=>['foo'=>TRUE]],
];
yield'<* foo> <p foo> results in <p> getting simplified'=>[
'<* foo> <p foo>',
['p'=>FALSE,'*'=>['foo'=>TRUE]],
];
yield'<p foo bar> <* foo> results in <p> getting simplified'=>[
'<p foo bar> <* foo>',
['p'=>['bar'=>TRUE],'*'=>['foo'=>TRUE]],
];
yield'<* foo> <p foo bar> results in <p> getting simplified'=>[