pull/754/merge
Rich Harris 8 years ago committed by GitHub
commit 87180be8ec

@ -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 )`

@ -201,7 +201,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 = {

@ -154,7 +154,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 );

@ -181,7 +181,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 = {

@ -301,7 +301,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 = {

@ -192,7 +192,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 = {

@ -236,7 +236,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 = {

@ -212,7 +212,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 = {

@ -184,7 +184,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 = {

@ -146,7 +146,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 = {

@ -157,7 +157,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 = {

@ -396,7 +396,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