mirror of
https://github.com/pierre42100/ComunicWeb
synced 2024-11-22 20:19:21 +00:00
Improved emptyElem function
This commit is contained in:
parent
a334b2b30e
commit
fe0a4c3f82
@ -39,14 +39,18 @@ function byId(nodeName){
|
|||||||
*/
|
*/
|
||||||
function emptyElem(container){
|
function emptyElem(container){
|
||||||
//Get children references
|
//Get children references
|
||||||
var children = container.childNodes;
|
var children = container.children;
|
||||||
|
|
||||||
//Process each child
|
//Process each child
|
||||||
for(i in children){
|
while(container.children.length > 0){
|
||||||
if(children[i].remove)
|
|
||||||
children[i].remove();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//Check if the child has subchild
|
||||||
|
if(container.children[0].children)
|
||||||
|
emptyElem(container.children[0]); //Remove them first
|
||||||
|
|
||||||
|
//Remove child
|
||||||
|
container.children[0].remove();
|
||||||
|
}
|
||||||
|
|
||||||
//Success
|
//Success
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user