webcomponents / webcomponents/polyfills

[scoped-custom-element-registry] Non-string Values Are Not Properly Stringified Before Calling attributeChangedCallback in setAttribute

Open
#607 0 comments 0 reactions 0 assignees View on GitHub
Focus Area: Standards & Polyfills Type: Bug
Dominant language
HTML
Stars
1.2k
Forks
168
PR merge metrics
No merged PRs in 30d

Description

### Description

The patched class `setAttribute` calls `attributeChangedCallback` without converting value to a string. This can lead to unexpected behavior when passing numeric or otherwise non-string values.

### Example

[Playground ](https://lit.dev/playground/#gist=c71f7fd23f3209a5a7bb67d1e8b0e37b)

### Steps to reproduce

#### Expected behavior

> Similar to `toggleAttribute`, a preliminary step `const newValue = this.getAttribute(name)` is added for use in `attributeChangedCallback`.

Image

#### Actual behavior

Image


Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.