Skip to content
This repository has been archived by the owner on Jul 30, 2018. It is now read-only.

The incorrect scope is being bound to DNodes that are passed as children to a widget. #633

Closed
bitpshr opened this issue Aug 15, 2017 · 0 comments
Assignees
Milestone

Comments

@bitpshr
Copy link
Member

bitpshr commented Aug 15, 2017

Bug

DNodes that are passed as children to a widget are being bound to the incorrect scope. They are being bound to the scope of the widget that they are passed to rather then the widget that they are defined.

This is a result of the changes to decrease the number of iterations that are being performed in WidgetBase but the this caused the subtle change to the scope that the nodes are being bound to.

Package Version: latest

Code

class MyWidget extends WidgetBase {
    private _message = 'hello button';

    onClick() {
        alert(this._message);
    }

    render() {
        const child = v('button', { onclick: this.onClick }, [ 'button' ]);

        return w(WidgetBase, {}, [ child ]);
    }
}

const Projector = ProjectorMixin(MyWidget);
const projector = new Projector();

projector.append();

Expected behavior:

The alert message is 'hello button'

Actual behavior:

The alert message is undefined.

@eheasley eheasley added the beta2 label Aug 15, 2017
@eheasley eheasley added this to the 2017.08 milestone Aug 15, 2017
@agubler agubler changed the title Function properties are not present The incorrect scope is being bound to DNodes that are passed as children to a widget. Aug 16, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants