Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(template-compiler): enable complex template expressions #4100

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

ekashida
Copy link
Member

Details

Does this pull request introduce a breaking change?

  • ๐Ÿ˜ฎโ€๐Ÿ’จ No, it does not introduce a breaking change.
  • ๐Ÿ’” Yes, it does introduce a breaking change.

Does this pull request introduce an observable change?

  • ๐Ÿคž No, it does not introduce an observable change.
  • ๐Ÿ”ฌ Yes, it does include an observable change.

GUS work item

Comment on lines -6 to -15
const { d: api_dynamic_text, t: api_text, h: api_element } = $api;
return [
api_element("section", stc0, [
$cmp.state.isTrue
? api_text(
api_dynamic_text($cmp.foo) + " " + api_dynamic_text($cmp.bar)
)
: null,
]),
];
Copy link
Member Author

@ekashida ekashida Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is due to the fact that parse5 parses template content into a content property, whereas we're parsing it into the childNodes property, hiding it from our own downstream parsing logic.

    _insertTemplate(token) {
        const tmpl = this.treeAdapter.createElement(token.tagName, html_js_1.NS.HTML, token.attrs);
        const content = this.treeAdapter.createDocumentFragment();
        this.treeAdapter.setTemplateContent(tmpl, content);
        this._attachElementToTree(tmpl, token.location);
        this.openElements.push(tmpl, token.tagID);
        if (this.options.sourceCodeLocationInfo)
            this.treeAdapter.setNodeSourceCodeLocation(content, null);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant