Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit 779ccb8

Browse files
committed
feat(directives): Add deprecated warning to applyAuthorStyle, resetStyleInheritance
Closes #838 For #801
1 parent 87ecddb commit 779ccb8

File tree

3 files changed

+29
-96
lines changed

3 files changed

+29
-96
lines changed

lib/core/annotation.dart

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,9 @@ abstract class NgAnnotation {
188188
}
189189

190190

191+
bool _applyAuthorStylesDeprecationWarningPrinted = false;
192+
bool _resetStyleInheritanceDeprecationWarningPrinted = false;
193+
191194
/**
192195
* Meta-data marker placed on a class which should act as a controller for the
193196
* component. Angular components are a light-weight version of web-components.
@@ -224,14 +227,34 @@ class NgComponent extends NgAnnotation {
224227
/**
225228
* Set the shadow root applyAuthorStyles property. See shadow-DOM
226229
* documentation for further details.
230+
*
231+
* This feature will be removed in Chrome 35.
227232
*/
228-
final bool applyAuthorStyles;
233+
@deprecated
234+
bool get applyAuthorStyles {
235+
if (!_applyAuthorStylesDeprecationWarningPrinted && _applyAuthorStyles == true) {
236+
print("WARNING applyAuthorStyles is deprecated in component $selector");
237+
_applyAuthorStylesDeprecationWarningPrinted = true;
238+
}
239+
return _applyAuthorStyles;
240+
}
241+
final bool _applyAuthorStyles;
229242

230243
/**
231244
* Set the shadow root resetStyleInheritance property. See shadow-DOM
232245
* documentation for further details.
246+
*
247+
* This feature will be removed in Chrome 35.
233248
*/
234-
final bool resetStyleInheritance;
249+
@deprecated
250+
bool get resetStyleInheritance {
251+
if (!_resetStyleInheritanceDeprecationWarningPrinted && _resetStyleInheritance == true) {
252+
print("WARNING resetStyleInheritance is deprecated in component $selector");
253+
_resetStyleInheritanceDeprecationWarningPrinted = true;
254+
}
255+
return _resetStyleInheritance;
256+
}
257+
final bool _resetStyleInheritance;
235258

236259
/**
237260
* An expression under which the component's controller instance will be
@@ -244,8 +267,8 @@ class NgComponent extends NgAnnotation {
244267
this.template,
245268
this.templateUrl,
246269
cssUrl,
247-
this.applyAuthorStyles,
248-
this.resetStyleInheritance,
270+
applyAuthorStyles,
271+
resetStyleInheritance,
249272
this.publishAs,
250273
module,
251274
map,
@@ -254,6 +277,8 @@ class NgComponent extends NgAnnotation {
254277
exportExpressions,
255278
exportExpressionAttrs})
256279
: _cssUrls = cssUrl,
280+
_applyAuthorStyles = applyAuthorStyles,
281+
_resetStyleInheritance = resetStyleInheritance,
257282
super(selector: selector,
258283
children: NgAnnotation.COMPILE_CHILDREN,
259284
visibility: visibility,

test/core/core_directive_spec.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ void main() {
2323
expect(annotation.template).toEqual('template');
2424
expect(annotation.templateUrl).toEqual('templateUrl');
2525
expect(annotation.cssUrls).toEqual(['cssUrls']);
26-
expect(annotation.applyAuthorStyles).toEqual(true);
27-
expect(annotation.resetStyleInheritance).toEqual(true);
2826
expect(annotation.publishAs).toEqual('ctrl');
2927
expect(annotation.map).toEqual({
3028
'foo': '=>foo',
@@ -83,8 +81,6 @@ class NullParser implements Parser {
8381
template: 'template',
8482
templateUrl: 'templateUrl',
8583
cssUrl: const ['cssUrls'],
86-
applyAuthorStyles: true,
87-
resetStyleInheritance: true,
8884
publishAs: 'ctrl',
8985
module: AnnotatedIoComponent.module,
9086
visibility: NgDirective.LOCAL_VISIBILITY,

test/core_dom/shadow_root_options_spec.dart

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)