-
-
Notifications
You must be signed in to change notification settings - Fork 622
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
Injecting Element do not work with @templateController #1011
Comments
I have figured out that bind(bindingContext, overrideContext) {
let newContext = { };
overrideContext = createOverrideContext(newContext, overrideContext);
if (!this.view) {
this.view = this.factory.create();
this.view.bind(newContext, overrideContext);
this.slot.add(this.view);
} else {
this.view.bind(newContext, overrideContext);
}
this.element = this.view.firstChild;
} |
This is not correct way to store DOM element reference in template controller custom attribute. bind(bindingContext, overrideContext) {
let newContext = { };
let overrideContext = createOverrideContext(newContext, overrideContext);
if (!this.view) {
this.view = this.factory.create();
this.view.bind(newContext, overrideContext);
this.slot.add(this.view);
} else {
this.view.bind(newContext, overrideContext);
}
// Retrieve DOM elements
const elements = [];
let element = view.firstChild;
if (element instanceof Element) {
elements.push(element);
}
while (element && element != view.lastChild) {
element = element.nextSibling;
if (element && (element instanceof Element)) {
elements.push(element);
}
}
this.elements = elements;
} |
The above code is not correct too. It do not listen for changes in child view. |
I'm submitting a bug report
1.4.1
Please tell us about your environment:
Operating System:
Windows 11
Node Version:
18.17.0
10.9.0
CLI 3.0.3 | webpack 5.95.0
Browser:
Chrome 131
Language:
ESNext
Current behavior:
and
do not work together for custom attribute.
<!--anchor-->
Coment
element is passed to constructor instead of actual DOM element:https://gist.run/?id=6a2ce66ed37b552dcfd2614d76cbe8fa&sha=531b9a54616b6b872e3e7d0eb498d6e8af00487a
There should be the way to access DOM element and extend child context using custom attribute.
The text was updated successfully, but these errors were encountered: