我需要触发所有ant元素的点击,然后将生成的dom读取到dom中,并保存到变量中,如何在不附加dom的情况下从ajax调用中获取dom?
或者我如何将dom加载到一些隐藏的浏览器选项卡中,以使窗口和文档事件气泡成为可能?
let url = 'https://www.amazon.com/dp/B07VHXT1R3';
$.get( url ).then(resp => {
let dom = $( resp );
//images preload
dom.find('#altImages li input').each(function(){
// this would generate other elements inside the dynamic dom,// but this is stored into a variable
$(this).trigger('click');
});
let images = [];
dom.find('li.image img').each(function(){
// this would have to read the images generated
// but only read one element that comes already rendered
images.push( $(this).data('old-hires') || this.src );
});
[ ... ]
具体来说,我需要冒泡进入未渲染的dom,并且不绑定窗口和文档对象
有人知道如何在不使RAM崩溃的情况下做到这一点吗?