p4ulypops / jquery-clean

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

Options are formatted out by default #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. $.htmlClean('<select><option value="foo">bar</option></select>', {format: 
true});

What is the expected output? What do you see instead?

One would expect to see something like:

    <select>
        <option value="foo">bar</option>
    </select>

but one actually sees:

    <select>bar</select>

What version of the product are you using? On what operating system?

Latest (1.3.1) on Chrome/Linux

Please provide any additional information below.

It seems like this can be fixed by changing line 472 to:
"hr", "i", "input", "img", "ins", "label", "legend", "map", "option", "q",

but adding "option" to the "tags which are inline" (as the comment defines 
"tagInline") seems like the wrong way to solve the problem.

Perhaps the code is using "tagInline" as the default whitelist of tags; that 
would explain the behavior, but I didn't dig deep enough to confirm.  If that 
is intended behavior, it appears rather problematic, as it would seem to 
require users to have to define a whitelist of every tag every time they want 
to format some HTML.

It seems to me that a better behavior would be to leave all tags allowed by 
default, and only start "eating" tags if a whitelist or blacklist is defined.

Original issue reported on code.google.com by jer...@syapse.com on 12 Feb 2013 at 10:57

GoogleCodeExporter commented 9 years ago
Thanks Jeremy

I'll take a look this weekend

Ant

Original comment by antixsof...@gmail.com on 13 Feb 2013 at 10:34

GoogleCodeExporter commented 9 years ago
Hi Jeremy

Your suggestion is the way to fix this, and I have added option to tagInline.

The library only allows inline tags inside inline tags, so, inline tags must be 
identified, otherwise this restriction could not be applied.

You are right, in that this is not perfect, but it is the approach taken by the 
library any other changes would be a bigger re-factor that I would like to do 
right now.

The library was built to support html4 and I would like to update it for html5 
too, but I haven't the time, besides, I would probably start again with a more 
configurable approach.

Anyway for now, this seems to be OK, hope you agree.

Original comment by antixsof...@gmail.com on 25 Feb 2013 at 12:18

GoogleCodeExporter commented 9 years ago
Issue 25 has been merged into this issue.

Original comment by antixsof...@gmail.com on 25 Feb 2013 at 12:20

GoogleCodeExporter commented 9 years ago
Sounds great.

Original comment by jer...@syapse.com on 1 Mar 2013 at 9:46