bore icon indicating copy to clipboard operation
bore copied to clipboard

Add deep flag for traversing down shadow trees.

Open treshugart opened this issue 7 years ago • 0 comments

This would effectively fill what the shadow-piercing combinator enabled. No matter how deep the element you're trying to select is, it should find and return it. The only catch is that selectors will still be bound to shadow boundaries, which I think is fair.

The deep flag should be added to the walk() function as an option. It will be passed by anything that uses walk() internally, such as: one(), all() and has().

mount(<my-component />).one('a.some-deep-element', { deep: true });

Where <my-component /> contains the a several shadow trees down.

To work on existing nodes:

mount(document.getElementById('app')).one('a.some-deep-element', { deep: true });

A more common use case might be with Selenium where you'd find something by text content, or by a query that cannot be expressed by a selector or complete node:

mount(document.getElementById('app').one({ textContent: 'Submit' }, { deep: true });

treshugart avatar May 12 '17 18:05 treshugart