<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel>
        <title>how to add a couple attributes to the default whitelist, e.g. 'onclick'</title>
        <description>Two questions:

I have been reading fiddling with htmlpurifier config settings and reading the docs, and came to the conclusion (erroneously?) that as far as telling htmlpurifier which elements/attributes should be allowed, I have to either leave the default whitelist alone as it is, or I have to specify every single elements/attributes that should be allowed. Is this correct?  I would love to be able to just add 2 or 3 attributes to the default whitelist.. so that I do not have to constantly find and add more elements/attributes to, e.g., HTML.AllowedElements and/or HTML.AllowedAttributes. 

On the other hand, I would not mind specifying them myself if I could find the default list of allowed elements/attributes, that I could copy and paste, and then add to.

Anyway, specifically now, (for internal trusted users) I need to allow javascript attributes (input from tinymce). 

Question #1: 

Is there a way to just add an attribute (to what HTMLpurifier allows) without causing the whole default sets of allowed elements/attributes to be effectively wiped out (overwritten by ONLY what is explicitly written in HTML.AllowedElements or HTML.AllowedAttributes)?

For what I need right now (the javascript attributes), I got excited when I saw in this thread:

http://stackoverflow.com/questions/3189396/whitelist-forms-in-html-purifier-configuration

...where Edward Z. Yang says, &quot;... [$config-&amp;gt;set('HTML.Trusted', true);] allows JavaScript.&quot;

...but even after setting this: 


$config-&amp;gt;set('HTML.Trusted', true);

, HTMLpurifier 4.4.0 is still stripping e.g. any input onclick=&quot;dostuff();&quot; attribute. Why? 

Question #2:

Is there a quick way to add just the javascript attributes to the allowed list?

Thanks for your time, sincerely

-Govinda</description>
        <link>http://htmlpurifier.org/phorum/read.php?3,6335,6335#msg-6335</link>
        <lastBuildDate>Sat, 18 May 2013 23:52:15 -0400</lastBuildDate>
        <generator>Phorum 5.2.18</generator>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6335,6337#msg-6337</guid>
            <title>Re: how to add a couple attributes to the default whitelist, e.g. 'onclick'</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6335,6337#msg-6337</link>
            <description><![CDATA[<p>thanks so much for your time!</p>

<p>I'll keep discussion over there on SO then.  I was not sure where you prefer to correspond.  Are you Edward?  Are you the sole man behind support?  (You have accomplished an astonishing amount of code in recent years ;-)</p>

<p>Again, just thanks.</p>]]></description>
            <dc:creator>purushagovinda</dc:creator>
            <category>Support</category>
            <pubDate>Wed, 02 May 2012 12:12:14 -0400</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6335,6336#msg-6336</guid>
            <title>Re: how to add a couple attributes to the default whitelist, e.g. 'onclick'</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6335,6336#msg-6336</link>
            <description><![CDATA[<p>Dupe <a href="http://stackoverflow.com/questions/10406841/with-htmlpurifier-how-to-add-a-couple-attributes-to-the-default-whitelist-e-g">http://stackoverflow.com/questions/10406841/with-htmlpurifier-how-to-add-a-couple-attributes-to-the-default-whitelist-e-g</a></p>]]></description>
            <dc:creator>Ambush Commander</dc:creator>
            <category>Support</category>
            <pubDate>Wed, 02 May 2012 11:08:39 -0400</pubDate>
        </item>
        <item>
            <guid>http://htmlpurifier.org/phorum/read.php?3,6335,6335#msg-6335</guid>
            <title>how to add a couple attributes to the default whitelist, e.g. 'onclick'</title>
            <link>http://htmlpurifier.org/phorum/read.php?3,6335,6335#msg-6335</link>
            <description><![CDATA[<p>Two questions:</p>

<p>I have been reading fiddling with htmlpurifier config settings and reading the docs, and came to the conclusion (erroneously?) that as far as telling htmlpurifier which elements/attributes should be allowed, I have to either leave the default whitelist alone as it is, or I have to specify every single elements/attributes that should be allowed. Is this correct?  I would love to be able to just add 2 or 3 attributes to the default whitelist.. so that I do not have to constantly find and add more elements/attributes to, e.g., HTML.AllowedElements and/or HTML.AllowedAttributes. </p>

<p>On the other hand, I would not mind specifying them myself if I could find the default list of allowed elements/attributes, that I could copy and paste, and then add to.</p>

<p>Anyway, specifically now, (for internal trusted users) I need to allow javascript attributes (input from tinymce). </p>

<p>Question #1: </p>

<p>Is there a way to just add an attribute (to what HTMLpurifier allows) without causing the whole default sets of allowed elements/attributes to be effectively wiped out (overwritten by ONLY what is explicitly written in HTML.AllowedElements or HTML.AllowedAttributes)?</p>

<p>For what I need right now (the javascript attributes), I got excited when I saw in this thread:</p>

<p><a href="http://stackoverflow.com/questions/3189396/whitelist-forms-in-html-purifier-configuration">http://stackoverflow.com/questions/3189396/whitelist-forms-in-html-purifier-configuration</a></p>

<p>...where Edward Z. Yang says, "... [$config-&gt;set('HTML.Trusted', true);] allows JavaScript."</p>

<p>...but even after setting this: </p>

<pre>
$config-&gt;set('HTML.Trusted', true);
</pre><p>
, HTMLpurifier 4.4.0 is still stripping e.g. any input onclick="dostuff();" attribute. Why? </p>

<p>Question #2:</p>

<p>Is there a quick way to add just the javascript attributes to the allowed list?</p>

<p>Thanks for your time, sincerely</p>

<p>-Govinda</p>]]></description>
            <dc:creator>purushagovinda</dc:creator>
            <category>Support</category>
            <pubDate>Wed, 02 May 2012 11:00:52 -0400</pubDate>
        </item>
    </channel>
</rss>
