feat(shadowdom): turn on ShadowDom Emulated Mode by default.
Closes: #526
This commit is contained in:
6
modules/angular2/src/core/application.js
vendored
6
modules/angular2/src/core/application.js
vendored
@ -14,7 +14,7 @@ import {List, ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/facade/async';
|
||||
import {VmTurnZone} from 'angular2/src/core/zone/vm_turn_zone';
|
||||
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
|
||||
import {ShadowDomStrategy, NativeShadowDomStrategy} from 'angular2/src/core/compiler/shadow_dom_strategy';
|
||||
import {ShadowDomStrategy, NativeShadowDomStrategy, EmulatedUnscopedShadowDomStrategy} from 'angular2/src/core/compiler/shadow_dom_strategy';
|
||||
import {XHR} from 'angular2/src/core/compiler/xhr/xhr';
|
||||
import {XHRImpl} from 'angular2/src/core/compiler/xhr/xhr_impl';
|
||||
import {EventManager, DomEventsPlugin} from 'angular2/src/core/events/event_manager';
|
||||
@ -84,7 +84,9 @@ function _injectorBindings(appComponentType): List<Binding> {
|
||||
var plugins = [new HammerGesturesPlugin(), new DomEventsPlugin()];
|
||||
return new EventManager(plugins, zone);
|
||||
}, [VmTurnZone]),
|
||||
bind(ShadowDomStrategy).toClass(NativeShadowDomStrategy),
|
||||
bind(ShadowDomStrategy).toFactory(
|
||||
(styleUrlResolver, doc) => new EmulatedUnscopedShadowDomStrategy(styleUrlResolver, doc.head),
|
||||
[StyleUrlResolver, appDocumentToken]),
|
||||
Compiler,
|
||||
CompilerCache,
|
||||
TemplateResolver,
|
||||
|
@ -36,6 +36,7 @@ export class LightDom {
|
||||
this.lightDomView = lightDomView;
|
||||
this.shadowDomView = shadowDomView;
|
||||
this.nodes = DOM.childNodesAsList(element);
|
||||
|
||||
this.roots = null;
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
|
||||
this._styleHost = styleHost;
|
||||
}
|
||||
|
||||
attachTemplate(el, view:viewModule.View){
|
||||
attachTemplate(el, view:viewModule.View) {
|
||||
DOM.clearNodes(el);
|
||||
_moveViewNodesIntoParent(el, view);
|
||||
}
|
||||
|
@ -80,7 +80,9 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||
return res;
|
||||
}
|
||||
clearNodes(el) {
|
||||
el.innerHTML = '';
|
||||
for (var i = 0; i < el.childNodes.length; i++) {
|
||||
this.remove(el.childNodes[i]);
|
||||
}
|
||||
}
|
||||
appendChild(el, node) {
|
||||
el.appendChild(node);
|
||||
|
Reference in New Issue
Block a user