@@ -5,7 +5,7 @@ import {CompileControl} from './compile_control';
55import { DirectiveMetadata } from 'angular2/src/core/compiler/directive_metadata' ;
66import { ShadowDomStrategy } from 'angular2/src/core/compiler/shadow_dom_strategy' ;
77
8- import { DOM , Element } from 'angular2/src/facade/dom' ;
8+ import { DOM , Element , StyleElement } from 'angular2/src/facade/dom' ;
99import { isPresent , isBlank , Type } from 'angular2/src/facade/lang' ;
1010
1111export class ShimShadowCss extends CompileStep {
@@ -27,23 +27,24 @@ export class ShimShadowCss extends CompileStep {
2727 if ( DOM . tagName ( current . element ) == 'STYLE' ) {
2828 current . ignoreBindings = true ;
2929 if ( this . _strategy . extractStyles ( ) ) {
30- DOM . remove ( current . element ) ;
31- var css = DOM . getText ( current . element ) ;
30+ var styleEl = current . element ;
31+ DOM . remove ( styleEl ) ;
32+ var css = DOM . getText ( styleEl ) ;
3233 var shimComponent = this . _strategy . getShimComponent ( this . _component ) ;
3334 css = shimComponent . shimCssText ( css ) ;
34- this . _insertStyle ( this . _styleHost , css ) ;
35+ DOM . setText ( styleEl , css ) ;
36+ this . _insertStyle ( this . _styleHost , styleEl ) ;
3537 }
3638 }
3739 }
3840
39- _insertStyle ( el : Element , css : string ) {
40- var style = DOM . createStyleElement ( css ) ;
41+ _insertStyle ( host : Element , style : StyleElement ) {
4142 if ( isBlank ( this . _lastInsertedStyle ) ) {
42- var firstChild = DOM . firstChild ( el ) ;
43+ var firstChild = DOM . firstChild ( host ) ;
4344 if ( isPresent ( firstChild ) ) {
4445 DOM . insertBefore ( firstChild , style ) ;
4546 } else {
46- DOM . appendChild ( el , style ) ;
47+ DOM . appendChild ( host , style ) ;
4748 }
4849 } else {
4950 DOM . insertAfter ( this . _lastInsertedStyle , style ) ;
0 commit comments