mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-28 01:20:07 +00:00
Merge "Remove unreachable code in tableOfContents.js"
This commit is contained in:
commit
95dbf57db5
|
@ -433,29 +433,11 @@ module.exports = function tableOfContents( props ) {
|
||||||
*
|
*
|
||||||
* @param {string} elementId
|
* @param {string} elementId
|
||||||
* @param {string} html
|
* @param {string} html
|
||||||
* @param {boolean} setInnerHTML
|
|
||||||
*/
|
*/
|
||||||
function reloadPartialHTML( elementId, html, setInnerHTML = true ) {
|
function reloadPartialHTML( elementId, html ) {
|
||||||
const htmlElement = document.getElementById( elementId );
|
const htmlElement = document.getElementById( elementId );
|
||||||
if ( htmlElement ) {
|
if ( htmlElement ) {
|
||||||
if ( setInnerHTML ) {
|
htmlElement.innerHTML = html;
|
||||||
htmlElement.innerHTML = html;
|
|
||||||
} else if ( htmlElement.outerHTML ) {
|
|
||||||
htmlElement.outerHTML = html;
|
|
||||||
} else { // IF outerHTML property access is not supported
|
|
||||||
const tmpContainer = document.createElement( 'div' );
|
|
||||||
tmpContainer.innerHTML = html.trim();
|
|
||||||
const childNode = tmpContainer.firstChild;
|
|
||||||
if ( childNode ) {
|
|
||||||
const tmpElement = document.createElement( 'div' );
|
|
||||||
tmpElement.setAttribute( 'id', `div-tmp-${elementId}` );
|
|
||||||
const parentNode = htmlElement.parentNode;
|
|
||||||
if ( parentNode ) {
|
|
||||||
parentNode.replaceChild( tmpElement, htmlElement );
|
|
||||||
parentNode.replaceChild( childNode, tmpElement );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue