Skip to content

Commit

Permalink
refactor(typography): remove the native element selectors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brandyscarney committed Mar 23, 2017
1 parent af6b54c commit 2827275
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/components/typography/typography.ts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 {

Expand All @@ -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>`');
}
}

}

0 comments on commit 2827275

Please sign in to comment.