SSR support for <:Window> (albeit impossible to test for some reason)

pull/391/head
Rich-Harris 8 years ago
parent 9f832c2e37
commit cefbe45edb

@ -110,7 +110,8 @@ export default {
leave ( generator, node ) {
if ( node.name in meta ) {
return meta[ node.name ].leave( generator, node );
if ( meta[ node.name ].leave ) meta[ node.name ].leave( generator, node );
return;
}
const isComponent = node.name in generator.components;

@ -1,8 +1,17 @@
import Component from './Component.js';
import isVoidElementName from '../../../utils/isVoidElementName.js';
import Window from './meta/Window.js';
const meta = {
':Window': Window
};
export default {
enter ( generator, node ) {
if ( node.name in meta ) {
return meta[ node.name ].enter( generator, node );
}
if ( node.name in generator.components || node.name === ':Self' ) {
Component.enter( generator, node );
return;
@ -39,6 +48,11 @@ export default {
},
leave ( generator, node ) {
if ( node.name in meta ) {
if ( meta[ node.name ].leave ) meta[ node.name ].leave( generator, node );
return;
}
if ( node.name in generator.components || node.name === ':Self' ) {
Component.leave( generator, node );
return;

@ -0,0 +1,9 @@
export default {
enter () {
// noop
},
leave () {
// noop
}
};

@ -1,6 +1,8 @@
export default {
html: `<div>undefinedxundefined</div>`,
'skip-ssr': true, // there's some kind of weird bug with this test... it compiles with the wrong require.extensions hook for some bizarre reason
test ( assert, component, target, window ) {
const event = new window.Event( 'resize' );

Loading…
Cancel
Save