Skip to content

Subclasses of $.Observe are not applied to attribute values #145

Description

@jeffrose

When you set attribute values in a subclass of $.Observe, $.Observe is applied to those values, not the subclass.

var
    // Subclass $.Observe to add functionality
    MyObserve = $.Observe( {
        myMethod: function(){
            console.log( 'myMethod' );
        }
    } ),

    // Create an instance of my subclass
    mo = new MyObserve( {} );

mo.myMethod(); //--> 'myMethod'

mo.attr( 'foo', { foo: { bar: { qux: 'baz' } } } );

// mo.attr( 'foo' ) is $.Observe not MyObserve
mo.attr( 'foo' ).myMethod(); // ERROR

Glancing through can.Observe, it looks like this is an issue in CanJS as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions