p4ulypops / jquery-clean

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

all attributes are removed automatically if not specified #10

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Clean:
<div id="test">Hello</div>

I expect:
<div id="test">Hello</div>

I get:
<div>Hello</div>

I fix changing line 111
//Not specifiyng is like allowing all
                   else{
                       element.attributes.push(new Attribute(attrMatch[1], attrMatch[2]));
                   }

Probably an option is better.

Original issue reported on code.google.com by obsidian...@gmail.com on 1 Jul 2011 at 12:31

GoogleCodeExporter commented 9 years ago
you can now specify the attributes to be allowed

e.g. Allow Ids on all tags
{
    allowedAttributes: [["id"]]
}

e.g. Allow Ids on spans and frogs on divs
{
    allowedAttributes: [
        ["id", ["span"]],
        ["frog", ["div"]]
    ]
}

Original comment by antixsof...@gmail.com on 30 Apr 2012 at 6:28