I desire to execute the following tested, working in console, ES6 code through MediaWiki as described in detail here,
but it fails being executed through MediaWiki as its latest release for now (1.33.0) allegedly can only execute ES3:
const list = document.querySelector("#footnotes_list");
document.querySelectorAll(".footnote>sup").forEach((footnote, i) => {
const li = document.createElement("li");
li.append(...footnote.childNodes); // move content
list.appendChild(li);
footnote.textContent = i+1;
});
I assume const
is okay to become var
;
I read in W3schools that forEach()
is ES5 but AFAICR I can replace this with for
loop.
I miss what could replace array spreading via spread operator (...
) in ES3.
Google search for "array spreading ES3" (without quote marks) brings no example on how to spread an array in ES3 (maybe the terminology is different?).
If possible within the limitations of ES3, how will you do array spreading with it?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…