3 ms·
Maybe this is a dumb question from a JS muggle, but the thing that kills me about this whole movement to virtual/shadow DOM is that it's made the "ctrl+f" searc
by px43 5y ago
Maybe this is a dumb question from a JS muggle, but the thing that kills me about this whole movement to virtual/shadow DOM is that it's made the "ctrl+f" search useless on more and more websites. Is there a nice way to hook the search function to actually look inside elements that haven't been swapped in yet? If so, more people should be using it.
- moritzwarhier 5y agoNever had this problem really (doesn't mean that it doesn not exist). Is shadow DOM a thing outside of SVGs? For sure it's not used by React, Vue etc. MDN is telling me that the upcoming Web component spec uses it though, so maybe libraries like LitElement use it too? Sites using React or Vue all seem to be searchable using standard CTRL-F for me.
- recursive 5y agoI suspect this is a reference to the specific feature infinite/virtual scroll. The DOM nodes are only materialized when you scroll near them. CTRL-F is not able to find text that isn't currently in the DOM. If you scroll it into view, it suddenly starts working.
- moritzwarhier 5y agoThat's a very far stretch from purely the topic "Virtual DOM" though, no matter how few JS knowledge. I hate Infinite Scroll with a passion. FWIW Infinite Scroll can be and is often implemented as a jQuery plugin.
- werm82 5y agoVirtual DOM is completely different from Shadow DOM. Shadow DOM is an isolated DOM of a web component, separate from the global DOM.
- arcturus17 5y agoI’ve experienced this (Reddit comes to mind) but I’m pretty sure it’s because it aggressively mounts/dismounts things on/from the real DOM. In other words it virtualizes views (like when you have a 1000 row table and you only render rows 40-50), but this is not the same as DOM virtualization.