"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/lib/badge/badge.ts" between
material2-7.3.3.tar.gz and material2-7.3.4.tar.gz

About: material2 offers Material Design components for Angular.

badge.ts  (material2-7.3.3):badge.ts  (material2-7.3.4)
skipping to change at line 177 skipping to change at line 177
} }
return this._badgeElement; return this._badgeElement;
} }
/** Creates the badge element */ /** Creates the badge element */
private _createBadgeElement(): HTMLElement { private _createBadgeElement(): HTMLElement {
// @breaking-change 8.0.0 Remove null check for _renderer // @breaking-change 8.0.0 Remove null check for _renderer
const rootNode = this._renderer || this._document; const rootNode = this._renderer || this._document;
const badgeElement = rootNode.createElement('span'); const badgeElement = rootNode.createElement('span');
const activeClass = 'mat-badge-active'; const activeClass = 'mat-badge-active';
const contentClass = 'mat-badge-content';
// Clear any existing badges which may have persisted from a server-side ren
der.
this._clearExistingBadges(contentClass);
badgeElement.setAttribute('id', `mat-badge-content-${this._id}`); badgeElement.setAttribute('id', `mat-badge-content-${this._id}`);
badgeElement.classList.add('mat-badge-content'); badgeElement.classList.add(contentClass);
badgeElement.textContent = this.content; badgeElement.textContent = this.content;
if (this.description) { if (this.description) {
badgeElement.setAttribute('aria-label', this.description); badgeElement.setAttribute('aria-label', this.description);
} }
this._elementRef.nativeElement.appendChild(badgeElement); this._elementRef.nativeElement.appendChild(badgeElement);
// animate in after insertion // animate in after insertion
if (typeof requestAnimationFrame === 'function') { if (typeof requestAnimationFrame === 'function') {
skipping to change at line 228 skipping to change at line 231
if (colorPalette !== this._color) { if (colorPalette !== this._color) {
if (this._color) { if (this._color) {
this._elementRef.nativeElement.classList.remove(`mat-badge-${this._color }`); this._elementRef.nativeElement.classList.remove(`mat-badge-${this._color }`);
} }
if (colorPalette) { if (colorPalette) {
this._elementRef.nativeElement.classList.add(`mat-badge-${colorPalette}` ); this._elementRef.nativeElement.classList.add(`mat-badge-${colorPalette}` );
} }
} }
} }
/** Clears any existing badges that might be left over from server-side render
ing. */
private _clearExistingBadges(cssClass: string) {
const element = this._elementRef.nativeElement;
let childCount = element.children.length;
// Use a reverse while, because we'll be removing elements from the list as
we're iterating.
while (childCount--) {
const currentChild = element.children[childCount];
if (currentChild.classList.contains(cssClass)) {
element.removeChild(currentChild);
}
}
}
} }
 End of changes. 4 change blocks. 
1 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)