We observed a special case in DOM Spec where style tags are used for semantic content. The HTML for this page: https://en.wikipedia.org/wiki/User:Jpita23/test when obtained from restbase https://en.wikipedia.org/api/rest_v1/page/html/User%3AJpita23%2Ftest has the following content
<style data-mw-deduplicate="TemplateStyles:r886058088" typeof="mw:Extension/templatestyles mw:Transclusion" about="#mwt2" data-mw='{"parts":[{"template":{"target":{"wt":"ISBN","href":"./Template:ISBN"},"params":{"1":{"wt":"978-953-51-1197-9"}},"i":0}}]}' id="mwBA"> .mw-parser-output cite.citation{font-style:inherit}.mw-parser-output .citation q{quotes:"\"""\"""'""'"} .... </style> <a rel="mw:WikiLink" href="./International_Standard_Book_Number" title="International Standard Book Number" about="#mwt2">ISBN</a> <span typeof="mw:Entity" about="#mwt2"> </span> <a rel="mw:WikiLink" href="./Special:BookSources/978-953-51-1197-9" title="Special:BookSources/978-953-51-1197-9" about="#mwt2" id="mwBQ">978-953-51-1197-9</a>
The corresponding wikitext is {{ISBN|978-953-51-1197-9}}
As you can see the core definition of template is at data-mw attribute of style tag. It has RDFA attribute typeof="mw:Extension/templatestyles mw:Transclusion"
We had a case to remove style tags since it is irrelevant for translation and ended up removing ISBN templates T217585: CX2: ISBN doubled, one correctly formatted with {{ISBN}}, another incorrectly formatted with [[Special:BookSources]]. Fixed it as a special case, but we are hitting multiple issues in our parsing logic as we no longer can ignore style tags and need to parse it as semantic content.
This ticket is to evaluate the style tag holding semantic content situation and explore if we can have a cleaner definition.