Skip to content

Commit

Permalink
Finalize support of new heading HTML
Browse files Browse the repository at this point in the history
See https://www.mediawiki.org/wiki/Heading_HTML_changes.

Change-Id: I32fa8e331401085a9e10a617602f5a5346393862
  • Loading branch information
jwbth committed May 27, 2024
1 parent eab6de9 commit 4577c09
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/SectionSkeleton.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@ class SectionSkeleton {
*/
this.headlineElement = cd.g.isParsoidUsed ?
this.hElement :
this.parser.context.getElementByClassName(this.hElement, 'mw-headline');

// Presence of .mw-heading doesn't guarantee we have the new HTML for headings
// (https://www.mediawiki.org/wiki/Heading_HTML_changes). We should test for the existence of
// .mw-headline to make sure it's not there. (Could also check that .mw-editsection follows
// hN.)
(this.parser.context.getElementByClassName(this.hElement, 'mw-headline') || this.hElement);

if (!this.headlineElement) {
throw new CdError();
Expand Down

0 comments on commit 4577c09

Please sign in to comment.