improved way cocktail check wether node are attached to dom