refactor(render): rename `RenderView` and `RenderProtoView`
Part of #1675 Closes #1705
This commit is contained in:
parent
0b1bb172c9
commit
abc3de7efe
|
@ -131,10 +131,10 @@ export class DirectiveMetadata {
|
|||
}
|
||||
}
|
||||
|
||||
// An opaque reference to a RenderProtoView
|
||||
// An opaque reference to a DomProtoView
|
||||
export class RenderProtoViewRef {}
|
||||
|
||||
// An opaque reference to a RenderView
|
||||
// An opaque reference to a DomView
|
||||
export class RenderViewRef {}
|
||||
|
||||
export class RenderViewContainerRef {
|
||||
|
@ -175,7 +175,7 @@ export class RenderCompiler {
|
|||
createImperativeComponentProtoView(rendererId):Promise<ProtoViewDto> { return null; }
|
||||
|
||||
/**
|
||||
* Compiles a single RenderProtoView. Non recursive so that
|
||||
* Compiles a single DomProtoView. Non recursive so that
|
||||
* we don't need to serialize all possible components over the wire,
|
||||
* but only the needed ones based on previous calls.
|
||||
*/
|
||||
|
@ -186,7 +186,7 @@ export class RenderCompiler {
|
|||
* which will be instantiated when this protoView is instantiated.
|
||||
* Note: We can't create new ProtoViewRefs here as we need to support cycles / recursive components.
|
||||
* @param {List<RenderProtoViewRef>} protoViewRefs
|
||||
* RenderProtoView for every element with a component in this protoView or in a view container's protoView
|
||||
* DomProtoView for every element with a component in this protoView or in a view container's protoView
|
||||
*/
|
||||
mergeChildComponentProtoViews(protoViewRef:RenderProtoViewRef, componentProtoViewRefs:List<RenderProtoViewRef>) { return null; }
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ export class Renderer {
|
|||
/**
|
||||
* This will set the value for a text node.
|
||||
* Note: This needs to be separate from setElementProperty as we don't have ElementBinders
|
||||
* for text nodes in the RenderProtoView either.
|
||||
* for text nodes in the DomProtoView either.
|
||||
*/
|
||||
setText(view:RenderViewRef, textNodeIndex:number, text:string):void {}
|
||||
|
||||
|
|
|
@ -4,8 +4,8 @@ import {List, ListWrapper} from 'angular2/src/facade/collection';
|
|||
import {isBlank, isPresent, BaseException} from 'angular2/src/facade/lang';
|
||||
|
||||
import * as api from '../api';
|
||||
import {RenderView} from './view/view';
|
||||
import {RenderProtoView} from './view/proto_view';
|
||||
import {DomView} from './view/view';
|
||||
import {DomProtoView} from './view/proto_view';
|
||||
import {ViewFactory} from './view/view_factory';
|
||||
import {RenderViewHydrator} from './view/view_hydrator';
|
||||
import {ShadowDomStrategy} from './shadow_dom/shadow_dom_strategy';
|
||||
|
@ -23,7 +23,7 @@ function _resolveProtoView(protoViewRef:DirectDomProtoViewRef) {
|
|||
return isPresent(protoViewRef) ? protoViewRef.delegate : null;
|
||||
}
|
||||
|
||||
function _wrapView(view:RenderView) {
|
||||
function _wrapView(view:DomView) {
|
||||
return new DirectDomViewRef(view);
|
||||
}
|
||||
|
||||
|
@ -44,18 +44,18 @@ function _collectComponentChildViewRefs(view, target = null) {
|
|||
|
||||
// public so that the compiler can use it.
|
||||
export class DirectDomProtoViewRef extends api.RenderProtoViewRef {
|
||||
delegate:RenderProtoView;
|
||||
delegate:DomProtoView;
|
||||
|
||||
constructor(delegate:RenderProtoView) {
|
||||
constructor(delegate:DomProtoView) {
|
||||
super();
|
||||
this.delegate = delegate;
|
||||
}
|
||||
}
|
||||
|
||||
export class DirectDomViewRef extends api.RenderViewRef {
|
||||
delegate:RenderView;
|
||||
delegate:DomView;
|
||||
|
||||
constructor(delegate:RenderView) {
|
||||
constructor(delegate:DomView) {
|
||||
super();
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
|
|
@ -33,11 +33,11 @@ export class EmulatedUnscopedShadowDomStrategy extends ShadowDomStrategy {
|
|||
return false;
|
||||
}
|
||||
|
||||
attachTemplate(el, view:viewModule.RenderView) {
|
||||
attachTemplate(el, view:viewModule.DomView) {
|
||||
moveViewNodesIntoParent(el, view);
|
||||
}
|
||||
|
||||
constructLightDom(lightDomView:viewModule.RenderView, shadowDomView:viewModule.RenderView, el): LightDom {
|
||||
constructLightDom(lightDomView:viewModule.DomView, shadowDomView:viewModule.DomView, el): LightDom {
|
||||
return new LightDom(lightDomView, shadowDomView, el);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,14 +21,14 @@ class _Root {
|
|||
// once interfaces are supported
|
||||
export class LightDom {
|
||||
// The light DOM of the element is enclosed inside the lightDomView
|
||||
lightDomView:viewModule.RenderView;
|
||||
lightDomView:viewModule.DomView;
|
||||
// The shadow DOM
|
||||
shadowDomView:viewModule.RenderView;
|
||||
shadowDomView:viewModule.DomView;
|
||||
// The nodes of the light DOM
|
||||
nodes:List;
|
||||
roots:List<_Root>;
|
||||
|
||||
constructor(lightDomView:viewModule.RenderView, shadowDomView:viewModule.RenderView, element) {
|
||||
constructor(lightDomView:viewModule.DomView, shadowDomView:viewModule.DomView, element) {
|
||||
this.lightDomView = lightDomView;
|
||||
this.shadowDomView = shadowDomView;
|
||||
this.nodes = DOM.childNodesAsList(element);
|
||||
|
@ -45,7 +45,7 @@ export class LightDom {
|
|||
}
|
||||
|
||||
// Collects the Content directives from the view and all its child views
|
||||
_collectAllContentTags(view: viewModule.RenderView, acc:List<Content>):List<Content> {
|
||||
_collectAllContentTags(view: viewModule.DomView, acc:List<Content>):List<Content> {
|
||||
var contentTags = view.contentTags;
|
||||
var vcs = view.viewContainers;
|
||||
for (var i=0; i<vcs.length; i++) {
|
||||
|
|
|
@ -22,7 +22,7 @@ export class NativeShadowDomStrategy extends ShadowDomStrategy {
|
|||
this.styleUrlResolver = styleUrlResolver;
|
||||
}
|
||||
|
||||
attachTemplate(el, view:viewModule.RenderView){
|
||||
attachTemplate(el, view:viewModule.DomView){
|
||||
moveViewNodesIntoParent(DOM.createShadowRoot(el), view);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ export class ShadowDomStrategy {
|
|||
return true;
|
||||
}
|
||||
|
||||
attachTemplate(el, view:viewModule.RenderView) {}
|
||||
attachTemplate(el, view:viewModule.DomView) {}
|
||||
|
||||
constructLightDom(lightDomView:viewModule.RenderView, shadowDomView:viewModule.RenderView, el): LightDom {
|
||||
constructLightDom(lightDomView:viewModule.DomView, shadowDomView:viewModule.DomView, el): LightDom {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import * as protoViewModule from './proto_view';
|
|||
export class ElementBinder {
|
||||
contentTagSelector: string;
|
||||
textNodeIndices: List<number>;
|
||||
nestedProtoView: protoViewModule.RenderProtoView;
|
||||
nestedProtoView: protoViewModule.DomProtoView;
|
||||
eventLocals: AST;
|
||||
localEvents: List<Event>;
|
||||
globalEvents: List<Event>;
|
||||
|
|
|
@ -6,7 +6,7 @@ import {List, Map, ListWrapper, MapWrapper} from 'angular2/src/facade/collection
|
|||
import {ElementBinder} from './element_binder';
|
||||
import {NG_BINDING_CLASS} from '../util';
|
||||
|
||||
export class RenderProtoView {
|
||||
export class DomProtoView {
|
||||
element;
|
||||
elementBinders:List<ElementBinder>;
|
||||
isTemplateElement:boolean;
|
||||
|
@ -30,7 +30,7 @@ export class RenderProtoView {
|
|||
}
|
||||
}
|
||||
|
||||
mergeChildComponentProtoViews(componentProtoViews:List<RenderProtoView>) {
|
||||
mergeChildComponentProtoViews(componentProtoViews:List<DomProtoView>) {
|
||||
var componentProtoViewIndex = 0;
|
||||
for (var i=0; i<this.elementBinders.length; i++) {
|
||||
var eb = this.elementBinders[i];
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
ASTWithSource, AST, AstTransformer, AccessMember, LiteralArray, ImplicitReceiver
|
||||
} from 'angular2/change_detection';
|
||||
|
||||
import {RenderProtoView} from './proto_view';
|
||||
import {DomProtoView} from './proto_view';
|
||||
import {ElementBinder, Event} from './element_binder';
|
||||
import {setterFactory} from './property_setter_factory';
|
||||
|
||||
|
@ -43,7 +43,7 @@ export class ProtoViewBuilder {
|
|||
|
||||
bindVariable(name, value) {
|
||||
// Store the variable map from value to variable, reflecting how it will be used later by
|
||||
// RenderView. When a local is set to the view, a lookup for the variable name will take place keyed
|
||||
// DomView. When a local is set to the view, a lookup for the variable name will take place keyed
|
||||
// by the "value", or exported identifier. For example, ng-repeat sets a view local of "index".
|
||||
// When this occurs, a lookup keyed by "index" must occur to find if there is a var referencing
|
||||
// it.
|
||||
|
@ -102,7 +102,7 @@ export class ProtoViewBuilder {
|
|||
}));
|
||||
});
|
||||
return new api.ProtoViewDto({
|
||||
render: new directDomRenderer.DirectDomProtoViewRef(new RenderProtoView({
|
||||
render: new directDomRenderer.DirectDomProtoViewRef(new DomProtoView({
|
||||
element: this.rootElement,
|
||||
elementBinders: renderElementBinders,
|
||||
imperativeRendererId: this.imperativeRendererId
|
||||
|
@ -192,7 +192,7 @@ export class ElementBinderBuilder {
|
|||
this.nestedProtoView.bindVariable(name, value);
|
||||
} else {
|
||||
// Store the variable map from value to variable, reflecting how it will be used later by
|
||||
// RenderView. When a local is set to the view, a lookup for the variable name will take place keyed
|
||||
// DomView. When a local is set to the view, a lookup for the variable name will take place keyed
|
||||
// by the "value", or exported identifier. For example, ng-repeat sets a view local of "index".
|
||||
// When this occurs, a lookup keyed by "index" must occur to find if there is a var referencing
|
||||
// it.
|
||||
|
|
|
@ -3,7 +3,7 @@ import {ListWrapper, MapWrapper, Map, StringMapWrapper, List} from 'angular2/src
|
|||
import {int, isPresent, isBlank, BaseException} from 'angular2/src/facade/lang';
|
||||
|
||||
import {ViewContainer} from './view_container';
|
||||
import {RenderProtoView} from './proto_view';
|
||||
import {DomProtoView} from './proto_view';
|
||||
import {LightDom} from '../shadow_dom/light_dom';
|
||||
import {Content} from '../shadow_dom/content_tag';
|
||||
|
||||
|
@ -14,7 +14,7 @@ const NG_BINDING_CLASS = 'ng-binding';
|
|||
/**
|
||||
* Const of making objects: http://jsperf.com/instantiate-size-of-object
|
||||
*/
|
||||
export class RenderView {
|
||||
export class DomView {
|
||||
boundElements:List;
|
||||
boundTextNodes:List;
|
||||
/// When the view is part of render tree, the DocumentFragment is empty, which is why we need
|
||||
|
@ -22,21 +22,21 @@ export class RenderView {
|
|||
rootNodes:List;
|
||||
// TODO(tbosch): move componentChildViews, viewContainers, contentTags, lightDoms into
|
||||
// a single array with records inside
|
||||
componentChildViews: List<RenderView>;
|
||||
componentChildViews: List<DomView>;
|
||||
viewContainers: List<ViewContainer>;
|
||||
contentTags: List<Content>;
|
||||
lightDoms: List<LightDom>;
|
||||
hostLightDom: LightDom;
|
||||
proto: RenderProtoView;
|
||||
proto: DomProtoView;
|
||||
hydrated: boolean;
|
||||
_eventDispatcher: any/*EventDispatcher*/;
|
||||
eventHandlerRemovers: List<Function>;
|
||||
/// Host views that were added by an imperative view.
|
||||
/// This is a dynamically growing / shrinking array.
|
||||
imperativeHostViews: List<RenderView>;
|
||||
imperativeHostViews: List<DomView>;
|
||||
|
||||
constructor(
|
||||
proto:RenderProtoView, rootNodes:List,
|
||||
proto:DomProtoView, rootNodes:List,
|
||||
boundTextNodes: List, boundElements:List, contentTags:List) {
|
||||
this.proto = proto;
|
||||
this.rootNodes = rootNodes;
|
||||
|
|
|
@ -5,18 +5,18 @@ import {DOM} from 'angular2/src/dom/dom_adapter';
|
|||
import * as viewModule from './view';
|
||||
|
||||
export class ViewContainer {
|
||||
parentView: viewModule.RenderView;
|
||||
parentView: viewModule.DomView;
|
||||
boundElementIndex: number;
|
||||
views: List<viewModule.RenderView>;
|
||||
views: List<viewModule.DomView>;
|
||||
|
||||
constructor(parentView: viewModule.RenderView, boundElementIndex: number) {
|
||||
constructor(parentView: viewModule.DomView, boundElementIndex: number) {
|
||||
this.parentView = parentView;
|
||||
this.boundElementIndex = boundElementIndex;
|
||||
// The order in this list matches the DOM order.
|
||||
this.views = [];
|
||||
}
|
||||
|
||||
get(index: number): viewModule.RenderView {
|
||||
get(index: number): viewModule.DomView {
|
||||
return this.views[index];
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ export class ViewContainer {
|
|||
}
|
||||
}
|
||||
|
||||
insert(view, atIndex=-1): viewModule.RenderView {
|
||||
insert(view, atIndex=-1): viewModule.DomView {
|
||||
this._checkHydrated();
|
||||
if (atIndex == -1) atIndex = this.views.length;
|
||||
ListWrapper.insert(this.views, atIndex, view);
|
||||
|
|
|
@ -18,7 +18,7 @@ export const VIEW_POOL_CAPACITY = 'render.ViewFactory.viewPoolCapacity';
|
|||
@Injectable()
|
||||
export class ViewFactory {
|
||||
_poolCapacityPerProtoView:number;
|
||||
_pooledViewsPerProtoView:Map<pvModule.RenderProtoView, List<viewModule.RenderView>>;
|
||||
_pooledViewsPerProtoView:Map<pvModule.DomProtoView, List<viewModule.DomView>>;
|
||||
_eventManager:EventManager;
|
||||
_shadowDomStrategy:ShadowDomStrategy;
|
||||
|
||||
|
@ -30,11 +30,11 @@ export class ViewFactory {
|
|||
this._shadowDomStrategy = shadowDomStrategy;
|
||||
}
|
||||
|
||||
createInPlaceHostView(hostElementSelector, hostProtoView:pvModule.RenderProtoView):viewModule.RenderView {
|
||||
createInPlaceHostView(hostElementSelector, hostProtoView:pvModule.DomProtoView):viewModule.DomView {
|
||||
return this._createView(hostProtoView, hostElementSelector);
|
||||
}
|
||||
|
||||
getView(protoView:pvModule.RenderProtoView):viewModule.RenderView {
|
||||
getView(protoView:pvModule.DomProtoView):viewModule.DomView {
|
||||
var pooledViews = MapWrapper.get(this._pooledViewsPerProtoView, protoView);
|
||||
if (isPresent(pooledViews) && pooledViews.length > 0) {
|
||||
return ListWrapper.removeLast(pooledViews);
|
||||
|
@ -42,7 +42,7 @@ export class ViewFactory {
|
|||
return this._createView(protoView, null);
|
||||
}
|
||||
|
||||
returnView(view:viewModule.RenderView) {
|
||||
returnView(view:viewModule.DomView) {
|
||||
if (view.hydrated) {
|
||||
throw new BaseException('View is still hydrated');
|
||||
}
|
||||
|
@ -57,9 +57,9 @@ export class ViewFactory {
|
|||
}
|
||||
}
|
||||
|
||||
_createView(protoView:pvModule.RenderProtoView, inplaceElement): viewModule.RenderView {
|
||||
_createView(protoView:pvModule.DomProtoView, inplaceElement): viewModule.DomView {
|
||||
if (isPresent(protoView.imperativeRendererId)) {
|
||||
return new viewModule.RenderView(
|
||||
return new viewModule.DomView(
|
||||
protoView, [], [], [], []
|
||||
);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ export class ViewFactory {
|
|||
var viewRootNodes;
|
||||
if (protoView.isTemplateElement) {
|
||||
var childNode = DOM.firstChild(DOM.content(rootElementClone));
|
||||
viewRootNodes = []; // TODO(perf): Should be fixed size, since we could pre-compute in in pvModule.RenderProtoView
|
||||
viewRootNodes = []; // TODO(perf): Should be fixed size, since we could pre-compute in in pvModule.DomProtoView
|
||||
// Note: An explicit loop is the fastest way to convert a DOM array into a JS array!
|
||||
while(childNode != null) {
|
||||
ListWrapper.push(viewRootNodes, childNode);
|
||||
|
@ -119,7 +119,7 @@ export class ViewFactory {
|
|||
contentTags[binderIdx] = contentTag;
|
||||
}
|
||||
|
||||
var view = new viewModule.RenderView(
|
||||
var view = new viewModule.DomView(
|
||||
protoView, viewRootNodes,
|
||||
boundTextNodes, boundElements, contentTags
|
||||
);
|
||||
|
@ -154,7 +154,7 @@ export class ViewFactory {
|
|||
// This method is used by the ViewFactory and the ViewHydrator
|
||||
// TODO(tbosch): change shadow dom emulation so that LightDom
|
||||
// instances don't need to be recreated by instead hydrated/dehydrated
|
||||
static setComponentView(shadowDomStrategy:ShadowDomStrategy, hostView:viewModule.RenderView, elementIndex:number, componentView:viewModule.RenderView) {
|
||||
static setComponentView(shadowDomStrategy:ShadowDomStrategy, hostView:viewModule.DomView, elementIndex:number, componentView:viewModule.DomView) {
|
||||
var element = hostView.boundElements[elementIndex];
|
||||
var lightDom = shadowDomStrategy.constructLightDom(hostView, componentView, element);
|
||||
shadowDomStrategy.attachTemplate(element, componentView);
|
||||
|
|
|
@ -32,7 +32,7 @@ export class RenderViewHydrator {
|
|||
this._shadowDomStrategy = shadowDomStrategy;
|
||||
}
|
||||
|
||||
hydrateDynamicComponentView(hostView:viewModule.RenderView, boundElementIndex:number, componentView:viewModule.RenderView) {
|
||||
hydrateDynamicComponentView(hostView:viewModule.DomView, boundElementIndex:number, componentView:viewModule.DomView) {
|
||||
ViewFactory.setComponentView(this._shadowDomStrategy, hostView, boundElementIndex, componentView);
|
||||
var lightDom = hostView.lightDoms[boundElementIndex];
|
||||
this._viewHydrateRecurse(componentView, lightDom);
|
||||
|
@ -41,7 +41,7 @@ export class RenderViewHydrator {
|
|||
}
|
||||
}
|
||||
|
||||
dehydrateDynamicComponentView(parentView:viewModule.RenderView, boundElementIndex:number) {
|
||||
dehydrateDynamicComponentView(parentView:viewModule.DomView, boundElementIndex:number) {
|
||||
throw new BaseException('Not supported yet');
|
||||
// Something along these lines:
|
||||
// var componentView = parentView.componentChildViews[boundElementIndex];
|
||||
|
@ -51,14 +51,14 @@ export class RenderViewHydrator {
|
|||
// this._viewDehydrateRecurse(componentView);
|
||||
}
|
||||
|
||||
hydrateInPlaceHostView(parentView:viewModule.RenderView, hostView:viewModule.RenderView) {
|
||||
hydrateInPlaceHostView(parentView:viewModule.DomView, hostView:viewModule.DomView) {
|
||||
if (isPresent(parentView)) {
|
||||
ListWrapper.push(parentView.imperativeHostViews, hostView);
|
||||
}
|
||||
this._viewHydrateRecurse(hostView, null);
|
||||
}
|
||||
|
||||
dehydrateInPlaceHostView(parentView:viewModule.RenderView, hostView:viewModule.RenderView) {
|
||||
dehydrateInPlaceHostView(parentView:viewModule.DomView, hostView:viewModule.DomView) {
|
||||
if (isPresent(parentView)) {
|
||||
ListWrapper.remove(parentView.imperativeHostViews, hostView);
|
||||
}
|
||||
|
@ -67,11 +67,11 @@ export class RenderViewHydrator {
|
|||
this._viewDehydrateRecurse(hostView);
|
||||
}
|
||||
|
||||
hydrateViewInViewContainer(viewContainer:vcModule.ViewContainer, view:viewModule.RenderView) {
|
||||
hydrateViewInViewContainer(viewContainer:vcModule.ViewContainer, view:viewModule.DomView) {
|
||||
this._viewHydrateRecurse(view, viewContainer.parentView.hostLightDom);
|
||||
}
|
||||
|
||||
dehydrateViewInViewContainer(viewContainer:vcModule.ViewContainer, view:viewModule.RenderView) {
|
||||
dehydrateViewInViewContainer(viewContainer:vcModule.ViewContainer, view:viewModule.DomView) {
|
||||
this._viewDehydrateRecurse(view);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import {
|
|||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {StyleUrlResolver} from 'angular2/src/render/dom/shadow_dom/style_url_resolver';
|
||||
import {StyleInliner} from 'angular2/src/render/dom/shadow_dom/style_inliner';
|
||||
import {RenderView} from 'angular2/src/render/dom/view/view';
|
||||
import {DomView} from 'angular2/src/render/dom/view/view';
|
||||
|
||||
export function main() {
|
||||
describe('EmulatedScopedShadowDomStrategy', () => {
|
||||
|
@ -48,7 +48,7 @@ export function main() {
|
|||
var host = el('<div><span>original content</span></div>');
|
||||
var originalChild = DOM.childNodes(host)[0];
|
||||
var nodes = el('<div>view</div>');
|
||||
var view = new RenderView(null, [nodes], [], [], []);
|
||||
var view = new DomView(null, [nodes], [], [], []);
|
||||
|
||||
strategy.attachTemplate(host, view);
|
||||
expect(DOM.childNodes(host)[0]).toBe(originalChild);
|
||||
|
|
|
@ -23,7 +23,7 @@ import {
|
|||
} from 'angular2/src/render/dom/shadow_dom/util';
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {StyleUrlResolver} from 'angular2/src/render/dom/shadow_dom/style_url_resolver';
|
||||
import {RenderView} from 'angular2/src/render/dom/view/view';
|
||||
import {DomView} from 'angular2/src/render/dom/view/view';
|
||||
|
||||
export function main() {
|
||||
var strategy;
|
||||
|
@ -43,7 +43,7 @@ export function main() {
|
|||
var host = el('<div><span>original content</span></div>');
|
||||
var originalChild = DOM.childNodes(host)[0];
|
||||
var nodes = el('<div>view</div>');
|
||||
var view = new RenderView(null, [nodes], [], [], []);
|
||||
var view = new DomView(null, [nodes], [], [], []);
|
||||
|
||||
strategy.attachTemplate(host, view);
|
||||
expect(DOM.childNodes(host)[0]).toBe(originalChild);
|
||||
|
|
|
@ -4,11 +4,11 @@ import {ListWrapper, MapWrapper} from 'angular2/src/facade/collection';
|
|||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
import {Content} from 'angular2/src/render/dom/shadow_dom/content_tag';
|
||||
import {LightDom} from 'angular2/src/render/dom/shadow_dom/light_dom';
|
||||
import {RenderView} from 'angular2/src/render/dom/view/view';
|
||||
import {DomView} from 'angular2/src/render/dom/view/view';
|
||||
import {ViewContainer} from 'angular2/src/render/dom/view/view_container';
|
||||
|
||||
@proxy
|
||||
@IMPLEMENTS(RenderView)
|
||||
@IMPLEMENTS(DomView)
|
||||
class FakeView {
|
||||
boundElements;
|
||||
contentTags;
|
||||
|
|
|
@ -17,7 +17,7 @@ import {
|
|||
} from 'angular2/src/render/dom/shadow_dom/native_shadow_dom_strategy';
|
||||
import {UrlResolver} from 'angular2/src/services/url_resolver';
|
||||
import {StyleUrlResolver} from 'angular2/src/render/dom/shadow_dom/style_url_resolver';
|
||||
import {RenderView} from 'angular2/src/render/dom/view/view';
|
||||
import {DomView} from 'angular2/src/render/dom/view/view';
|
||||
|
||||
import {isPresent, isBlank} from 'angular2/src/facade/lang';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
@ -35,7 +35,7 @@ export function main() {
|
|||
it('should attach the view nodes to the shadow root', () => {
|
||||
var host = el('<div><span>original content</span></div>');
|
||||
var nodes = el('<div>view</div>');
|
||||
var view = new RenderView(null, [nodes], [], [], []);
|
||||
var view = new DomView(null, [nodes], [], [], []);
|
||||
|
||||
strategy.attachTemplate(host, view);
|
||||
var shadowRoot = DOM.getShadowRoot(host);
|
||||
|
|
|
@ -17,8 +17,8 @@ import {
|
|||
import {IMPLEMENTS, isBlank} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
import {ViewFactory} from 'angular2/src/render/dom/view/view_factory';
|
||||
import {RenderProtoView} from 'angular2/src/render/dom/view/proto_view';
|
||||
import {RenderView} from 'angular2/src/render/dom/view/view';
|
||||
import {DomProtoView} from 'angular2/src/render/dom/view/proto_view';
|
||||
import {DomView} from 'angular2/src/render/dom/view/view';
|
||||
import {ElementBinder} from 'angular2/src/render/dom/view/element_binder';
|
||||
import {ShadowDomStrategy} from 'angular2/src/render/dom/shadow_dom/shadow_dom_strategy';
|
||||
import {LightDom} from 'angular2/src/render/dom/shadow_dom/light_dom'
|
||||
|
@ -40,7 +40,7 @@ export function main() {
|
|||
if (isBlank(binders)) {
|
||||
binders = [];
|
||||
}
|
||||
return new RenderProtoView({
|
||||
return new DomProtoView({
|
||||
element: rootEl,
|
||||
elementBinders: binders
|
||||
});
|
||||
|
@ -66,7 +66,7 @@ export function main() {
|
|||
var vf = createViewFactory({
|
||||
capacity: 0
|
||||
});
|
||||
expect(vf.getView(pv) instanceof RenderView).toBe(true);
|
||||
expect(vf.getView(pv) instanceof DomView).toBe(true);
|
||||
});
|
||||
|
||||
describe('caching', () => {
|
||||
|
|
|
@ -16,9 +16,9 @@ import {
|
|||
} from 'angular2/test_lib';
|
||||
import {IMPLEMENTS, isBlank, isPresent} from 'angular2/src/facade/lang';
|
||||
|
||||
import {RenderProtoView} from 'angular2/src/render/dom/view/proto_view';
|
||||
import {DomProtoView} from 'angular2/src/render/dom/view/proto_view';
|
||||
import {ElementBinder} from 'angular2/src/render/dom/view/element_binder';
|
||||
import {RenderView} from 'angular2/src/render/dom/view/view';
|
||||
import {DomView} from 'angular2/src/render/dom/view/view';
|
||||
import {ShadowDomStrategy} from 'angular2/src/render/dom/shadow_dom/shadow_dom_strategy';
|
||||
import {LightDom} from 'angular2/src/render/dom/shadow_dom/light_dom';
|
||||
import {EventManager} from 'angular2/src/render/dom/events/event_manager';
|
||||
|
@ -41,7 +41,7 @@ export function main() {
|
|||
if (isBlank(binders)) {
|
||||
binders = [];
|
||||
}
|
||||
return new RenderProtoView({
|
||||
return new DomProtoView({
|
||||
element: rootEl,
|
||||
elementBinders: binders
|
||||
});
|
||||
|
@ -69,12 +69,12 @@ export function main() {
|
|||
|
||||
function createEmptyView() {
|
||||
var root = el('<div><div></div></div>');
|
||||
return new RenderView(createProtoView(), [DOM.childNodes(root)[0]],
|
||||
return new DomView(createProtoView(), [DOM.childNodes(root)[0]],
|
||||
[], [], []);
|
||||
}
|
||||
|
||||
function createHostView(pv, shadowDomView) {
|
||||
var view = new RenderView(pv, [el('<div></div>')],
|
||||
var view = new DomView(pv, [el('<div></div>')],
|
||||
[], [el('<div></div>')], [null]);
|
||||
ViewFactory.setComponentView(shadowDomStrategy, view, 0, shadowDomView);
|
||||
return view;
|
||||
|
|
|
@ -17,22 +17,22 @@ import {
|
|||
import {IMPLEMENTS, isBlank} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
|
||||
import {RenderProtoView} from 'angular2/src/render/dom/view/proto_view';
|
||||
import {DomProtoView} from 'angular2/src/render/dom/view/proto_view';
|
||||
import {ElementBinder} from 'angular2/src/render/dom/view/element_binder';
|
||||
import {RenderView} from 'angular2/src/render/dom/view/view';
|
||||
import {DomView} from 'angular2/src/render/dom/view/view';
|
||||
import {ViewContainer} from 'angular2/src/render/dom/view/view_container';
|
||||
import {LightDom} from 'angular2/src/render/dom/shadow_dom/light_dom';
|
||||
import {DOM} from 'angular2/src/dom/dom_adapter';
|
||||
|
||||
export function main() {
|
||||
|
||||
describe('RenderView', () => {
|
||||
describe('DomView', () => {
|
||||
function createProtoView(binders = null) {
|
||||
if (isBlank(binders)) {
|
||||
binders = [];
|
||||
}
|
||||
var rootEl = el('<div></div>');
|
||||
return new RenderProtoView({
|
||||
return new DomProtoView({
|
||||
element: rootEl,
|
||||
elementBinders: binders
|
||||
});
|
||||
|
@ -47,7 +47,7 @@ export function main() {
|
|||
for (var i=0; i<boundElementCount; i++) {
|
||||
ListWrapper.push(boundElements, el('<span></span'));
|
||||
}
|
||||
return new RenderView(pv, [DOM.childNodes(root)[0]],
|
||||
return new DomView(pv, [DOM.childNodes(root)[0]],
|
||||
[], boundElements, []);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue