Skip to content

Commit 2827275

Browse files
committed
refactor(typography): remove the native element selectors
BREAKING CHANGES: The following selectors to style the text color of the native text elements have been removed: ``` h1[color], h2[color], h3[color], h4[color], h5[color], h6[color], a[color]:not([ion-button]):not([ion-item]):not([ion-fab]), p[color], span[color], b[color], i[color], strong[color], em[color], small[color], sub[color], sup[color] ``` These have been throwing a deprecation warning since rc.3 but still working. They are officially gone and therefore these elements will not get the color unless the `ion-text` attribute is added. Please see the documentation.
1 parent af6b54c commit 2827275

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/components/typography/typography.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { Attribute, Directive, ElementRef, Input, Renderer } from '@angular/core';
1+
import { Directive, ElementRef, Input, Renderer } from '@angular/core';
22

33
import { Config } from '../../config/config';
44
import { Ion } from '../ion';
55

66

77
/**
8-
* @hidden TODO remove this line when we remove the other selectors in order to document it
98
* @name Typography
109
* @module ionic
1110
* @description
@@ -47,7 +46,7 @@ import { Ion } from '../ion';
4746
*
4847
*/
4948
@Directive({
50-
selector: 'h1[color], h2[color], h3[color], h4[color], h5[color], h6[color], a[color]:not([ion-button]):not([ion-item]):not([ion-fab]), p[color], span[color], b[color], i[color], strong[color], em[color], small[color], sub[color], sup[color], [ion-text]'
49+
selector: '[ion-text]'
5150
})
5251
export class Typography extends Ion {
5352

@@ -71,14 +70,8 @@ export class Typography extends Ion {
7170
this._setMode(val);
7271
}
7372

74-
constructor(config: Config, elementRef: ElementRef, renderer: Renderer, @Attribute('ion-text') ionText: string) {
73+
constructor(config: Config, elementRef: ElementRef, renderer: Renderer) {
7574
super(config, elementRef, renderer, 'text');
76-
77-
// TODO: Deprecated: all selectors besides `[ion-text]` rc.3
78-
// Remove all other selectors and the `ionText` attribute
79-
if (ionText === null) {
80-
console.warn('Deprecated: The color input has been removed from HTML elements. Please add the `ion-text` attribute in order to use the color input. For example: `<a ion-text color="secondary">Link</a>`');
81-
}
8275
}
8376

8477
}

0 commit comments

Comments
 (0)