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

Add support for nextElementSibling and previousElementSibling #1132

Merged
merged 9 commits into from Feb 11, 2022
Merged

Conversation

samouri
Copy link
Member

@samouri samouri commented Feb 11, 2022

Use case: amp-carousel's buildDom

* Returns the Element immediately prior to the specified one in its parent's children list,
* or null if the specified element is the first one in the list.
*/
get previousElementSibling() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also needs to be implemented on CharacterData for Text nodes

Copy link
Member Author

@samouri samouri Feb 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm surprised Text Nodes support this. Done

src/test/node/nextSibling.test.ts Outdated Show resolved Hide resolved
src/worker-thread/dom/elementSibling.ts Show resolved Hide resolved
@samouri
Copy link
Member Author

samouri commented Feb 11, 2022

Thank you for the reviews @jridgewell and @rcebulko!! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants