<commit_before>import {Set} from 'immutable';

import {
    Component, Input, NgModule, ChangeDetectionStrategy, ViewEncapsulation,
    ElementRef, Renderer
} from '@angular/core';
import {CommonModule} from '@angular/common';
import {HttpModule, Http} from '@angular/http';

import {isBlank} from 'caesium-core/lang';

@Component({
    moduleId: module.id,
    selector: 'cs-icon',
    host: {
        '[class]': '_hostClasses.join(" ")'
    },
    template: ` 
    <style>
        :host {
            display: inline-block; 
            font-size: inherit;
            contain: content;
        }
    </style>    
    <span [ngClass]="iconClasses.toObject()"></span>
    `,
    styleUrls: ['./font-awesome.css'],
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class CsIcon {
    @Input() name: string;

    constructor(private _host: ElementRef) {}

    get _hostClasses(): Set<string> {
        if (isBlank(this._host.nativeElement))
            return Set<string>();
        return Set<string>(this._host.nativeElement.classList);
    }

    get iconClasses(): Set<string> {
        return this._hostClasses
            .union(Set.of('fa', `fa-${this.name}`));
    }
}
<commit_msg>Use emulated view encapsulation in cs-icon<commit_after>import {Set} from 'immutable';

import {
    Component, Input,
    ChangeDetectionStrategy,
    ViewEncapsulation,
    ElementRef
} from '@angular/core';

import {isBlank} from 'caesium-core/lang';

@Component({
    moduleId: module.id,
    selector: 'cs-icon',
    host: {
        '[class]': '_hostClasses.join(" ")'
    },
    template: ` 
    <style>
        :host {
            display: inline-block; 
            font-size: inherit;
            contain: content;
        }
    </style>    
    <span [ngClass]="iconClasses.toObject()"></span>
    `,
    changeDetection: ChangeDetectionStrategy.OnPush
})
export class CsIcon {
    @Input() name: string;

    constructor(private _host: ElementRef) {}

    get _hostClasses(): Set<string> {
        if (isBlank(this._host.nativeElement))
            return Set<string>();
        return Set<string>(this._host.nativeElement.classList);
    }

    get iconClasses(): Set<string> {
        return this._hostClasses
            .union(Set.of('fa', `fa-${this.name}`));
    }
}

{'fraction_non_alphanumeric': 0.14623467600700527, 'fraction_numerical': 0.0, 'mean_word_length': 2.6501597444089455, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6510983', 'n_tokens_mistral': 712, 'n_tokens_neox': 705, 'n_words': 144}