1
0
mirror of https://github.com/ascribe/onion.git synced 2025-02-14 21:10:27 +01:00

put lets instead of vars

This commit is contained in:
Cevo 2015-10-08 11:28:41 +02:00
parent 34d4b0ccb9
commit 8b13a21f9c

View File

@ -8,10 +8,9 @@
// elementAttributes: hash table containing the attributes of the relevant element // elementAttributes: hash table containing the attributes of the relevant element
let constructHeadElement = function(elementType, elementId, elementAttributes) { let constructHeadElement = function(elementType, elementId, elementAttributes) {
var head = (document.head || document.getElementsByTagName('head')[0]); let head = (document.head || document.getElementsByTagName('head')[0]);
var element = document.createElement(elementType); let element = document.createElement(elementType);
var oldElement = document.getElementById(elementId); let oldElement = document.getElementById(elementId);
try {
for (let k in elementAttributes){ for (let k in elementAttributes){
try { try {
element.setAttribute(k, elementAttributes[k]); element.setAttribute(k, elementAttributes[k]);
@ -22,8 +21,6 @@ let constructHeadElement = function(elementType, elementId, elementAttributes) {
continue; continue;
} }
} }
}
if (oldElement) { if (oldElement) {
head.removeChild(oldElement); head.removeChild(oldElement);
} }