Skip to content
This repository has been archived by the owner on Feb 4, 2018. It is now read-only.

Add deep flag for traversing down shadow trees. #18

Open
treshugart opened this issue May 12, 2017 · 0 comments
Open

Add deep flag for traversing down shadow trees. #18

treshugart opened this issue May 12, 2017 · 0 comments

Comments

@treshugart
Copy link
Member

treshugart commented May 12, 2017

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 });
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant