{"action":"created","issue":{"url":"https://api.github.com/repos/mganss/HtmlSanitizer/issues/75","repository_url":"https://api.github.com/repos/mganss/HtmlSanitizer","labels_url":"https://api.github.com/repos/mganss/HtmlSanitizer/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/mganss/HtmlSanitizer/issues/75/comments","events_url":"https://api.github.com/repos/mganss/HtmlSanitizer/issues/75/events","html_url":"https://github.com/mganss/HtmlSanitizer/issues/75","id":161671135,"number":75,"title":"Keep children of removed tags","user":{"login":"waldfee","id":8242778,"avatar_url":"https://avatars.githubusercontent.com/u/8242778?v=3","gravatar_id":"","url":"https://api.github.com/users/waldfee","html_url":"https://github.com/waldfee","followers_url":"https://api.github.com/users/waldfee/followers","following_url":"https://api.github.com/users/waldfee/following{/other_user}","gists_url":"https://api.github.com/users/waldfee/gists{/gist_id}","starred_url":"https://api.github.com/users/waldfee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/waldfee/subscriptions","organizations_url":"https://api.github.com/users/waldfee/orgs","repos_url":"https://api.github.com/users/waldfee/repos","events_url":"https://api.github.com/users/waldfee/events{/privacy}","received_events_url":"https://api.github.com/users/waldfee/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-06-22T12:40:30Z","updated_at":"2016-06-22T14:40:16Z","closed_at":null,"body":"I am trying to keep the children of tags that are removed.\r\nWhat i am currently doing:\r\n```csharp\r\nstring input = \"<p>test <script> test2</p>\";\r\n\r\nHtmlSanitizer sanitizer = new HtmlSanitizer(new []{\"p\"}, new string[0], new string[0], new string[0], new string[0]);\r\nsanitizer.RemovingTag += (sender, args) => MoveContentOfCurrentNodeToParent(args);\r\n\r\nstring result = sanitizer.Sanitize(input);\r\n```\r\n```csharp\r\nprivate static void MoveContentOfCurrentNodeToParent(RemovingTagEventArgs args)\r\n{\r\n\tforeach (INode childNode in args.Tag.ChildNodes.ToList())\r\n\t{\r\n\t\targs.Tag.Parent.InsertBefore(childNode, args.Tag);\r\n\t}\r\n}\r\n```\r\nThis works for most inputs, but not for inputs like the one above.\r\nI expected to get ```<p>test  test2</p>```, but instead it is ```<p>test  test2&lt;/p&gt;&lt;/body&gt;</p>```.\r\n\r\nIt seems this is related to the way AngleSharp (and browsers) parse the unclosed ```<script>``` tag, which looks like this (note the two closing p tags):\r\n```html\r\n<html>\r\n\t<head/>\r\n\t<body>\r\n\t\t<p>test <script> test2</p>\r\n\t\t</script>\r\n\t</p>\r\n</body>\r\n</html>\r\n```\r\nIn issue #25, @ricardobrandao talks about the same use-case. Unfortunately, he has not added his solution to the issue and his (unmerged) PR was before the switch to AngleSharp, so the changes he proposed do not help me on the right path.\r\n\r\nAm I on the completely wrong track here or am I misunderstanding something?\r\n\r\nUsing HtmlSanitizer 3.2.105"},"comment":{"url":"https://api.github.com/repos/mganss/HtmlSanitizer/issues/comments/227765470","html_url":"https://github.com/mganss/HtmlSanitizer/issues/75#issuecomment-227765470","issue_url":"https://api.github.com/repos/mganss/HtmlSanitizer/issues/75","id":227765470,"user":{"login":"304NotModified","id":5808377,"avatar_url":"https://avatars.githubusercontent.com/u/5808377?v=3","gravatar_id":"","url":"https://api.github.com/users/304NotModified","html_url":"https://github.com/304NotModified","followers_url":"https://api.github.com/users/304NotModified/followers","following_url":"https://api.github.com/users/304NotModified/following{/other_user}","gists_url":"https://api.github.com/users/304NotModified/gists{/gist_id}","starred_url":"https://api.github.com/users/304NotModified/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/304NotModified/subscriptions","organizations_url":"https://api.github.com/users/304NotModified/orgs","repos_url":"https://api.github.com/users/304NotModified/repos","events_url":"https://api.github.com/users/304NotModified/events{/privacy}","received_events_url":"https://api.github.com/users/304NotModified/received_events","type":"User","site_admin":false},"created_at":"2016-06-22T14:40:16Z","updated_at":"2016-06-22T14:40:16Z","body":"Sounds like a FAQ would be nice :) "}}
{"actor":{"display_login":"304NotModified"}}