mirror of https://github.com/sveltejs/svelte
fix: add check for is attribute (#15086)
Fixes #15085 Add a check for is attribute in is_custom_element_node function.pull/15094/head
parent
7740d4576b
commit
d17f5c748d
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"svelte": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix: add check for `is` attribute to correctly detect custom elements
|
@ -0,0 +1,19 @@
|
|||||||
|
import { test } from '../../test';
|
||||||
|
|
||||||
|
export default test({
|
||||||
|
mode: ['client', 'server'],
|
||||||
|
async test({ assert, target }) {
|
||||||
|
const my_element = /** @type HTMLElement & { object: { test: true }; } */ (
|
||||||
|
target.querySelector('my-element')
|
||||||
|
);
|
||||||
|
const my_link = /** @type HTMLAnchorElement & { object: { test: true }; } */ (
|
||||||
|
target.querySelector('a')
|
||||||
|
);
|
||||||
|
assert.equal(my_element.getAttribute('string'), 'test');
|
||||||
|
assert.equal(my_element.hasAttribute('object'), false);
|
||||||
|
assert.deepEqual(my_element.object, { test: true });
|
||||||
|
assert.equal(my_link.getAttribute('string'), 'test');
|
||||||
|
assert.equal(my_link.hasAttribute('object'), false);
|
||||||
|
assert.deepEqual(my_link.object, { test: true });
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,2 @@
|
|||||||
|
<my-element string="test" object={{ test: true }}></my-element>
|
||||||
|
<a is="my-link" string="test" object={{ test: true }}></a>
|
Loading…
Reference in new issue