林炳权 1 год назад
Родитель
Сommit
823d383cd2
1 измененных файлов с 5 добавлено и 5 удалено
  1. 5 5
      examples/index.html

+ 5 - 5
examples/index.html

@@ -60,7 +60,7 @@
 
 		const links = {};
 		const validRedirects = new Map();
-		const container = document.createElement( 'div' );
+		const fragment = document.createDocumentFragment();
 
 		let selected = null;
 
@@ -68,8 +68,6 @@
 
 		async function init() {
 
-			content.appendChild( container );
-
 			viewSrcButton.style.display = 'none';
 
 			const files = await ( await fetch( 'files.json' ) ).json();
@@ -82,14 +80,14 @@
 				const header = document.createElement( 'h2' );
 				header.textContent = key;
 				header.setAttribute( 'data-category', key );
-				container.appendChild( header );
+				fragment.appendChild( header );
 
 				for ( let i = 0; i < category.length; i ++ ) {
 
 					const file = category[ i ];
 
 					const link = createLink( file, tags[ file ] );
-					container.appendChild( link );
+					fragment.appendChild( link );
 
 					links[ file ] = link;
 					validRedirects.set( file, file + '.html' );
@@ -98,6 +96,8 @@
 
 			}
 
+			content.appendChild( fragment );
+
 			if ( window.location.hash !== '' ) {
 
 				const file = window.location.hash.substring( 1 );

粤ICP备19079148号