mirror of https://github.com/sveltejs/svelte
support is attribute, with a warning - fixes #3182
parent
120ee28c4f
commit
7836f409aa
@ -0,0 +1,17 @@
|
|||||||
|
export default {
|
||||||
|
warnings: [{
|
||||||
|
code: "avoid-is",
|
||||||
|
message: "The 'is' attribute is not supported cross-browser and should be avoided",
|
||||||
|
pos: 97,
|
||||||
|
start: {
|
||||||
|
character: 97,
|
||||||
|
column: 8,
|
||||||
|
line: 7
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
character: 114,
|
||||||
|
column: 25,
|
||||||
|
line: 7
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
};
|
@ -0,0 +1,2 @@
|
|||||||
|
class FancyButton extends HTMLButtonElement {}
|
||||||
|
customElements.define('fancy-button', FancyButton, { extends: 'button' });
|
@ -0,0 +1,7 @@
|
|||||||
|
<svelte:options tag="custom-element"/>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import './fancy-button.js';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<button is="fancy-button">click me</button>
|
@ -0,0 +1,15 @@
|
|||||||
|
import * as assert from 'assert';
|
||||||
|
import CustomElement from './main.svelte';
|
||||||
|
|
||||||
|
export default function (target) {
|
||||||
|
new CustomElement({
|
||||||
|
target
|
||||||
|
});
|
||||||
|
|
||||||
|
assert.equal(target.innerHTML, '<custom-element></custom-element>');
|
||||||
|
|
||||||
|
const el = target.querySelector('custom-element');
|
||||||
|
const button = el.shadowRoot.querySelector('button');
|
||||||
|
|
||||||
|
assert.ok(button instanceof customElements.get('fancy-button'));
|
||||||
|
}
|
Loading…
Reference in new issue