Is sanitize expected to ignore camel-cased attributes even when set in the schema? #183
-
Hello, I'm wondering if it's expected for camel-cased attributes to be removed even when I include them in the schema? See this demo for an example. Input HTML: <div class="my-p-class" my-name="cool" coolName="very cool"> Hello World!</div> Output HTML: <div class="my-p-class" my-name="cool"> Hello World!</div> Schema Setting: const customSchema = {
...defaultSchema,
attributes: {
...defaultSchema.attributes,
'*': ['className', 'my-name', 'coolName'],
},
}; |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @xiaohk!
HTML is case insensitive (lowercase), and the schema does not rename attributes The custom schema you are probably looking for is const customSchema = {
...defaultSchema,
attributes: {
...defaultSchema.attributes,
'*': ['class', 'my-name', 'coolname'],
},
}; That said with all the camel case, I get the sense you may actually may want XML or JSX? Are you interacting with a domain specific language or templating language? |
Beta Was this translation helpful? Give feedback.
Hey @xiaohk!
HTML is case insensitive (lowercase), and the schema does not rename attributes
The custom schema you are probably looking for is
That said with all the camel case, I get the sense you may actually may want XML or JSX? Are you interacting with a domain specific language or templating language?