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

bearND created this task.Sep 12 2017, 8:06 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 12 2017, 8:06 PM
bearND updated the task description. (Show Details)Sep 12 2017, 8:06 PM

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.

bearND added a comment.Mar 5 2018, 4:21 PM

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.

Mholloway closed this task as Declined.Mar 15 2018, 4:50 PM

parsoidSectionsUsingDivs is no more.