mirror of https://github.com/sveltejs/svelte
parent
c409d1bbb8
commit
a3e6feb3bd
@ -1,31 +1,44 @@
|
|||||||
import Node from './Node';
|
import Node from './Node.js';
|
||||||
import Expression from './Expression';
|
import Expression from './Expression.js';
|
||||||
|
|
||||||
|
/** @extends Node */
|
||||||
export default class Tag extends Node {
|
export default class Tag extends Node {
|
||||||
type: 'MustacheTag' | 'RawMustacheTag';
|
|
||||||
expression: Expression;
|
/** @type {'MustacheTag' | 'RawMustacheTag'} */
|
||||||
should_cache: boolean;
|
type;
|
||||||
|
|
||||||
constructor(component, parent, scope, info) {
|
/** @type {import('./Expression.js').default} */
|
||||||
super(component, parent, scope, info);
|
expression;
|
||||||
component.tags.push(this);
|
|
||||||
this.cannot_use_innerhtml();
|
/** @type {boolean} */
|
||||||
|
should_cache;
|
||||||
this.expression = new Expression(component, this, scope, info.expression);
|
|
||||||
|
/**
|
||||||
this.should_cache =
|
* @param {any} component *
|
||||||
info.expression.type !== 'Identifier' ||
|
* @param {any} parent *
|
||||||
(this.expression.dependencies.size && scope.names.has(info.expression.name));
|
* @param {any} scope *
|
||||||
}
|
* @param {any} info undefined
|
||||||
is_dependencies_static() {
|
*/
|
||||||
return (
|
constructor(component, parent, scope, info) {
|
||||||
this.expression.dynamic_contextual_dependencies().length === 0 &&
|
super(component, parent, scope, info);
|
||||||
this.expression.dynamic_dependencies().length === 0
|
component.tags.push(this);
|
||||||
);
|
this.cannot_use_innerhtml();
|
||||||
}
|
this.expression = new Expression(component, this, scope, info.expression);
|
||||||
check_if_content_dynamic() {
|
this.should_cache =
|
||||||
if (!this.is_dependencies_static()) {
|
info.expression.type !== 'Identifier' ||
|
||||||
this.not_static_content();
|
(this.expression.dependencies.size && scope.names.has(info.expression.name));
|
||||||
}
|
}
|
||||||
}
|
is_dependencies_static() {
|
||||||
|
return (this.expression.dynamic_contextual_dependencies().length === 0 &&
|
||||||
|
this.expression.dynamic_dependencies().length === 0);
|
||||||
|
}
|
||||||
|
check_if_content_dynamic() {
|
||||||
|
if (!this.is_dependencies_static()) {
|
||||||
|
this.not_static_content();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in new issue