Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: E2EPage.find() throws error when using piercing selector targeting a non-existing element #5113

Closed
3 tasks done
jcfranco opened this issue Nov 29, 2023 · 3 comments · Fixed by #5114
Closed
3 tasks done
Assignees
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@jcfranco
Copy link
Contributor

Prerequisites

Stencil Version

4.8.0

Current Behavior

Calling find with a piercing selector where the target does not exist throws an error instead of returning null as the doc states.

Expected Behavior

For find() to return null for shadow DOM elements that are not found.

System Info

�[36m      System:�[39m node 18.16.0
�[36m    Platform:�[39m darwin (23.1.0)
�[36m   CPU Model:�[39m Apple M1 Pro (10 cpus)
�[36m    Compiler:�[39m /Users/.../stencil-component-starter/node_modules/@stencil/core/compiler/stencil.js
�[36m       Build:�[39m 1701098446
�[36m     Stencil:�[39m 4.8.0 🌞
�[36m  TypeScript:�[39m 5.2.2
�[36m      Rollup:�[39m 2.42.3
�[36m      Parse5:�[39m 7.1.2
�[36m      Sizzle:�[39m 2.42.3
�[36m      Terser:�[39m 5.24.0

Steps to Reproduce

See repro case readme.

Code Reproduction URL

https://github.com/jcfranco/stencil-4.8.0-breaks-piercing-selector-for-non-existent-elements

Additional Information

4.7.2 does not throw an error and works as expected.

@tanner-reits tanner-reits self-assigned this Nov 30, 2023
@tanner-reits tanner-reits added the Bug: Validated This PR or Issue is verified to be a bug within Stencil label Nov 30, 2023
@tanner-reits
Copy link
Member

@jcfranco Thanks for letting us know! I was able to confirm the regression from v4.7.2. We'll work on getting this resolved ASAP!

tanner-reits added a commit that referenced this issue Nov 30, 2023
Fixes a regression caused by the removal of a few `asElement()` calls. Turns out these are necessary for the case where the handle is `null`. To avoid type errors, we cast the returned value to be of type `ElementHandle<Element>` rather than `ElementHandle<Node`.

STENCIL-1032: `E2EPage.find()` throws error when using piercing selector targeting a non-existing element

Fixes: #5113
tanner-reits added a commit that referenced this issue Nov 30, 2023
Fixes a regression caused by the removal of a few `asElement()` calls in 91cfa2c. Turns out these are necessary for the case where the handle is `null`. To avoid type errors, we cast the returned value to be of type `ElementHandle<Element>` rather than `ElementHandle<Node`.

STENCIL-1032: `E2EPage.find()` throws error when using piercing selector targeting a non-existing element

Fixes: #5113
github-merge-queue bot pushed a commit that referenced this issue Nov 30, 2023
Fixes a regression caused by the removal of a few `asElement()` calls in 91cfa2c. Turns out these are necessary for the case where the handle is `null`. To avoid type errors, we cast the returned value to be of type `ElementHandle<Element>` rather than `ElementHandle<Node`.

STENCIL-1032: `E2EPage.find()` throws error when using piercing selector targeting a non-existing element

Fixes: #5113
@tanner-reits
Copy link
Member

The fix for this was included as a part of today's v4.8.1 release!

@jcfranco
Copy link
Contributor Author

jcfranco commented Dec 6, 2023

@tanner-reits Thanks for fixing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants