kopia lustrzana https://github.com/shoelace-style/shoelace
remove html from getTextLabel()
rodzic
83fe1ff28e
commit
97467d580b
|
@ -12,6 +12,10 @@ Components with the <sl-badge variant="warning" pill>Experimental</sl-badge> bad
|
||||||
|
|
||||||
New versions of Shoelace are released as-needed and generally occur when a critical mass of changes have accumulated. At any time, you can see what's coming in the next release by visiting [next.shoelace.style](https://next.shoelace.style).
|
New versions of Shoelace are released as-needed and generally occur when a critical mass of changes have accumulated. At any time, you can see what's coming in the next release by visiting [next.shoelace.style](https://next.shoelace.style).
|
||||||
|
|
||||||
|
## Next
|
||||||
|
|
||||||
|
- Fixed a bug in `<sl-option>` that caused HTML tags to be included in `getTextLabel()`
|
||||||
|
|
||||||
## 2.13.1
|
## 2.13.1
|
||||||
|
|
||||||
- Fixed a bug where the safe triangle was always visible when selecting nested `<sl-menu>` elements [#1835]
|
- Fixed a bug where the safe triangle was always visible when selecting nested `<sl-menu>` elements [#1835]
|
||||||
|
|
|
@ -112,7 +112,7 @@ export default class SlOption extends ShoelaceElement {
|
||||||
[...nodes].forEach(node => {
|
[...nodes].forEach(node => {
|
||||||
if (node.nodeType === Node.ELEMENT_NODE) {
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
||||||
if (!(node as HTMLElement).hasAttribute('slot')) {
|
if (!(node as HTMLElement).hasAttribute('slot')) {
|
||||||
label += (node as HTMLElement).outerHTML;
|
label += (node as HTMLElement).textContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,4 +52,9 @@ describe('<sl-option>', () => {
|
||||||
|
|
||||||
expect(el.value).to.equal('10');
|
expect(el.value).to.equal('10');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should escape HTML when calling getTextLabel()', async () => {
|
||||||
|
const el = await fixture<SlOption>(html` <sl-option><strong>Option</strong></sl-option> `);
|
||||||
|
expect(el.getTextLabel()).to.equal('Option');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Ładowanie…
Reference in New Issue