salesforce / kagekiri

Shadow DOM-piercing query APIs for the browser.
BSD 3-Clause "New" or "Revised" License
86 stars 9 forks source link

feat: Get element by id #39

Closed tedconn closed 4 years ago

tedconn commented 4 years ago

This PR adds getElementById(id: string, context?: Node).

If the provided context is not a Document, ShadowRoot or HTMLDocument it will throw a TypeError

This PR also increases the coverage to 100% which allows us to set the threshold for 100%! 🥳

nolanlawson commented 4 years ago

The document in tests always refers to the karma document, and getElementById doesn't penetrate that iframe where the shadow DOM is created.

We can always do iframe.contentWindow.document, right?

If the iframe is a hassle then we can remove it for these particular tests, but it seems to me we should be able to just grab the iframe's document.

nolanlawson commented 4 years ago

^ Merge conflicts, other than that LGTM