mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
put lets instead of vars
This commit is contained in:
parent
34d4b0ccb9
commit
8b13a21f9c
@ -8,22 +8,19 @@
|
||||
// elementAttributes: hash table containing the attributes of the relevant element
|
||||
|
||||
let constructHeadElement = function(elementType, elementId, elementAttributes) {
|
||||
var head = (document.head || document.getElementsByTagName('head')[0]);
|
||||
var element = document.createElement(elementType);
|
||||
var oldElement = document.getElementById(elementId);
|
||||
try {
|
||||
for (let k in elementAttributes){
|
||||
try {
|
||||
element.setAttribute(k, elementAttributes[k]);
|
||||
}
|
||||
catch(e){
|
||||
console.log(e.message);
|
||||
console.log(elementAttributes);
|
||||
continue;
|
||||
}
|
||||
let head = (document.head || document.getElementsByTagName('head')[0]);
|
||||
let element = document.createElement(elementType);
|
||||
let oldElement = document.getElementById(elementId);
|
||||
for (let k in elementAttributes){
|
||||
try {
|
||||
element.setAttribute(k, elementAttributes[k]);
|
||||
}
|
||||
catch(e){
|
||||
console.log(e.message);
|
||||
console.log(elementAttributes);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldElement) {
|
||||
head.removeChild(oldElement);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user