Since T376971 the chart extension outputs a custom <wiki-chart> tag, unless there is an error (e.g. missing data URL) in which case it outputs a plain <div> with error styles.
The VE converter can match tags by:
- tag name (e.g. <figure>, <h1>)
- RDFa type (e.g. typeof="mw:Extension/math)
- generic match function
As the tag is generated as a parser function we also get <wiki-chart typeof="mw:Transclusion"> (or <div typeof="mw:Transclusion"> in the error state).
There are a couple of problems here:
- The only way to match all these cases is by using a custom match function. The match function needs to JSON-decode the data-mw value and look for parts[0].template.target.function. We end up doing this check on every template node in the document, which is pretty inefficient.
- The above could be resolved by using <wiki-chart> for error messages, but the custom tag is unwrapped by our security library DOMPurify when pasting a chart from one VE instance to another. We could possibly allow-list the tag, but I don't think we can (or want to) generically allow-list unknown tags for other extensions that might take this approach in the future.
I would therefore suggest we
- Avoid custom tags, presumably there is nothing we can do with these that we can't do with classes or other attributes.
- Find a way for Parsoid to add the name of the generating function to the typeof attribute or somewhere more accessible than the data-mw JSON