mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
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.
This commit is contained in:
@ -1,11 +1,10 @@
|
||||
import { Attribute, Directive, ElementRef, Input, Renderer } from '@angular/core';
|
||||
import { Directive, ElementRef, Input, Renderer } from '@angular/core';
|
||||
|
||||
import { Config } from '../../config/config';
|
||||
import { Ion } from '../ion';
|
||||
|
||||
|
||||
/**
|
||||
* @hidden TODO remove this line when we remove the other selectors in order to document it
|
||||
* @name Typography
|
||||
* @module ionic
|
||||
* @description
|
||||
@ -47,7 +46,7 @@ import { Ion } from '../ion';
|
||||
*
|
||||
*/
|
||||
@Directive({
|
||||
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]'
|
||||
selector: '[ion-text]'
|
||||
})
|
||||
export class Typography extends Ion {
|
||||
|
||||
@ -71,14 +70,8 @@ export class Typography extends Ion {
|
||||
this._setMode(val);
|
||||
}
|
||||
|
||||
constructor(config: Config, elementRef: ElementRef, renderer: Renderer, @Attribute('ion-text') ionText: string) {
|
||||
constructor(config: Config, elementRef: ElementRef, renderer: Renderer) {
|
||||
super(config, elementRef, renderer, 'text');
|
||||
|
||||
// TODO: Deprecated: all selectors besides `[ion-text]` rc.3
|
||||
// Remove all other selectors and the `ionText` attribute
|
||||
if (ionText === null) {
|
||||
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>`');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user