Answer the question
In order to leave comments, you need to log in
Why does the DOM node "disappear"?
There is a function that builds a base on the page, adding SVG and not only elements to the page.
sample code:
function initdivcart(){
let tdformap = document.querySelector('body > table > tbody > tr:nth-child(1) > td:nth-child(3)');
let divcart = document.createElement('div');
divcart.setAttribute('id', 'divcart');
let cart = document.createElementNS(svgNS, 'svg');
cart.setAttributeNS(null, 'id', 'cart');
let glabwall = document.createElementNS(svgNS, 'g');
glabwall.setAttributeNS(null, 'id', 'labwall');
let g = document.createElementNS(svgNS, 'g');
g.setAttributeNS(null, 'id', 'lab');
cart.append(g);
cart.append(glabwall);
divcart.append(cart);
tdformap.append(divcart);
}
function dbget(table, ind, key) {
return new Promise((resolve) => {
let openRequest = indexedDB.open('FV', 6);
openRequest.onsuccess = function() {
let db = openRequest.result;
let transaction = db.transaction(table, 'readonly');
let labs = transaction.objectStore(table);
let index = labs.index(ind);
let request = index.getAll(key);
request.onsuccess = function() {
let res = request.result;
db.close();
resolve(res);
};
};
});
}
if(!document.getElementById('divcart')){
console.log('1'+document.getElementById('labwall'));
initdivcart();
console.log('2'+document.getElementById('labwall'));
dbget('labs', 'lablvlID', lablvlID).then(resthis => {
for(let xxlab of resthis){
console.log('3'+document.getElementById('labwall'));
labwall(xxlab);
console.log('4'+document.getElementById('labwall'));
}
itemonlab(lab);
});
}
1null
2[object SVGGElement]
3null
Uncaught (in promise) TypeError: Cannot read property 'append' of null
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question