Closed Bug 1569816 Opened 6 years ago Closed 6 years ago

Could we accomplish what highlightSections does without JavaScript?

Categories

(developer.mozilla.org Graveyard :: General, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: espressive, Assigned: espressive)

References

Details

(Keywords: in-triage, Whiteboard: [points=1])

Attachments

(2 files)

Currently, we have a piece of JavaScript(see below) that is responsible for some DOM manipulation in order to get the h3 and h5 elements inside the main content area to display correctly i.e. the black background

It seems like we can accomplish this with CSS only. This bug is to explore that possibility, and implement it if possible.

// This is an effect function that runs every time the article is rendered.
// This is the React version of the code in kuma/static/js/highlight.js
// which is used on the wiki domain
function highlightSections(article) {
    let sections = article.querySelectorAll('#wikiArticle h3, #wikiArticle h5');
    for (let section of sections) {
        section.classList.add('highlight-spanned');
        section.innerHTML = `<span class="highlight-span">${
            section.innerHTML
        }</span>`;
    }
}
Blocks: 1570045
Keywords: in-triage
Priority: -- → P1
Whiteboard: [points=1]
Commit merged into master by Peter Bengtsson (peterbe) Authored by Schalk Neethling (schalkneethling)
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: