-
-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Labels
👀 no/externalThis makes more sense somewhere elseThis makes more sense somewhere else
Description
Subject of the issue
A schemas ancestors
property is not respected.
Your environment
- OS: macOS 10.15.2
- Packages: hast-util-sanitize@3.0.1, rehype-sanitize@4.0.0
- Env: Node@12.14.1 npm@6.13.4
Steps to reproduce
Simple schema:
{
"ancestors": {
"li": ["ul"]
},
"tagNames": [
"div",
"ul",
"li"
]
}
HTML:
<div>
<li>List Item</li>
</div>
Expected behavior
Expecting the resulting tree to exclude the li
tag:
root[1]
│ data: {"quirksMode":true}
└─0 element<div>[3]
│ properties: {}
├─0 text "\n "
├─1 text "List Item"
└─2 text "\n"
Actual behavior
The li
tag is still included:
root[1]
│ data: {"quirksMode":true}
└─0 element<div>[3]
│ properties: {}
├─0 text "\n "
├─1 element<li>[1]
│ │ properties: {}
│ └─0 text "List Item"
└─2 text "\n"
I investigated a bit and it seems like this bug has appeared because of this: syntax-tree/hast-util-sanitize@19631bb#diff-92bbac9a308cd5fcf9db165841f2d90ce981baddcb2b1e26cfff170929af3bd1R252. I can create a PR for it if you want.
Metadata
Metadata
Assignees
Labels
👀 no/externalThis makes more sense somewhere elseThis makes more sense somewhere else