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

SC.Object.reopen does not honor concatenatedProperties #1479

Open
mauritslamers opened this issue Jan 11, 2023 · 0 comments
Open

SC.Object.reopen does not honor concatenatedProperties #1479

mauritslamers opened this issue Jan 11, 2023 · 0 comments

Comments

@mauritslamers
Copy link
Member

mauritslamers commented Jan 11, 2023

The SproutCore OO system has a system called concatenated properties, which allows certain properties to be appended to when extending or creating. One such example is the displayProperties on SC.View, and concatenatedProperties itself.

However, when SC.Object.reopen is used, any properties that are defined in the concatenatedProperties property or in the concatenatedProperties array itself are removed from the extensions hash.
This leads to unexpected results when using reopen(), such as that certain properties will suddenly disappear or not being considered when using reopen multiple times.

The example below uses the attributeBindings property, which is defined as part of the concatenatedProperties array in SC.View.

SC.View.reopen({

  attributeBindings: ['test'],

  test: 'somevalue',
});

SC.View.reopen({
  attributeBindings: ['test2'],

  test2: 'someothervalue',

});

// when inspecting the SC.View.prototype:
>> SC.View.prototype
{
...
attributeBindings: ['test'],
...
}
// expected result
>> SC.View.prototype
{
...
attributeBindings: ['test', 'test2'],
...
}
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

No branches or pull requests

1 participant