fix(deps): Update clang-format to 1.0.14.
This commit is contained in:
parent
e50f537667
commit
15f1eb28a2
@ -144,13 +144,13 @@ function _createNgZone(givenReporter: Function): NgZone {
|
|||||||
var longStackTrace = ListWrapper.join(stackTrace, "\n\n-----async gap-----\n");
|
var longStackTrace = ListWrapper.join(stackTrace, "\n\n-----async gap-----\n");
|
||||||
DOM.logError(`${exception}\n\n${longStackTrace}`);
|
DOM.logError(`${exception}\n\n${longStackTrace}`);
|
||||||
throw exception;
|
throw exception;
|
||||||
};
|
};
|
||||||
|
|
||||||
var reporter = isPresent(givenReporter) ? givenReporter : defaultErrorReporter;
|
var reporter = isPresent(givenReporter) ? givenReporter : defaultErrorReporter;
|
||||||
|
|
||||||
var zone = new NgZone({enableLongStackTrace: assertionsEnabled()});
|
var zone = new NgZone({enableLongStackTrace: assertionsEnabled()});
|
||||||
zone.initCallbacks({onErrorHandler: reporter});
|
zone.initCallbacks({onErrorHandler: reporter});
|
||||||
return zone;
|
return zone;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,9 +175,8 @@ export class Compiler {
|
|||||||
var nestedPVPromises = [];
|
var nestedPVPromises = [];
|
||||||
ListWrapper.forEach(this._collectComponentElementBinders(protoViews), (elementBinder) => {
|
ListWrapper.forEach(this._collectComponentElementBinders(protoViews), (elementBinder) => {
|
||||||
var nestedComponent = elementBinder.componentDirective;
|
var nestedComponent = elementBinder.componentDirective;
|
||||||
var elementBinderDone = (nestedPv: AppProtoView) => {
|
var elementBinderDone =
|
||||||
elementBinder.nestedProtoView = nestedPv;
|
(nestedPv: AppProtoView) => { elementBinder.nestedProtoView = nestedPv; };
|
||||||
};
|
|
||||||
var nestedCall = this._compile(nestedComponent);
|
var nestedCall = this._compile(nestedComponent);
|
||||||
if (PromiseWrapper.isPromise(nestedCall)) {
|
if (PromiseWrapper.isPromise(nestedCall)) {
|
||||||
ListWrapper.push(nestedPVPromises,
|
ListWrapper.push(nestedPVPromises,
|
||||||
@ -192,9 +191,9 @@ export class Compiler {
|
|||||||
} else {
|
} else {
|
||||||
return protoView;
|
return protoView;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private _collectComponentElementBinders(protoViews: List<AppProtoView>): List<ElementBinder> {
|
private _collectComponentElementBinders(protoViews: List<AppProtoView>): List<ElementBinder> {
|
||||||
var componentElementBinders = [];
|
var componentElementBinders = [];
|
||||||
ListWrapper.forEach(protoViews, (protoView) => {
|
ListWrapper.forEach(protoViews, (protoView) => {
|
||||||
ListWrapper.forEach(protoView.elementBinders, (elementBinder) => {
|
ListWrapper.forEach(protoView.elementBinders, (elementBinder) => {
|
||||||
@ -204,9 +203,9 @@ private _collectComponentElementBinders(protoViews: List<AppProtoView>): List<El
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
return componentElementBinders;
|
return componentElementBinders;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _buildRenderTemplate(component, view, directives): renderApi.ViewDefinition {
|
private _buildRenderTemplate(component, view, directives): renderApi.ViewDefinition {
|
||||||
var componentUrl =
|
var componentUrl =
|
||||||
this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component));
|
this._urlResolver.resolve(this._appUrl, this._componentUrlMapper.getUrl(component));
|
||||||
var templateAbsUrl = null;
|
var templateAbsUrl = null;
|
||||||
@ -223,18 +222,18 @@ private _buildRenderTemplate(component, view, directives): renderApi.ViewDefinit
|
|||||||
absUrl: templateAbsUrl, template: view.template,
|
absUrl: templateAbsUrl, template: view.template,
|
||||||
directives: ListWrapper.map(directives, directiveBinding => directiveBinding.metadata)
|
directives: ListWrapper.map(directives, directiveBinding => directiveBinding.metadata)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _flattenDirectives(template: View): List<Type> {
|
private _flattenDirectives(template: View): List<Type> {
|
||||||
if (isBlank(template.directives)) return [];
|
if (isBlank(template.directives)) return [];
|
||||||
|
|
||||||
var directives = [];
|
var directives = [];
|
||||||
this._flattenList(template.directives, directives);
|
this._flattenList(template.directives, directives);
|
||||||
|
|
||||||
return directives;
|
return directives;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _flattenList(tree: List<any>, out: List<Type | Binding | List<any>>): void {
|
private _flattenList(tree: List<any>, out: List<Type | Binding | List<any>>): void {
|
||||||
for (var i = 0; i < tree.length; i++) {
|
for (var i = 0; i < tree.length; i++) {
|
||||||
var item = resolveForwardRef(tree[i]);
|
var item = resolveForwardRef(tree[i]);
|
||||||
if (ListWrapper.isList(item)) {
|
if (ListWrapper.isList(item)) {
|
||||||
@ -243,16 +242,16 @@ private _flattenList(tree: List<any>, out: List<Type | Binding | List<any>>): vo
|
|||||||
ListWrapper.push(out, item);
|
ListWrapper.push(out, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static _isValidDirective(value: Type | Binding): boolean {
|
private static _isValidDirective(value: Type | Binding): boolean {
|
||||||
return isPresent(value) && (value instanceof Type || value instanceof Binding);
|
return isPresent(value) && (value instanceof Type || value instanceof Binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static _assertTypeIsComponent(directiveBinding: DirectiveBinding): void {
|
private static _assertTypeIsComponent(directiveBinding: DirectiveBinding): void {
|
||||||
if (directiveBinding.metadata.type !== renderApi.DirectiveMetadata.COMPONENT_TYPE) {
|
if (directiveBinding.metadata.type !== renderApi.DirectiveMetadata.COMPONENT_TYPE) {
|
||||||
throw new BaseException(
|
throw new BaseException(
|
||||||
`Could not load '${stringify(directiveBinding.key.token)}' because it is not a component.`);
|
`Could not load '${stringify(directiveBinding.key.token)}' because it is not a component.`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,44 +38,46 @@ export class DynamicComponentLoader {
|
|||||||
loadIntoExistingLocation(typeOrBinding, location: ElementRef,
|
loadIntoExistingLocation(typeOrBinding, location: ElementRef,
|
||||||
injector: Injector = null): Promise<ComponentRef> {
|
injector: Injector = null): Promise<ComponentRef> {
|
||||||
var binding = this._getBinding(typeOrBinding);
|
var binding = this._getBinding(typeOrBinding);
|
||||||
return this._compiler.compile(binding.token).then(componentProtoViewRef => {
|
return this._compiler.compile(binding.token)
|
||||||
|
.then(componentProtoViewRef => {
|
||||||
this._viewManager.createDynamicComponentView(location, componentProtoViewRef, binding,
|
this._viewManager.createDynamicComponentView(location, componentProtoViewRef, binding,
|
||||||
injector);
|
injector);
|
||||||
var component = this._viewManager.getComponent(location);
|
var component = this._viewManager.getComponent(location);
|
||||||
var dispose = () => { throw new BaseException("Not implemented");};
|
var dispose = () => { throw new BaseException("Not implemented"); };
|
||||||
return new ComponentRef(location, component, dispose);
|
return new ComponentRef(location, component, dispose);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a root component that is placed at the first element that matches the
|
* Loads a root component that is placed at the first element that matches the
|
||||||
* component's selector.
|
* component's selector.
|
||||||
* The loaded component receives injection normally as a hosted view.
|
* The loaded component receives injection normally as a hosted view.
|
||||||
*/
|
*/
|
||||||
loadAsRoot(typeOrBinding, overrideSelector = null,
|
loadAsRoot(typeOrBinding, overrideSelector = null,
|
||||||
injector: Injector = null): Promise<ComponentRef> {
|
injector: Injector = null): Promise<ComponentRef> {
|
||||||
return this._compiler.compileInHost(this._getBinding(typeOrBinding)).then(hostProtoViewRef => {
|
return this._compiler.compileInHost(this._getBinding(typeOrBinding))
|
||||||
|
.then(hostProtoViewRef => {
|
||||||
var hostViewRef =
|
var hostViewRef =
|
||||||
this._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector);
|
this._viewManager.createRootHostView(hostProtoViewRef, overrideSelector, injector);
|
||||||
var newLocation = new ElementRef(hostViewRef, 0);
|
var newLocation = new ElementRef(hostViewRef, 0);
|
||||||
var component = this._viewManager.getComponent(newLocation);
|
var component = this._viewManager.getComponent(newLocation);
|
||||||
|
|
||||||
var dispose = () => { this._viewManager.destroyRootHostView(hostViewRef);
|
var dispose = () => { this._viewManager.destroyRootHostView(hostViewRef); };
|
||||||
};
|
|
||||||
return new ComponentRef(newLocation, component, dispose);
|
return new ComponentRef(newLocation, component, dispose);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a component into a free host view that is not yet attached to
|
* Loads a component into a free host view that is not yet attached to
|
||||||
* a parent on the render side, although it is attached to a parent in the injector hierarchy.
|
* a parent on the render side, although it is attached to a parent in the injector hierarchy.
|
||||||
* The loaded component receives injection normally as a hosted view.
|
* The loaded component receives injection normally as a hosted view.
|
||||||
*/
|
*/
|
||||||
loadIntoNewLocation(typeOrBinding, parentComponentLocation: ElementRef,
|
loadIntoNewLocation(typeOrBinding, parentComponentLocation: ElementRef,
|
||||||
injector: Injector = null): Promise<ComponentRef> {
|
injector: Injector = null): Promise<ComponentRef> {
|
||||||
return this._compiler.compileInHost(this._getBinding(typeOrBinding)).then(hostProtoViewRef => {
|
return this._compiler.compileInHost(this._getBinding(typeOrBinding))
|
||||||
var hostViewRef =
|
.then(hostProtoViewRef => {
|
||||||
this._viewManager.createFreeHostView(parentComponentLocation, hostProtoViewRef, injector);
|
var hostViewRef = this._viewManager.createFreeHostView(parentComponentLocation,
|
||||||
|
hostProtoViewRef, injector);
|
||||||
var newLocation = new ElementRef(hostViewRef, 0);
|
var newLocation = new ElementRef(hostViewRef, 0);
|
||||||
var component = this._viewManager.getComponent(newLocation);
|
var component = this._viewManager.getComponent(newLocation);
|
||||||
|
|
||||||
@ -83,30 +85,32 @@ loadIntoNewLocation(typeOrBinding, parentComponentLocation: ElementRef,
|
|||||||
this._viewManager.destroyFreeHostView(parentComponentLocation, hostViewRef);
|
this._viewManager.destroyFreeHostView(parentComponentLocation, hostViewRef);
|
||||||
};
|
};
|
||||||
return new ComponentRef(newLocation, component, dispose);
|
return new ComponentRef(newLocation, component, dispose);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a component next to the provided ElementRef. The loaded component receives
|
* Loads a component next to the provided ElementRef. The loaded component receives
|
||||||
* injection normally as a hosted view.
|
* injection normally as a hosted view.
|
||||||
*/
|
*/
|
||||||
loadNextToExistingLocation(typeOrBinding, location: ElementRef,
|
loadNextToExistingLocation(typeOrBinding, location: ElementRef,
|
||||||
injector: Injector = null): Promise<ComponentRef> {
|
injector: Injector = null): Promise<ComponentRef> {
|
||||||
var binding = this._getBinding(typeOrBinding);
|
var binding = this._getBinding(typeOrBinding);
|
||||||
return this._compiler.compileInHost(binding).then(hostProtoViewRef => {
|
return this._compiler.compileInHost(binding).then(hostProtoViewRef => {
|
||||||
var viewContainer = this._viewManager.getViewContainer(location);
|
var viewContainer = this._viewManager.getViewContainer(location);
|
||||||
var hostViewRef = viewContainer.create(hostProtoViewRef, viewContainer.length, null, injector);
|
var hostViewRef =
|
||||||
|
viewContainer.create(hostProtoViewRef, viewContainer.length, null, injector);
|
||||||
var newLocation = new ElementRef(hostViewRef, 0);
|
var newLocation = new ElementRef(hostViewRef, 0);
|
||||||
var component = this._viewManager.getComponent(newLocation);
|
var component = this._viewManager.getComponent(newLocation);
|
||||||
|
|
||||||
var dispose = () => { var index = viewContainer.indexOf(hostViewRef);
|
var dispose = () => {
|
||||||
|
var index = viewContainer.indexOf(hostViewRef);
|
||||||
viewContainer.remove(index);
|
viewContainer.remove(index);
|
||||||
};
|
};
|
||||||
return new ComponentRef(newLocation, component, dispose);
|
return new ComponentRef(newLocation, component, dispose);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _getBinding(typeOrBinding): Binding {
|
private _getBinding(typeOrBinding): Binding {
|
||||||
var binding;
|
var binding;
|
||||||
if (typeOrBinding instanceof Binding) {
|
if (typeOrBinding instanceof Binding) {
|
||||||
binding = typeOrBinding;
|
binding = typeOrBinding;
|
||||||
@ -114,5 +118,5 @@ private _getBinding(typeOrBinding): Binding {
|
|||||||
binding = bind(typeOrBinding).toClass(typeOrBinding);
|
binding = bind(typeOrBinding).toClass(typeOrBinding);
|
||||||
}
|
}
|
||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,31 +39,33 @@ export class LifeCycle {
|
|||||||
|
|
||||||
constructor(exceptionHandler: ExceptionHandler, changeDetector: ChangeDetector = null,
|
constructor(exceptionHandler: ExceptionHandler, changeDetector: ChangeDetector = null,
|
||||||
enforceNoNewChanges: boolean = false) {
|
enforceNoNewChanges: boolean = false) {
|
||||||
this._errorHandler = (exception, stackTrace) => { exceptionHandler.call(exception, stackTrace);
|
this._errorHandler = (exception, stackTrace) => {
|
||||||
|
exceptionHandler.call(exception, stackTrace);
|
||||||
throw exception;
|
throw exception;
|
||||||
};
|
};
|
||||||
this._changeDetector =
|
this._changeDetector =
|
||||||
changeDetector; // may be null when instantiated from application bootstrap
|
changeDetector; // may be null when instantiated from application bootstrap
|
||||||
this._enforceNoNewChanges = enforceNoNewChanges;
|
this._enforceNoNewChanges = enforceNoNewChanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
registerWith(zone: NgZone, changeDetector: ChangeDetector = null) {
|
registerWith(zone: NgZone, changeDetector: ChangeDetector = null) {
|
||||||
if (isPresent(changeDetector)) {
|
if (isPresent(changeDetector)) {
|
||||||
this._changeDetector = changeDetector;
|
this._changeDetector = changeDetector;
|
||||||
}
|
}
|
||||||
|
|
||||||
zone.initCallbacks({onErrorHandler: this._errorHandler, onTurnDone: () => this.tick()});
|
zone.initCallbacks({onErrorHandler: this._errorHandler, onTurnDone: () => this.tick()});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invoke this method to explicitly process change detection and its side-effects.
|
* Invoke this method to explicitly process change detection and its side-effects.
|
||||||
*
|
*
|
||||||
* In development mode, `tick()` also performs a second change detection cycle to ensure that no
|
* In development mode, `tick()` also performs a second change detection cycle to ensure that no
|
||||||
* further
|
* further
|
||||||
* changes are detected. If additional changes are picked up during this second cycle, bindings in
|
* changes are detected. If additional changes are picked up during this second cycle, bindings
|
||||||
|
* in
|
||||||
* the app have
|
* the app have
|
||||||
* side-effects that cannot be resolved in a single change detection pass. In this case, Angular
|
* side-effects that cannot be resolved in a single change detection pass. In this case, Angular
|
||||||
* throws an error,
|
* throws an error,
|
||||||
@ -72,10 +74,10 @@ registerWith(zone: NgZone, changeDetector: ChangeDetector = null) {
|
|||||||
* complete.
|
* complete.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
tick() {
|
tick() {
|
||||||
this._changeDetector.detectChanges();
|
this._changeDetector.detectChanges();
|
||||||
if (this._enforceNoNewChanges) {
|
if (this._enforceNoNewChanges) {
|
||||||
this._changeDetector.checkNoChanges();
|
this._changeDetector.checkNoChanges();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ export class AbstractBindingError extends BaseException {
|
|||||||
export class NoBindingError extends AbstractBindingError {
|
export class NoBindingError extends AbstractBindingError {
|
||||||
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
|
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
|
||||||
constructor(key) {
|
constructor(key) {
|
||||||
super(key, function (keys:List<any>) {
|
super(key, function(keys: List<any>) {
|
||||||
var first = stringify(ListWrapper.first(keys).token);
|
var first = stringify(ListWrapper.first(keys).token);
|
||||||
return `No provider for ${first}!${constructResolvingPath(keys)}`;
|
return `No provider for ${first}!${constructResolvingPath(keys)}`;
|
||||||
});
|
});
|
||||||
@ -95,7 +95,7 @@ export class NoBindingError extends AbstractBindingError {
|
|||||||
export class AsyncBindingError extends AbstractBindingError {
|
export class AsyncBindingError extends AbstractBindingError {
|
||||||
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
|
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
|
||||||
constructor(key) {
|
constructor(key) {
|
||||||
super(key, function (keys:List<any>) {
|
super(key, function(keys: List<any>) {
|
||||||
var first = stringify(ListWrapper.first(keys).token);
|
var first = stringify(ListWrapper.first(keys).token);
|
||||||
return `Cannot instantiate ${first} synchronously. It is provided as a promise!${constructResolvingPath(keys)}`;
|
return `Cannot instantiate ${first} synchronously. It is provided as a promise!${constructResolvingPath(keys)}`;
|
||||||
});
|
});
|
||||||
@ -123,7 +123,7 @@ export class AsyncBindingError extends AbstractBindingError {
|
|||||||
export class CyclicDependencyError extends AbstractBindingError {
|
export class CyclicDependencyError extends AbstractBindingError {
|
||||||
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
|
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
|
||||||
constructor(key) {
|
constructor(key) {
|
||||||
super(key, function (keys:List<any>) {
|
super(key, function(keys: List<any>) {
|
||||||
return `Cannot instantiate cyclic dependency!${constructResolvingPath(keys)}`;
|
return `Cannot instantiate cyclic dependency!${constructResolvingPath(keys)}`;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ export class InstantiationError extends AbstractBindingError {
|
|||||||
causeKey;
|
causeKey;
|
||||||
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
|
// TODO(tbosch): Can't do key:Key as this results in a circular dependency!
|
||||||
constructor(cause, key) {
|
constructor(cause, key) {
|
||||||
super(key, function (keys:List<any>) {
|
super(key, function(keys: List<any>) {
|
||||||
var first = stringify(ListWrapper.first(keys).token);
|
var first = stringify(ListWrapper.first(keys).token);
|
||||||
return `Error during instantiation of ${first}!${constructResolvingPath(keys)}. ORIGINAL ERROR: ${cause}`;
|
return `Error during instantiation of ${first}!${constructResolvingPath(keys)}. ORIGINAL ERROR: ${cause}`;
|
||||||
});
|
});
|
||||||
|
@ -63,185 +63,110 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
|||||||
el.addEventListener(evt, listener, false);
|
el.addEventListener(evt, listener, false);
|
||||||
// Needed to follow Dart's subscription semantic, until fix of
|
// Needed to follow Dart's subscription semantic, until fix of
|
||||||
// https://code.google.com/p/dart/issues/detail?id=17406
|
// https://code.google.com/p/dart/issues/detail?id=17406
|
||||||
return () => { el.removeEventListener(evt, listener, false);
|
return () => { el.removeEventListener(evt, listener, false); };
|
||||||
};
|
}
|
||||||
}
|
dispatchEvent(el, evt) { el.dispatchEvent(evt); }
|
||||||
dispatchEvent(el, evt) {
|
createMouseEvent(eventType: string): MouseEvent {
|
||||||
el.dispatchEvent(evt);
|
|
||||||
}
|
|
||||||
createMouseEvent(eventType: string): MouseEvent {
|
|
||||||
var evt: MouseEvent = document.createEvent('MouseEvent');
|
var evt: MouseEvent = document.createEvent('MouseEvent');
|
||||||
evt.initEvent(eventType, true, true);
|
evt.initEvent(eventType, true, true);
|
||||||
return evt;
|
return evt;
|
||||||
}
|
}
|
||||||
createEvent(eventType): Event {
|
createEvent(eventType): Event {
|
||||||
var evt: Event = document.createEvent('Event');
|
var evt: Event = document.createEvent('Event');
|
||||||
evt.initEvent(eventType, true, true);
|
evt.initEvent(eventType, true, true);
|
||||||
return evt;
|
return evt;
|
||||||
}
|
}
|
||||||
preventDefault(evt: Event) {
|
preventDefault(evt: Event) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
evt.returnValue = false;
|
evt.returnValue = false;
|
||||||
}
|
}
|
||||||
getInnerHTML(el) {
|
getInnerHTML(el) { return el.innerHTML; }
|
||||||
return el.innerHTML;
|
getOuterHTML(el) { return el.outerHTML; }
|
||||||
}
|
nodeName(node: Node): string { return node.nodeName; }
|
||||||
getOuterHTML(el) {
|
nodeValue(node: Node): string { return node.nodeValue; }
|
||||||
return el.outerHTML;
|
type(node: HTMLInputElement): string { return node.type; }
|
||||||
}
|
content(node: Node): Node {
|
||||||
nodeName(node: Node): string {
|
|
||||||
return node.nodeName;
|
|
||||||
}
|
|
||||||
nodeValue(node: Node): string {
|
|
||||||
return node.nodeValue;
|
|
||||||
}
|
|
||||||
type(node: HTMLInputElement): string {
|
|
||||||
return node.type;
|
|
||||||
}
|
|
||||||
content(node: Node): Node {
|
|
||||||
if (this.hasProperty(node, "content")) {
|
if (this.hasProperty(node, "content")) {
|
||||||
return (<any>node).content;
|
return (<any>node).content;
|
||||||
} else {
|
} else {
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
firstChild(el): Node {
|
firstChild(el): Node { return el.firstChild; }
|
||||||
return el.firstChild;
|
nextSibling(el): Node { return el.nextSibling; }
|
||||||
}
|
parentElement(el) { return el.parentElement; }
|
||||||
nextSibling(el): Node {
|
childNodes(el): List<Node> { return el.childNodes; }
|
||||||
return el.nextSibling;
|
childNodesAsList(el): List<any> {
|
||||||
}
|
|
||||||
parentElement(el) {
|
|
||||||
return el.parentElement;
|
|
||||||
}
|
|
||||||
childNodes(el): List<Node> {
|
|
||||||
return el.childNodes;
|
|
||||||
}
|
|
||||||
childNodesAsList(el): List<any> {
|
|
||||||
var childNodes = el.childNodes;
|
var childNodes = el.childNodes;
|
||||||
var res = ListWrapper.createFixedSize(childNodes.length);
|
var res = ListWrapper.createFixedSize(childNodes.length);
|
||||||
for (var i = 0; i < childNodes.length; i++) {
|
for (var i = 0; i < childNodes.length; i++) {
|
||||||
res[i] = childNodes[i];
|
res[i] = childNodes[i];
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
clearNodes(el) {
|
clearNodes(el) {
|
||||||
for (var i = 0; i < el.childNodes.length; i++) {
|
for (var i = 0; i < el.childNodes.length; i++) {
|
||||||
this.remove(el.childNodes[i]);
|
this.remove(el.childNodes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
appendChild(el, node) {
|
appendChild(el, node) { el.appendChild(node); }
|
||||||
el.appendChild(node);
|
removeChild(el, node) { el.removeChild(node); }
|
||||||
}
|
replaceChild(el: Node, newChild, oldChild) { el.replaceChild(newChild, oldChild); }
|
||||||
removeChild(el, node) {
|
remove(el) {
|
||||||
el.removeChild(node);
|
|
||||||
}
|
|
||||||
replaceChild(el: Node, newChild, oldChild) {
|
|
||||||
el.replaceChild(newChild, oldChild);
|
|
||||||
}
|
|
||||||
remove(el) {
|
|
||||||
var parent = el.parentNode;
|
var parent = el.parentNode;
|
||||||
parent.removeChild(el);
|
parent.removeChild(el);
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
insertBefore(el, node) {
|
insertBefore(el, node) { el.parentNode.insertBefore(node, el); }
|
||||||
el.parentNode.insertBefore(node, el);
|
insertAllBefore(el, nodes) {
|
||||||
}
|
|
||||||
insertAllBefore(el, nodes) {
|
|
||||||
ListWrapper.forEach(nodes, (n) => { el.parentNode.insertBefore(n, el); });
|
ListWrapper.forEach(nodes, (n) => { el.parentNode.insertBefore(n, el); });
|
||||||
}
|
}
|
||||||
insertAfter(el, node) {
|
insertAfter(el, node) { el.parentNode.insertBefore(node, el.nextSibling); }
|
||||||
el.parentNode.insertBefore(node, el.nextSibling);
|
setInnerHTML(el, value) { el.innerHTML = value; }
|
||||||
}
|
getText(el) { return el.textContent; }
|
||||||
setInnerHTML(el, value) {
|
// TODO(vicb): removed Element type because it does not support StyleElement
|
||||||
el.innerHTML = value;
|
setText(el, value: string) { el.textContent = value; }
|
||||||
}
|
getValue(el) { return el.value; }
|
||||||
getText(el) {
|
setValue(el, value: string) { el.value = value; }
|
||||||
return el.textContent;
|
getChecked(el) { return el.checked; }
|
||||||
}
|
setChecked(el, value: boolean) { el.checked = value; }
|
||||||
// TODO(vicb): removed Element type because it does not support StyleElement
|
createTemplate(html): HTMLElement {
|
||||||
setText(el, value: string) {
|
|
||||||
el.textContent = value;
|
|
||||||
}
|
|
||||||
getValue(el) {
|
|
||||||
return el.value;
|
|
||||||
}
|
|
||||||
setValue(el, value: string) {
|
|
||||||
el.value = value;
|
|
||||||
}
|
|
||||||
getChecked(el) {
|
|
||||||
return el.checked;
|
|
||||||
}
|
|
||||||
setChecked(el, value: boolean) {
|
|
||||||
el.checked = value;
|
|
||||||
}
|
|
||||||
createTemplate(html): HTMLElement {
|
|
||||||
var t = document.createElement('template');
|
var t = document.createElement('template');
|
||||||
t.innerHTML = html;
|
t.innerHTML = html;
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
createElement(tagName, doc = document): HTMLElement {
|
createElement(tagName, doc = document): HTMLElement { return doc.createElement(tagName); }
|
||||||
return doc.createElement(tagName);
|
createTextNode(text: string, doc = document): Text { return doc.createTextNode(text); }
|
||||||
}
|
createScriptTag(attrName: string, attrValue: string, doc = document): HTMLScriptElement {
|
||||||
createTextNode(text: string, doc = document): Text {
|
|
||||||
return doc.createTextNode(text);
|
|
||||||
}
|
|
||||||
createScriptTag(attrName: string, attrValue: string, doc = document): HTMLScriptElement {
|
|
||||||
var el = <HTMLScriptElement>doc.createElement('SCRIPT');
|
var el = <HTMLScriptElement>doc.createElement('SCRIPT');
|
||||||
el.setAttribute(attrName, attrValue);
|
el.setAttribute(attrName, attrValue);
|
||||||
return el;
|
return el;
|
||||||
}
|
}
|
||||||
createStyleElement(css: string, doc = document): HTMLStyleElement {
|
createStyleElement(css: string, doc = document): HTMLStyleElement {
|
||||||
var style = <HTMLStyleElement>doc.createElement('style');
|
var style = <HTMLStyleElement>doc.createElement('style');
|
||||||
this.appendChild(style, this.createTextNode(css));
|
this.appendChild(style, this.createTextNode(css));
|
||||||
return style;
|
return style;
|
||||||
}
|
}
|
||||||
createShadowRoot(el: HTMLElement): DocumentFragment {
|
createShadowRoot(el: HTMLElement): DocumentFragment { return (<any>el).createShadowRoot(); }
|
||||||
return (<any>el).createShadowRoot();
|
getShadowRoot(el: HTMLElement): DocumentFragment { return (<any>el).shadowRoot; }
|
||||||
}
|
getHost(el: HTMLElement): HTMLElement { return (<any>el).host; }
|
||||||
getShadowRoot(el: HTMLElement): DocumentFragment {
|
clone(node: Node) { return node.cloneNode(true); }
|
||||||
return (<any>el).shadowRoot;
|
hasProperty(element, name: string) { return name in element; }
|
||||||
}
|
getElementsByClassName(element, name: string) { return element.getElementsByClassName(name); }
|
||||||
getHost(el: HTMLElement): HTMLElement {
|
getElementsByTagName(element, name: string) { return element.getElementsByTagName(name); }
|
||||||
return (<any>el).host;
|
classList(element): List<any> {
|
||||||
}
|
|
||||||
clone(node: Node) {
|
|
||||||
return node.cloneNode(true);
|
|
||||||
}
|
|
||||||
hasProperty(element, name: string) {
|
|
||||||
return name in element;
|
|
||||||
}
|
|
||||||
getElementsByClassName(element, name: string) {
|
|
||||||
return element.getElementsByClassName(name);
|
|
||||||
}
|
|
||||||
getElementsByTagName(element, name: string) {
|
|
||||||
return element.getElementsByTagName(name);
|
|
||||||
}
|
|
||||||
classList(element): List<any> {
|
|
||||||
return <List<any>>Array.prototype.slice.call(element.classList, 0);
|
return <List<any>>Array.prototype.slice.call(element.classList, 0);
|
||||||
}
|
}
|
||||||
addClass(element, classname: string) {
|
addClass(element, classname: string) { element.classList.add(classname); }
|
||||||
element.classList.add(classname);
|
removeClass(element, classname: string) { element.classList.remove(classname); }
|
||||||
}
|
hasClass(element, classname: string) { return element.classList.contains(classname); }
|
||||||
removeClass(element, classname: string) {
|
setStyle(element, stylename: string, stylevalue: string) {
|
||||||
element.classList.remove(classname);
|
|
||||||
}
|
|
||||||
hasClass(element, classname: string) {
|
|
||||||
return element.classList.contains(classname);
|
|
||||||
}
|
|
||||||
setStyle(element, stylename: string, stylevalue: string) {
|
|
||||||
element.style[stylename] = stylevalue;
|
element.style[stylename] = stylevalue;
|
||||||
}
|
}
|
||||||
removeStyle(element, stylename: string) {
|
removeStyle(element, stylename: string) { element.style[stylename] = null; }
|
||||||
element.style[stylename] = null;
|
getStyle(element, stylename: string) { return element.style[stylename]; }
|
||||||
}
|
tagName(element): string { return element.tagName; }
|
||||||
getStyle(element, stylename: string) {
|
attributeMap(element) {
|
||||||
return element.style[stylename];
|
|
||||||
}
|
|
||||||
tagName(element): string {
|
|
||||||
return element.tagName;
|
|
||||||
}
|
|
||||||
attributeMap(element) {
|
|
||||||
var res = MapWrapper.create();
|
var res = MapWrapper.create();
|
||||||
var elAttrs = element.attributes;
|
var elAttrs = element.attributes;
|
||||||
for (var i = 0; i < elAttrs.length; i++) {
|
for (var i = 0; i < elAttrs.length; i++) {
|
||||||
@ -249,86 +174,48 @@ attributeMap(element) {
|
|||||||
MapWrapper.set(res, attrib.name, attrib.value);
|
MapWrapper.set(res, attrib.name, attrib.value);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
hasAttribute(element, attribute: string) {
|
hasAttribute(element, attribute: string) { return element.hasAttribute(attribute); }
|
||||||
return element.hasAttribute(attribute);
|
getAttribute(element, attribute: string) { return element.getAttribute(attribute); }
|
||||||
}
|
setAttribute(element, name: string, value: string) { element.setAttribute(name, value); }
|
||||||
getAttribute(element, attribute: string) {
|
removeAttribute(element, attribute: string) { return element.removeAttribute(attribute); }
|
||||||
return element.getAttribute(attribute);
|
templateAwareRoot(el) { return this.isTemplateElement(el) ? this.content(el) : el; }
|
||||||
}
|
createHtmlDocument() { return document.implementation.createHTMLDocument('fakeTitle'); }
|
||||||
setAttribute(element, name: string, value: string) {
|
defaultDoc() { return document; }
|
||||||
element.setAttribute(name, value);
|
getBoundingClientRect(el) {
|
||||||
}
|
|
||||||
removeAttribute(element, attribute: string) {
|
|
||||||
return element.removeAttribute(attribute);
|
|
||||||
}
|
|
||||||
templateAwareRoot(el) {
|
|
||||||
return this.isTemplateElement(el) ? this.content(el) : el;
|
|
||||||
}
|
|
||||||
createHtmlDocument() {
|
|
||||||
return document.implementation.createHTMLDocument('fakeTitle');
|
|
||||||
}
|
|
||||||
defaultDoc() {
|
|
||||||
return document;
|
|
||||||
}
|
|
||||||
getBoundingClientRect(el) {
|
|
||||||
try {
|
try {
|
||||||
return el.getBoundingClientRect();
|
return el.getBoundingClientRect();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return {top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0};
|
return {top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getTitle(): string {
|
getTitle(): string { return document.title; }
|
||||||
return document.title;
|
setTitle(newTitle: string) { document.title = newTitle || ''; }
|
||||||
}
|
elementMatches(n, selector: string): boolean {
|
||||||
setTitle(newTitle: string) {
|
|
||||||
document.title = newTitle || '';
|
|
||||||
}
|
|
||||||
elementMatches(n, selector: string): boolean {
|
|
||||||
return n instanceof HTMLElement && n.matches ? n.matches(selector) :
|
return n instanceof HTMLElement && n.matches ? n.matches(selector) :
|
||||||
n.msMatchesSelector(selector);
|
n.msMatchesSelector(selector);
|
||||||
}
|
}
|
||||||
isTemplateElement(el: any): boolean {
|
isTemplateElement(el: any): boolean {
|
||||||
return el instanceof HTMLElement && el.nodeName == "TEMPLATE";
|
return el instanceof HTMLElement && el.nodeName == "TEMPLATE";
|
||||||
}
|
}
|
||||||
isTextNode(node: Node): boolean {
|
isTextNode(node: Node): boolean { return node.nodeType === Node.TEXT_NODE; }
|
||||||
return node.nodeType === Node.TEXT_NODE;
|
isCommentNode(node: Node): boolean { return node.nodeType === Node.COMMENT_NODE; }
|
||||||
}
|
isElementNode(node: Node): boolean { return node.nodeType === Node.ELEMENT_NODE; }
|
||||||
isCommentNode(node: Node): boolean {
|
hasShadowRoot(node): boolean { return node instanceof HTMLElement && isPresent(node.shadowRoot); }
|
||||||
return node.nodeType === Node.COMMENT_NODE;
|
isShadowRoot(node): boolean { return node instanceof DocumentFragment; }
|
||||||
}
|
importIntoDoc(node: Node) {
|
||||||
isElementNode(node: Node): boolean {
|
|
||||||
return node.nodeType === Node.ELEMENT_NODE;
|
|
||||||
}
|
|
||||||
hasShadowRoot(node): boolean {
|
|
||||||
return node instanceof HTMLElement && isPresent(node.shadowRoot);
|
|
||||||
}
|
|
||||||
isShadowRoot(node): boolean {
|
|
||||||
return node instanceof DocumentFragment;
|
|
||||||
}
|
|
||||||
importIntoDoc(node: Node) {
|
|
||||||
var toImport = node;
|
var toImport = node;
|
||||||
if (this.isTemplateElement(node)) {
|
if (this.isTemplateElement(node)) {
|
||||||
toImport = this.content(node);
|
toImport = this.content(node);
|
||||||
}
|
}
|
||||||
return document.importNode(toImport, true);
|
return document.importNode(toImport, true);
|
||||||
}
|
}
|
||||||
isPageRule(rule): boolean {
|
isPageRule(rule): boolean { return rule.type === CSSRule.PAGE_RULE; }
|
||||||
return rule.type === CSSRule.PAGE_RULE;
|
isStyleRule(rule): boolean { return rule.type === CSSRule.STYLE_RULE; }
|
||||||
}
|
isMediaRule(rule): boolean { return rule.type === CSSRule.MEDIA_RULE; }
|
||||||
isStyleRule(rule): boolean {
|
isKeyframesRule(rule): boolean { return rule.type === CSSRule.KEYFRAMES_RULE; }
|
||||||
return rule.type === CSSRule.STYLE_RULE;
|
getHref(el: Element): string { return (<any>el).href; }
|
||||||
}
|
getEventKey(event): string {
|
||||||
isMediaRule(rule): boolean {
|
|
||||||
return rule.type === CSSRule.MEDIA_RULE;
|
|
||||||
}
|
|
||||||
isKeyframesRule(rule): boolean {
|
|
||||||
return rule.type === CSSRule.KEYFRAMES_RULE;
|
|
||||||
}
|
|
||||||
getHref(el: Element): string {
|
|
||||||
return (<any>el).href;
|
|
||||||
}
|
|
||||||
getEventKey(event): string {
|
|
||||||
var key = event.key;
|
var key = event.key;
|
||||||
if (isBlank(key)) {
|
if (isBlank(key)) {
|
||||||
key = event.keyIdentifier;
|
key = event.keyIdentifier;
|
||||||
@ -353,8 +240,8 @@ getEventKey(event): string {
|
|||||||
key = _keyMap[key];
|
key = _keyMap[key];
|
||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
getGlobalEventTarget(target: string): EventTarget {
|
getGlobalEventTarget(target: string): EventTarget {
|
||||||
if (target == "window") {
|
if (target == "window") {
|
||||||
return window;
|
return window;
|
||||||
} else if (target == "document") {
|
} else if (target == "document") {
|
||||||
@ -362,19 +249,11 @@ getGlobalEventTarget(target: string): EventTarget {
|
|||||||
} else if (target == "body") {
|
} else if (target == "body") {
|
||||||
return document.body;
|
return document.body;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getHistory() {
|
getHistory() { return window.history; }
|
||||||
return window.history;
|
getLocation() { return window.location; }
|
||||||
}
|
getBaseHref() { return relativePath(document.baseURI); }
|
||||||
getLocation() {
|
getUserAgent(): string { return window.navigator.userAgent; }
|
||||||
return window.location;
|
|
||||||
}
|
|
||||||
getBaseHref() {
|
|
||||||
return relativePath(document.baseURI);
|
|
||||||
}
|
|
||||||
getUserAgent(): string {
|
|
||||||
return window.navigator.userAgent;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// based on urlUtils.js in AngularJS 1
|
// based on urlUtils.js in AngularJS 1
|
||||||
|
@ -36,8 +36,9 @@ export class CssSelector {
|
|||||||
if (isPresent(cssSel.notSelector) && isBlank(cssSel.element) &&
|
if (isPresent(cssSel.notSelector) && isBlank(cssSel.element) &&
|
||||||
ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
|
ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) {
|
||||||
cssSel.element = "*";
|
cssSel.element = "*";
|
||||||
} ListWrapper.push(res, cssSel);
|
|
||||||
}
|
}
|
||||||
|
ListWrapper.push(res, cssSel);
|
||||||
|
};
|
||||||
var cssSelector = new CssSelector();
|
var cssSelector = new CssSelector();
|
||||||
var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);
|
var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector);
|
||||||
var match;
|
var match;
|
||||||
@ -66,28 +67,28 @@ export class CssSelector {
|
|||||||
}
|
}
|
||||||
_addResult(results, cssSelector);
|
_addResult(results, cssSelector);
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.element = null;
|
this.element = null;
|
||||||
this.classNames = ListWrapper.create();
|
this.classNames = ListWrapper.create();
|
||||||
this.attrs = ListWrapper.create();
|
this.attrs = ListWrapper.create();
|
||||||
this.notSelector = null;
|
this.notSelector = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
isElementSelector(): boolean {
|
isElementSelector(): boolean {
|
||||||
return isPresent(this.element) && ListWrapper.isEmpty(this.classNames) &&
|
return isPresent(this.element) && ListWrapper.isEmpty(this.classNames) &&
|
||||||
ListWrapper.isEmpty(this.attrs) && isBlank(this.notSelector);
|
ListWrapper.isEmpty(this.attrs) && isBlank(this.notSelector);
|
||||||
}
|
}
|
||||||
|
|
||||||
setElement(element: string = null) {
|
setElement(element: string = null) {
|
||||||
if (isPresent(element)) {
|
if (isPresent(element)) {
|
||||||
element = element.toLowerCase();
|
element = element.toLowerCase();
|
||||||
}
|
}
|
||||||
this.element = element;
|
this.element = element;
|
||||||
}
|
}
|
||||||
|
|
||||||
addAttribute(name: string, value: string = _EMPTY_ATTR_VALUE) {
|
addAttribute(name: string, value: string = _EMPTY_ATTR_VALUE) {
|
||||||
ListWrapper.push(this.attrs, name.toLowerCase());
|
ListWrapper.push(this.attrs, name.toLowerCase());
|
||||||
if (isPresent(value)) {
|
if (isPresent(value)) {
|
||||||
value = value.toLowerCase();
|
value = value.toLowerCase();
|
||||||
@ -95,13 +96,11 @@ addAttribute(name: string, value: string = _EMPTY_ATTR_VALUE) {
|
|||||||
value = _EMPTY_ATTR_VALUE;
|
value = _EMPTY_ATTR_VALUE;
|
||||||
}
|
}
|
||||||
ListWrapper.push(this.attrs, value);
|
ListWrapper.push(this.attrs, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
addClassName(name: string) {
|
addClassName(name: string) { ListWrapper.push(this.classNames, name.toLowerCase()); }
|
||||||
ListWrapper.push(this.classNames, name.toLowerCase());
|
|
||||||
}
|
|
||||||
|
|
||||||
toString(): string {
|
toString(): string {
|
||||||
var res = '';
|
var res = '';
|
||||||
if (isPresent(this.element)) {
|
if (isPresent(this.element)) {
|
||||||
res += this.element;
|
res += this.element;
|
||||||
@ -126,7 +125,7 @@ toString(): string {
|
|||||||
res += ":not(" + this.notSelector.toString() + ")";
|
res += ":not(" + this.notSelector.toString() + ")";
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -96,7 +96,11 @@ export class DomEventsPlugin extends EventManagerPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static sameElementCallback(element, handler, zone) {
|
static sameElementCallback(element, handler, zone) {
|
||||||
return (event) => { if (event.target === element) { zone.run(() => handler(event)); } };
|
return (event) => {
|
||||||
|
if (event.target === element) {
|
||||||
|
zone.run(() => handler(event));
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static bubbleCallback(element, handler, zone) {
|
static bubbleCallback(element, handler, zone) {
|
||||||
|
@ -89,14 +89,15 @@ export class KeyEventsPlugin extends EventManagerPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static eventCallback(element, shouldSupportBubble, fullKey, handler, zone) {
|
static eventCallback(element, shouldSupportBubble, fullKey, handler, zone) {
|
||||||
return (event) => { var correctElement = shouldSupportBubble || event.target === element;
|
return (event) => {
|
||||||
|
var correctElement = shouldSupportBubble || event.target === element;
|
||||||
if (correctElement && KeyEventsPlugin.getEventFullKey(event) === fullKey) {
|
if (correctElement && KeyEventsPlugin.getEventFullKey(event) === fullKey) {
|
||||||
zone.run(() => handler(event));
|
zone.run(() => handler(event));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static _normalizeKey(keyName: string): string {
|
static _normalizeKey(keyName: string): string {
|
||||||
// TODO: switch to a StringMap if the mapping grows too much
|
// TODO: switch to a StringMap if the mapping grows too much
|
||||||
switch (keyName) {
|
switch (keyName) {
|
||||||
case 'esc':
|
case 'esc':
|
||||||
@ -104,5 +105,5 @@ static _normalizeKey(keyName: string): string {
|
|||||||
default:
|
default:
|
||||||
return keyName;
|
return keyName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -331,31 +331,33 @@ export class SpyObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function elementText(n) {
|
function elementText(n) {
|
||||||
var hasNodes = (n) => { var children = DOM.childNodes(n);
|
var hasNodes = (n) =>
|
||||||
|
{
|
||||||
|
var children = DOM.childNodes(n);
|
||||||
return children && children.length > 0;
|
return children && children.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n instanceof Array) {
|
if (n instanceof Array) {
|
||||||
return n.map((nn) => elementText(nn)).join("");
|
return n.map((nn) => elementText(nn)).join("");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DOM.isCommentNode(n)) {
|
if (DOM.isCommentNode(n)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DOM.isElementNode(n) && DOM.tagName(n) == 'CONTENT') {
|
if (DOM.isElementNode(n) && DOM.tagName(n) == 'CONTENT') {
|
||||||
return elementText(Array.prototype.slice.apply(DOM.getDistributedNodes(n)));
|
return elementText(Array.prototype.slice.apply(DOM.getDistributedNodes(n)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DOM.hasShadowRoot(n)) {
|
if (DOM.hasShadowRoot(n)) {
|
||||||
return elementText(DOM.childNodesAsList(DOM.getShadowRoot(n)));
|
return elementText(DOM.childNodesAsList(DOM.getShadowRoot(n)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasNodes(n)) {
|
if (hasNodes(n)) {
|
||||||
return elementText(DOM.childNodesAsList(n));
|
return elementText(DOM.childNodesAsList(n));
|
||||||
}
|
}
|
||||||
|
|
||||||
return DOM.getText(n);
|
return DOM.getText(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isInInnerZone(): boolean {
|
export function isInInnerZone(): boolean {
|
||||||
|
@ -14,11 +14,9 @@ export class Log {
|
|||||||
return (a1 = null, a2 = null, a3 = null, a4 = null, a5 = null) => {
|
return (a1 = null, a2 = null, a3 = null, a4 = null, a5 = null) => {
|
||||||
ListWrapper.push(this._result, value);
|
ListWrapper.push(this._result, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result(): string {
|
result(): string { return ListWrapper.join(this._result, "; "); }
|
||||||
return ListWrapper.join(this._result, "; ");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function viewRootNodes(view): List</*node*/ any> {
|
export function viewRootNodes(view): List</*node*/ any> {
|
||||||
|
@ -3934,7 +3934,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gulp-clang-format": {
|
"gulp-clang-format": {
|
||||||
"version": "1.0.12",
|
"version": "1.0.13",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"gulp-util": {
|
"gulp-util": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
@ -4112,7 +4112,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clang-format": {
|
"clang-format": {
|
||||||
"version": "1.0.12"
|
"version": "1.0.14"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
12
npm-shrinkwrap.json
generated
12
npm-shrinkwrap.json
generated
@ -6073,9 +6073,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"gulp-clang-format": {
|
"gulp-clang-format": {
|
||||||
"version": "1.0.12",
|
"version": "1.0.13",
|
||||||
"from": "https://registry.npmjs.org/gulp-clang-format/-/gulp-clang-format-1.0.12.tgz",
|
"from": "https://registry.npmjs.org/gulp-clang-format/-/gulp-clang-format-1.0.13.tgz",
|
||||||
"resolved": "https://registry.npmjs.org/gulp-clang-format/-/gulp-clang-format-1.0.12.tgz",
|
"resolved": "https://registry.npmjs.org/gulp-clang-format/-/gulp-clang-format-1.0.13.tgz",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"gulp-util": {
|
"gulp-util": {
|
||||||
"version": "3.0.4",
|
"version": "3.0.4",
|
||||||
@ -6351,9 +6351,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"clang-format": {
|
"clang-format": {
|
||||||
"version": "1.0.12",
|
"version": "1.0.14",
|
||||||
"from": "https://registry.npmjs.org/clang-format/-/clang-format-1.0.12.tgz",
|
"from": "https://registry.npmjs.org/clang-format/-/clang-format-1.0.14.tgz",
|
||||||
"resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.0.12.tgz"
|
"resolved": "https://registry.npmjs.org/clang-format/-/clang-format-1.0.14.tgz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
"gulp": "^3.8.8",
|
"gulp": "^3.8.8",
|
||||||
"gulp-autoprefixer": "^2.1.0",
|
"gulp-autoprefixer": "^2.1.0",
|
||||||
"gulp-changed": "^1.0.0",
|
"gulp-changed": "^1.0.0",
|
||||||
"gulp-clang-format": "^1.0.12",
|
"gulp-clang-format": "^1.0.13",
|
||||||
"gulp-concat": "^2.5.2",
|
"gulp-concat": "^2.5.2",
|
||||||
"gulp-connect": "~1.0.5",
|
"gulp-connect": "~1.0.5",
|
||||||
"gulp-load-plugins": "^0.7.1",
|
"gulp-load-plugins": "^0.7.1",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user