Content clean function is reviewed and corrected. I have tested it with “ctr+a” copy of whole webpage and then pasted in story editor. Nothing will disturb our website layout but a little thing is pending, please have a look:
What is implemented now?
In fact the two contrast functions were available,
1- A function which can remove only specified tag (with or without data inside it)
2- A function which can select all the tags from content which is submitted
Situations:
1- Suppose if any invalid html tag will come in any valid tag so currently that invalid tag will be removed (only tag, not text inside that tag)
2- If any valid tag will come inside invalid tag
e.g.
<table><tr><td>
Invalid Tags
<ul>
<li>Valid Tags</li>
<li>Valid Tags</li>
</ul>
</td></tr></table>
So only invalid tags will be removed and their data will remain in content. Our valid tags will be untouched.
Prospects:
By this you will see that if a lot of garbage inserted in editor that will not be removed because if we will remove invalid tags and their data inside as well so our valid tags will be removed as well. See the example above.
What is pending and couldn’t implemented yet?
A function which should remove everything except specified (allowed) tags and their respective data, which is not available and couldn’t implemented yet. We have to code it with combination of above mentioned function and an intelligent algorithm.
Suggestion:
For now let it go as I have implemented it that only valid html tags will be passed on and invalid tags will be removed but data will be maintained. Further we can refine this function as following:
Our function will sense that remove everything except valid tags and its respective data but it will require a recursive parent/child nodes inspection. More experiments would be required to refine this.
Coming soon…
Last updated: March 19, 2014