ezyang / htmlpurifier

Standards compliant HTML filter written in PHP
http://htmlpurifier.org
GNU Lesser General Public License v2.1
3.07k stars 327 forks source link

Library removes data attribute from the html #256

Closed abhilashpujari closed 4 years ago

abhilashpujari commented 4 years ago

$html = '<div class="is-overlay-bg skrollable skrollable-before" data-location="test"></div>';

Results in <div class="is-overlay-bg skrollable skrollable-before"></div>

Do we have setting through which we allow all data-attribute, we can individually allow data-attribute by

$def = $config->getHTMLDefinition(true); $def->info_global_attr['data-location'] = new HTMLPurifier_AttrDef_Text;

But I have lots custom data-attribute that will be added by my wysiwyg editor so can't whitelist all of them, so it will be good have setting through which all data-attribute are allowed

Thanks