Page MenuHomePhabricator

Consider using data-mw-* attribute for section ids in parsoidSectionsUsingDivs
Closed, DeclinedPublic

Description

From @Tgr's comment in https://gerrit.wikimedia.org/r/#/c/377349/4/lib/parsoidSectionsUsingDivs.js@78

doc.querySelectorAll('div[id^=section]');

use a data-mw-* attribute or at least prefix the id with mw-

Event Timeline

Won't all logic depending on the structure of data-mw JSON potentially break anytime the underlying template changes?

I was debating whether to use an element's class name or a value plucked from data-mw JSON in a recent patch, and settled on relying on the resulting class name rather than the data-mw for that reason.

Ah, never mind, on second read I guess the context here is a little different; this seems specifically about section parsing.

Right. This task is (maybe i should say was) more about using something like data-mw-section-id. I think we could probably get rid of the parse sections by div thing altogether.

+1. Seems safe to assume we can get sections from Parsoid at this point.

parsoidSectionsUsingDivs is no more.