From ba2d8c4d8d0c50912867b210a37e501009a71761 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Thu, 18 Sep 2014 18:37:43 +0100 Subject: Use a document fragment, rather than creating a redundant div --- src/leaflet-soton.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/leaflet-soton.js b/src/leaflet-soton.js index a1f6ea4..8b34aaf 100644 --- a/src/leaflet-soton.js +++ b/src/leaflet-soton.js @@ -1482,7 +1482,7 @@ SELECT * WHERE {\ } function getTemplateWrapper(properties, contentFunction) { - var div = document.createElement("div"); + var documentFragment = new DocumentFragment(); if ('uri' in properties) { var link = document.createElement('a'); @@ -1491,12 +1491,12 @@ SELECT * WHERE {\ link.className = 'ls-popup-uri'; link.textContent = "(Full Information)"; - div.appendChild(link); + documentFragment.appendChild(link); } var title = document.createElement('h2'); title.classList.add("ls-popup-title"); - div.appendChild(title); + documentFragment.appendChild(title); var titleText = ""; @@ -1518,9 +1518,9 @@ SELECT * WHERE {\ var div_inner = document.createElement("div"); div_inner.classList.add("ls-popup-content"); contentFunction(div_inner); - div.appendChild( div_inner ); + documentFragment.appendChild( div_inner ); - return div; + return documentFragment; } var createTabs = function(tabs, container) { -- cgit v1.2.3