Graph uses an empty element as placeholder in the html output.
It used to be a <div class="mw-wiki-graph" data-spec=".."></div>, then changed to a <span class="mw-wiki-graph" data-spec=".." id="mw-graph-be66c7016b9de3188ef6a585950f10dc83239837"></span>.
Then in patch set 2 of https://gerrit.wikimedia.org/r/#/c/186331/, it changed to <span class="mw-wiki-graph" data-spec-id=".."></span>.
From that point onwards, the element is stripped from the output by Tidy.
So if and only if an element matches all of the following:
- No content.
- Is a span.
- Has no id attribute.
Then Tidy decides to strip it.... ?
By sheer luck, up to this point Graph walked a fine line to avoid these three parameters.