update missing options.target from dev error (#753)

pull/754/head
Rich Harris 8 years ago
parent 8dd23b81df
commit e9c620f200

@ -182,9 +182,7 @@ export default function dom(
// TODO deprecate component.teardown()
builder.addBlock(deindent`
function ${name} ( options ) {
options = options || {};
${options.dev &&
`if ( !options.target && !options._root ) throw new Error( "'target' is a required option" );`}
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
${generator.usesRefs && `this.refs = {};`}
this._state = ${templateProperties.data
? `@assign( @template.data(), options.data )`

@ -188,7 +188,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = assign( template.data(), options.data );
this._observers = {

@ -53,7 +53,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = assign( template.data(), options.data );
this._observers = {

@ -141,7 +141,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
recompute( this._state, this._state, {}, true );

@ -30,7 +30,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
recompute( this._state, this._state, {}, true );

@ -168,7 +168,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -37,7 +37,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -288,7 +288,7 @@ function create_each_block ( state, each_block_value, comment, i, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -144,7 +144,7 @@ function create_each_block ( state, each_block_value, comment, i, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -177,7 +177,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -48,7 +48,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -223,7 +223,7 @@ function select_block_type ( state ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -88,7 +88,7 @@ function select_block_type ( state ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -199,7 +199,7 @@ function create_if_block ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -64,7 +64,7 @@ function create_if_block ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -169,7 +169,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -48,7 +48,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -133,7 +133,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -22,7 +22,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -144,7 +144,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -33,7 +33,7 @@ function create_main_fragment ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -383,7 +383,7 @@ function create_if_block_4 ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -248,7 +248,7 @@ function create_if_block_4 ( state, component ) {
}
function SvelteComponent ( options ) {
options = options || {};
if ( !options || ( !options.target && !options._root ) ) throw new Error( "'target' is a required option" );
this._state = options.data || {};
this._observers = {

@ -215,8 +215,7 @@ describe("runtime", () => {
it("fails if options.target is missing in dev mode", () => {
const { code } = svelte.compile(`<div></div>`, {
format: "iife",
name: "SvelteComponent",
dev: true
name: "SvelteComponent"
});
const SvelteComponent = eval(

@ -1,8 +0,0 @@
export default {
html: '<h1>Just some static HTML</h1>',
test ( assert, component, target, window ) {
const newComp = new window.SvelteComponent();
assert.equal(newComp instanceof window.SvelteComponent, true);
}
};

@ -1 +0,0 @@
<h1>Just some static HTML</h1>
Loading…
Cancel
Save