p4ulypops / jquery-clean

Automatically exported from code.google.com/p/jquery-clean
0 stars 0 forks source link

div elements always removed #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I am cleaning the following content:

<strong>Welkom bij BeteoR</strong>
<div><br></div>
<div>Organisatie en Adviesgroep BeteoR verzorgt opdrachten op het gebied van 
HRM voor en met:</div>
<div><br></div>
<div>
<ul>
    <li>Onderwijsinstellingen</li>
    <li>Bedrijven</li>
    <li>Zorg &amp; Welzijn</li>
</ul>
</div>

This is the code:

$.htmlClean(value, {
                format:false, 
                allowedTags:["div","ul","li","br","strong"],
                removeAttrs:["class","style","id"]});
            }

And this is the (incorrect) output:

<strong>Welkom bij BeteoR</strong>
<br />
Organisatie en Adviesgroep BeteoR verzorgt opdrachten op het gebied van HRM 
voor en met:
<br />
OnderwijsinstellingenBedrijvenZorg &amp; Welzijn

Somehow, only strong and br are preserved, even though I told htmlClean to also 
keep div/ul/li values. Any reason why it is doing this? I searched for any 
mention of "div" in the code but there seems to be none, and while there are 
mentions of li and ul, they are still removed.

Original issue reported on code.google.com by jean.me...@me.com on 15 Mar 2011 at 11:52

GoogleCodeExporter commented 9 years ago

Original comment by antixsof...@gmail.com on 18 Mar 2011 at 9:23

GoogleCodeExporter commented 9 years ago
I managed to work around this by hacking the code into accepting div/ul tags as 
"inline elements" (even though they are not). This fixed the issue, but it's 
obviously not the way to go with this.

I also had to remove the "don't allow br as the last element" part to make sure 
<div><br></div> didn't turn into <div></div>

Original comment by jean.me...@me.com on 18 Mar 2011 at 11:15

GoogleCodeExporter commented 9 years ago
Hey, Don't support you could post your modified source?
I'm having a similar issue where <div><br></div> is being filtered out.

Original comment by rald...@gmail.com on 30 Apr 2012 at 9:32

GoogleCodeExporter commented 9 years ago
hi raldred, can you raise a new bug with your code in, I've done a test for 
this and it looks like its been fixed along the way

Original comment by antixsof...@gmail.com on 30 Apr 2012 at 11:56

GoogleCodeExporter commented 9 years ago
added test, which passes so closing as fixed

Original comment by antixsof...@gmail.com on 30 Apr 2012 at 11:57