Revert "fix(elements): correctly handle getting/setting properties before connecting the element (#36114)"
This reverts commit 363f14c8939461e21a1c2a23cce42066d0a6cee5 because it is causing the side effects test to break on the 9.1.x branch.
This commit is contained in:
parent
4e2500278c
commit
19313f7dad
@ -187,15 +187,9 @@ export function createCustomElement<P>(
|
||||
inputs.map(({propName}) => propName).forEach(property => {
|
||||
Object.defineProperty(NgElementImpl.prototype, property, {
|
||||
get: function() {
|
||||
if (!this.ngElementStrategy) {
|
||||
this.ngElementStrategy = strategyFactory.create(config.injector);
|
||||
}
|
||||
return this.ngElementStrategy.getInputValue(property);
|
||||
},
|
||||
set: function(newValue: any) {
|
||||
if (!this.ngElementStrategy) {
|
||||
this.ngElementStrategy = strategyFactory.create(config.injector);
|
||||
}
|
||||
this.ngElementStrategy.setInputValue(property, newValue);
|
||||
},
|
||||
configurable: true,
|
||||
|
@ -94,22 +94,6 @@ if (browserDetection.supportsCustomElements) {
|
||||
expect(strategy.inputs.get('fooFoo')).toBe('foo-foo-value');
|
||||
expect(strategy.inputs.get('barBar')).toBe('barBar-value');
|
||||
});
|
||||
|
||||
it('should properly handle getting/setting properties on the element even if the constructor is not called',
|
||||
() => {
|
||||
// Create a custom element while ensuring that the `NgElementStrategy` is not created
|
||||
// inside the constructor. This is done to emulate the behavior of some polyfills that do
|
||||
// not call the constructor.
|
||||
strategyFactory.create = () => undefined as unknown as NgElementStrategy;
|
||||
const element = new NgElementCtor(injector);
|
||||
strategyFactory.create = TestStrategyFactory.prototype.create;
|
||||
|
||||
element.fooFoo = 'foo-foo-value';
|
||||
element.barBar = 'barBar-value';
|
||||
|
||||
expect(strategy.inputs.get('fooFoo')).toBe('foo-foo-value');
|
||||
expect(strategy.inputs.get('barBar')).toBe('barBar-value');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user