Skip to content

fix(mock-doc): implement part API#6423

Merged
johnjenkins merged 4 commits intostenciljs:mainfrom
ritoban23:fix/mockdoc-part-api
Oct 14, 2025
Merged

fix(mock-doc): implement part API#6423
johnjenkins merged 4 commits intostenciljs:mainfrom
ritoban23:fix/mockdoc-part-api

Conversation

@ritoban23
Copy link
Contributor

What is the current behavior?

The part DOM API is missing from Stencil's MockDoc. Running this.element.part.add('something') throws "Cannot read properties of undefined (reading 'add')".

GitHub Issue Number: #6420

What is the new behavior?

Implemented the part property on MockElement, returning a DOMTokenList that manages the part attribute. Mirrors the existing classList API but operates on the part attribute.

Documentation

Does this introduce a breaking change?

  • Yes
  • No

Testing

Added comprehensive test suite (part-list.spec.ts) covering add, remove, contains, toggle, validation, and integration with the part attribute.

Other information

Files: src/mock-doc/part-list.ts, src/mock-doc/node.ts, src/mock-doc/test/part-list.spec.ts

Before: this.element.part.add('something') → Error
After: this.element.part.add('something') → Works

@ritoban23 ritoban23 requested a review from a team as a code owner October 14, 2025 08:07
Copy link
Contributor

@johnjenkins johnjenkins left a comment

Choose a reason for hiding this comment

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

hey @ritoban23 - TYSM for looking at this!

@ritoban23 ritoban23 force-pushed the fix/mockdoc-part-api branch from 319d30b to c61c67d Compare October 14, 2025 13:19
@johnjenkins johnjenkins self-requested a review October 14, 2025 13:53
Copy link
Contributor

@johnjenkins johnjenkins left a comment

Choose a reason for hiding this comment

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

LGTM - just need to run npm run lint --fix 🙏

@johnjenkins
Copy link
Contributor

@ritoban23 and now npm run prettier 😄

@johnjenkins johnjenkins changed the title fix(mock-doc): implement part API fix(mock-doc): implement part API Oct 14, 2025
@johnjenkins johnjenkins enabled auto-merge October 14, 2025 14:24
@johnjenkins johnjenkins added this pull request to the merge queue Oct 14, 2025
Merged via the queue into stenciljs:main with commit a85d031 Oct 14, 2025
69 checks passed
@ritoban23
Copy link
Contributor Author

@johnjenkins was wondering if i can get a hacktoberfest-accepted label on this PR, thanks anyway!

hyyan added a commit to hyyan/core that referenced this pull request Feb 23, 2026
The `part` getter added in stenciljs#6423 had no setter, causing `setAccessor`
to overwrite it on custom elements instead of setting the attribute.
github-merge-queue bot pushed a commit that referenced this pull request Feb 23, 2026
The `part` getter added in #6423 had no setter, causing `setAccessor`
to overwrite it on custom elements instead of setting the attribute.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants