style(lint): re-format modules/@angular
This commit is contained in:
@ -43,7 +43,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
if (name === 'innerHTML') {
|
||||
this.setInnerHTML(el, value);
|
||||
} else if (name === 'className') {
|
||||
el.attribs["class"] = el.className = value;
|
||||
el.attribs['class'] = el.className = value;
|
||||
} else {
|
||||
el[name] = value;
|
||||
}
|
||||
@ -65,32 +65,38 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
get attrToPropMap() { return _attrToPropMap; }
|
||||
|
||||
query(selector: any /** TODO #9100 */) { throw _notImplemented('query'); }
|
||||
querySelector(el: any /** TODO #9100 */, selector: string): any { return this.querySelectorAll(el, selector)[0]; }
|
||||
querySelector(el: any /** TODO #9100 */, selector: string): any {
|
||||
return this.querySelectorAll(el, selector)[0];
|
||||
}
|
||||
querySelectorAll(el: any /** TODO #9100 */, selector: string): any[] {
|
||||
var res: any[] /** TODO #9100 */ = [];
|
||||
var _recursive = (result: any /** TODO #9100 */, node: any /** TODO #9100 */, selector: any /** TODO #9100 */, matcher: any /** TODO #9100 */) => {
|
||||
var cNodes = node.childNodes;
|
||||
if (cNodes && cNodes.length > 0) {
|
||||
for (var i = 0; i < cNodes.length; i++) {
|
||||
var childNode = cNodes[i];
|
||||
if (this.elementMatches(childNode, selector, matcher)) {
|
||||
result.push(childNode);
|
||||
var _recursive =
|
||||
(result: any /** TODO #9100 */, node: any /** TODO #9100 */,
|
||||
selector: any /** TODO #9100 */, matcher: any /** TODO #9100 */) => {
|
||||
var cNodes = node.childNodes;
|
||||
if (cNodes && cNodes.length > 0) {
|
||||
for (var i = 0; i < cNodes.length; i++) {
|
||||
var childNode = cNodes[i];
|
||||
if (this.elementMatches(childNode, selector, matcher)) {
|
||||
result.push(childNode);
|
||||
}
|
||||
_recursive(result, childNode, selector, matcher);
|
||||
}
|
||||
}
|
||||
_recursive(result, childNode, selector, matcher);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
var matcher = new SelectorMatcher();
|
||||
matcher.addSelectables(CssSelector.parse(selector));
|
||||
_recursive(res, el, selector, matcher);
|
||||
return res;
|
||||
}
|
||||
elementMatches(node: any /** TODO #9100 */, selector: string, matcher: any /** TODO #9100 */ = null): boolean {
|
||||
elementMatches(
|
||||
node: any /** TODO #9100 */, selector: string,
|
||||
matcher: any /** TODO #9100 */ = null): boolean {
|
||||
if (this.isElementNode(node) && selector === '*') {
|
||||
return true;
|
||||
}
|
||||
var result = false;
|
||||
if (selector && selector.charAt(0) == "#") {
|
||||
if (selector && selector.charAt(0) == '#') {
|
||||
result = this.getAttribute(node, 'id') == selector.substring(1);
|
||||
} else if (selector) {
|
||||
var result = false;
|
||||
@ -111,7 +117,9 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
cssSelector.addClassName(classList[i]);
|
||||
}
|
||||
|
||||
matcher.match(cssSelector, function(selector: any /** TODO #9100 */, cb: any /** TODO #9100 */) { result = true; });
|
||||
matcher.match(
|
||||
cssSelector,
|
||||
function(selector: any /** TODO #9100 */, cb: any /** TODO #9100 */) { result = true; });
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -128,7 +136,9 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
listeners.push(listener);
|
||||
StringMapWrapper.set(listenersMap, evt, listeners);
|
||||
}
|
||||
onAndCancel(el: any /** TODO #9100 */, evt: any /** TODO #9100 */, listener: any /** TODO #9100 */): Function {
|
||||
onAndCancel(
|
||||
el: any /** TODO #9100 */, evt: any /** TODO #9100 */,
|
||||
listener: any /** TODO #9100 */): Function {
|
||||
this.on(el, evt, listener);
|
||||
return () => {
|
||||
ListWrapper.remove(StringMapWrapper.get<any[]>(el._eventListenersMap, evt), listener);
|
||||
@ -163,8 +173,12 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
return evt;
|
||||
}
|
||||
preventDefault(evt: any /** TODO #9100 */) { evt.returnValue = false; }
|
||||
isPrevented(evt: any /** TODO #9100 */): boolean { return isPresent(evt.returnValue) && !evt.returnValue; }
|
||||
getInnerHTML(el: any /** TODO #9100 */): string { return serializer.serialize(this.templateAwareRoot(el)); }
|
||||
isPrevented(evt: any /** TODO #9100 */): boolean {
|
||||
return isPresent(evt.returnValue) && !evt.returnValue;
|
||||
}
|
||||
getInnerHTML(el: any /** TODO #9100 */): string {
|
||||
return serializer.serialize(this.templateAwareRoot(el));
|
||||
}
|
||||
getTemplateContent(el: any /** TODO #9100 */): Node {
|
||||
return null; // no <template> support in parse5.
|
||||
}
|
||||
@ -226,7 +240,9 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
this.remove(node);
|
||||
treeAdapter.insertBefore(el.parent, node, el);
|
||||
}
|
||||
insertAllBefore(el: any /** TODO #9100 */, nodes: any /** TODO #9100 */) { nodes.forEach((n: any /** TODO #9100 */) => this.insertBefore(el, n)); }
|
||||
insertAllBefore(el: any /** TODO #9100 */, nodes: any /** TODO #9100 */) {
|
||||
nodes.forEach((n: any /** TODO #9100 */) => this.insertBefore(el, n));
|
||||
}
|
||||
insertAfter(el: any /** TODO #9100 */, node: any /** TODO #9100 */) {
|
||||
if (el.nextSibling) {
|
||||
this.insertBefore(el.nextSibling, node);
|
||||
@ -249,9 +265,9 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
// However, comment node instances return the comment content for textContent getter
|
||||
return isRecursive ? '' : el.data;
|
||||
} else if (isBlank(el.childNodes) || el.childNodes.length == 0) {
|
||||
return "";
|
||||
return '';
|
||||
} else {
|
||||
var textContent = "";
|
||||
var textContent = '';
|
||||
for (var i = 0; i < el.childNodes.length; i++) {
|
||||
textContent += this.getText(el.childNodes[i], true);
|
||||
}
|
||||
@ -272,7 +288,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
setChecked(el: any /** TODO #9100 */, value: boolean) { el.checked = value; }
|
||||
createComment(text: string): Comment { return treeAdapter.createCommentNode(text); }
|
||||
createTemplate(html: any /** TODO #9100 */): HTMLElement {
|
||||
var template = treeAdapter.createElement("template", 'http://www.w3.org/1999/xhtml', []);
|
||||
var template = treeAdapter.createElement('template', 'http://www.w3.org/1999/xhtml', []);
|
||||
var content = parser.parseFragment(html);
|
||||
treeAdapter.appendChild(template, content);
|
||||
return template;
|
||||
@ -280,15 +296,17 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
createElement(tagName: any /** TODO #9100 */): HTMLElement {
|
||||
return treeAdapter.createElement(tagName, 'http://www.w3.org/1999/xhtml', []);
|
||||
}
|
||||
createElementNS(ns: any /** TODO #9100 */, tagName: any /** TODO #9100 */): HTMLElement { return treeAdapter.createElement(tagName, ns, []); }
|
||||
createElementNS(ns: any /** TODO #9100 */, tagName: any /** TODO #9100 */): HTMLElement {
|
||||
return treeAdapter.createElement(tagName, ns, []);
|
||||
}
|
||||
createTextNode(text: string): Text {
|
||||
var t = <any>this.createComment(text);
|
||||
t.type = 'text';
|
||||
return t;
|
||||
}
|
||||
createScriptTag(attrName: string, attrValue: string): HTMLElement {
|
||||
return treeAdapter.createElement("script", 'http://www.w3.org/1999/xhtml',
|
||||
[{name: attrName, value: attrValue}]);
|
||||
return treeAdapter.createElement(
|
||||
'script', 'http://www.w3.org/1999/xhtml', [{name: attrName, value: attrValue}]);
|
||||
}
|
||||
createStyleElement(css: string): HTMLStyleElement {
|
||||
var style = this.createElement('style');
|
||||
@ -345,7 +363,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
return _recursive(node);
|
||||
}
|
||||
getElementsByClassName(element: any /** TODO #9100 */, name: string): HTMLElement[] {
|
||||
return this.querySelectorAll(element, "." + name);
|
||||
return this.querySelectorAll(element, '.' + name);
|
||||
}
|
||||
getElementsByTagName(element: any, name: string): HTMLElement[] {
|
||||
throw _notImplemented('getElementsByTagName');
|
||||
@ -353,8 +371,8 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
classList(element: any /** TODO #9100 */): string[] {
|
||||
var classAttrValue: any /** TODO #9100 */ = null;
|
||||
var attributes = element.attribs;
|
||||
if (attributes && attributes.hasOwnProperty("class")) {
|
||||
classAttrValue = attributes["class"];
|
||||
if (attributes && attributes.hasOwnProperty('class')) {
|
||||
classAttrValue = attributes['class'];
|
||||
}
|
||||
return classAttrValue ? classAttrValue.trim().split(/\s+/g) : [];
|
||||
}
|
||||
@ -363,7 +381,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
var index = classList.indexOf(className);
|
||||
if (index == -1) {
|
||||
classList.push(className);
|
||||
element.attribs["class"] = element.className = classList.join(" ");
|
||||
element.attribs['class'] = element.className = classList.join(' ');
|
||||
}
|
||||
}
|
||||
removeClass(element: any /** TODO #9100 */, className: string) {
|
||||
@ -371,7 +389,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
var index = classList.indexOf(className);
|
||||
if (index > -1) {
|
||||
classList.splice(index, 1);
|
||||
element.attribs["class"] = element.className = classList.join(" ");
|
||||
element.attribs['class'] = element.className = classList.join(' ');
|
||||
}
|
||||
}
|
||||
hasClass(element: any /** TODO #9100 */, className: string): boolean {
|
||||
@ -385,8 +403,8 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
_readStyleAttribute(element: any /** TODO #9100 */) {
|
||||
var styleMap = {};
|
||||
var attributes = element.attribs;
|
||||
if (attributes && attributes.hasOwnProperty("style")) {
|
||||
var styleAttrValue = attributes["style"];
|
||||
if (attributes && attributes.hasOwnProperty('style')) {
|
||||
var styleAttrValue = attributes['style'];
|
||||
var styleList = styleAttrValue.split(/;+/g);
|
||||
for (var i = 0; i < styleList.length; i++) {
|
||||
if (styleList[i].length > 0) {
|
||||
@ -399,26 +417,30 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
}
|
||||
/** @internal */
|
||||
_writeStyleAttribute(element: any /** TODO #9100 */, styleMap: any /** TODO #9100 */) {
|
||||
var styleAttrValue = "";
|
||||
var styleAttrValue = '';
|
||||
for (var key in styleMap) {
|
||||
var newValue = styleMap[key];
|
||||
if (newValue && newValue.length > 0) {
|
||||
styleAttrValue += key + ":" + styleMap[key] + ";";
|
||||
styleAttrValue += key + ':' + styleMap[key] + ';';
|
||||
}
|
||||
}
|
||||
element.attribs["style"] = styleAttrValue;
|
||||
element.attribs['style'] = styleAttrValue;
|
||||
}
|
||||
setStyle(element: any /** TODO #9100 */, styleName: string, styleValue: string) {
|
||||
var styleMap = this._readStyleAttribute(element);
|
||||
(styleMap as any /** TODO #9100 */)[styleName] = styleValue;
|
||||
this._writeStyleAttribute(element, styleMap);
|
||||
}
|
||||
removeStyle(element: any /** TODO #9100 */, styleName: string) { this.setStyle(element, styleName, null); }
|
||||
removeStyle(element: any /** TODO #9100 */, styleName: string) {
|
||||
this.setStyle(element, styleName, null);
|
||||
}
|
||||
getStyle(element: any /** TODO #9100 */, styleName: string): string {
|
||||
var styleMap = this._readStyleAttribute(element);
|
||||
return styleMap.hasOwnProperty(styleName) ? (styleMap as any /** TODO #9100 */)[styleName] : "";
|
||||
return styleMap.hasOwnProperty(styleName) ? (styleMap as any /** TODO #9100 */)[styleName] : '';
|
||||
}
|
||||
tagName(element: any /** TODO #9100 */): string {
|
||||
return element.tagName == 'style' ? 'STYLE' : element.tagName;
|
||||
}
|
||||
tagName(element: any /** TODO #9100 */): string { return element.tagName == "style" ? "STYLE" : element.tagName; }
|
||||
attributeMap(element: any /** TODO #9100 */): Map<string, string> {
|
||||
var res = new Map<string, string>();
|
||||
var elAttrs = treeAdapter.getAttrList(element);
|
||||
@ -431,13 +453,17 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
hasAttribute(element: any /** TODO #9100 */, attribute: string): boolean {
|
||||
return element.attribs && element.attribs.hasOwnProperty(attribute);
|
||||
}
|
||||
hasAttributeNS(element: any /** TODO #9100 */, ns: string, attribute: string): boolean { throw 'not implemented'; }
|
||||
hasAttributeNS(element: any /** TODO #9100 */, ns: string, attribute: string): boolean {
|
||||
throw 'not implemented';
|
||||
}
|
||||
getAttribute(element: any /** TODO #9100 */, attribute: string): string {
|
||||
return element.attribs && element.attribs.hasOwnProperty(attribute) ?
|
||||
element.attribs[attribute] :
|
||||
null;
|
||||
element.attribs[attribute] :
|
||||
null;
|
||||
}
|
||||
getAttributeNS(element: any /** TODO #9100 */, ns: string, attribute: string): string {
|
||||
throw 'not implemented';
|
||||
}
|
||||
getAttributeNS(element: any /** TODO #9100 */, ns: string, attribute: string): string { throw 'not implemented'; }
|
||||
setAttribute(element: any /** TODO #9100 */, attribute: string, value: string) {
|
||||
if (attribute) {
|
||||
element.attribs[attribute] = value;
|
||||
@ -446,24 +472,30 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
}
|
||||
}
|
||||
}
|
||||
setAttributeNS(element: any /** TODO #9100 */, ns: string, attribute: string, value: string) { throw 'not implemented'; }
|
||||
setAttributeNS(element: any /** TODO #9100 */, ns: string, attribute: string, value: string) {
|
||||
throw 'not implemented';
|
||||
}
|
||||
removeAttribute(element: any /** TODO #9100 */, attribute: string) {
|
||||
if (attribute) {
|
||||
StringMapWrapper.delete(element.attribs, attribute);
|
||||
}
|
||||
}
|
||||
removeAttributeNS(element: any /** TODO #9100 */, ns: string, name: string) { throw 'not implemented'; }
|
||||
templateAwareRoot(el: any /** TODO #9100 */): any { return this.isTemplateElement(el) ? this.content(el) : el; }
|
||||
removeAttributeNS(element: any /** TODO #9100 */, ns: string, name: string) {
|
||||
throw 'not implemented';
|
||||
}
|
||||
templateAwareRoot(el: any /** TODO #9100 */): any {
|
||||
return this.isTemplateElement(el) ? this.content(el) : el;
|
||||
}
|
||||
createHtmlDocument(): Document {
|
||||
var newDoc = treeAdapter.createDocument();
|
||||
newDoc.title = "fake title";
|
||||
var head = treeAdapter.createElement("head", null, []);
|
||||
var body = treeAdapter.createElement("body", 'http://www.w3.org/1999/xhtml', []);
|
||||
newDoc.title = 'fake title';
|
||||
var head = treeAdapter.createElement('head', null, []);
|
||||
var body = treeAdapter.createElement('body', 'http://www.w3.org/1999/xhtml', []);
|
||||
this.appendChild(newDoc, head);
|
||||
this.appendChild(newDoc, body);
|
||||
StringMapWrapper.set(newDoc, "head", head);
|
||||
StringMapWrapper.set(newDoc, "body", body);
|
||||
StringMapWrapper.set(newDoc, "_window", StringMapWrapper.create());
|
||||
StringMapWrapper.set(newDoc, 'head', head);
|
||||
StringMapWrapper.set(newDoc, 'body', body);
|
||||
StringMapWrapper.set(newDoc, '_window', StringMapWrapper.create());
|
||||
return newDoc;
|
||||
}
|
||||
defaultDoc(): Document {
|
||||
@ -472,15 +504,19 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
}
|
||||
return defDoc;
|
||||
}
|
||||
getBoundingClientRect(el: any /** TODO #9100 */): any { return {left: 0, top: 0, width: 0, height: 0}; }
|
||||
getTitle(): string { return this.defaultDoc().title || ""; }
|
||||
getBoundingClientRect(el: any /** TODO #9100 */): any {
|
||||
return {left: 0, top: 0, width: 0, height: 0};
|
||||
}
|
||||
getTitle(): string { return this.defaultDoc().title || ''; }
|
||||
setTitle(newTitle: string) { this.defaultDoc().title = newTitle; }
|
||||
isTemplateElement(el: any): boolean {
|
||||
return this.isElementNode(el) && this.tagName(el) === "template";
|
||||
return this.isElementNode(el) && this.tagName(el) === 'template';
|
||||
}
|
||||
isTextNode(node: any /** TODO #9100 */): boolean { return treeAdapter.isTextNode(node); }
|
||||
isCommentNode(node: any /** TODO #9100 */): boolean { return treeAdapter.isCommentNode(node); }
|
||||
isElementNode(node: any /** TODO #9100 */): boolean { return node ? treeAdapter.isElementNode(node) : false; }
|
||||
isElementNode(node: any /** TODO #9100 */): boolean {
|
||||
return node ? treeAdapter.isElementNode(node) : false;
|
||||
}
|
||||
hasShadowRoot(node: any /** TODO #9100 */): boolean { return isPresent(node.shadowRoot); }
|
||||
isShadowRoot(node: any /** TODO #9100 */): boolean { return this.getShadowRoot(node) == node; }
|
||||
importIntoDoc(node: any /** TODO #9100 */): any { return this.clone(node); }
|
||||
@ -499,31 +535,32 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
for (var i = 0; i < parsedRules.length; i++) {
|
||||
var parsedRule = parsedRules[i];
|
||||
var rule: {[key: string]: any} = StringMapWrapper.create();
|
||||
StringMapWrapper.set(rule, "cssText", css);
|
||||
StringMapWrapper.set(rule, "style", {content: "", cssText: ""});
|
||||
if (parsedRule.type == "rule") {
|
||||
StringMapWrapper.set(rule, "type", 1);
|
||||
StringMapWrapper.set(rule, "selectorText", parsedRule.selectors.join(", ")
|
||||
.replace(/\s{2,}/g, " ")
|
||||
.replace(/\s*~\s*/g, " ~ ")
|
||||
.replace(/\s*\+\s*/g, " + ")
|
||||
.replace(/\s*>\s*/g, " > ")
|
||||
.replace(/\[(\w+)=(\w+)\]/g, '[$1="$2"]'));
|
||||
StringMapWrapper.set(rule, 'cssText', css);
|
||||
StringMapWrapper.set(rule, 'style', {content: '', cssText: ''});
|
||||
if (parsedRule.type == 'rule') {
|
||||
StringMapWrapper.set(rule, 'type', 1);
|
||||
StringMapWrapper.set(
|
||||
rule, 'selectorText', parsedRule.selectors.join(', ')
|
||||
.replace(/\s{2,}/g, ' ')
|
||||
.replace(/\s*~\s*/g, ' ~ ')
|
||||
.replace(/\s*\+\s*/g, ' + ')
|
||||
.replace(/\s*>\s*/g, ' > ')
|
||||
.replace(/\[(\w+)=(\w+)\]/g, '[$1="$2"]'));
|
||||
if (isBlank(parsedRule.declarations)) {
|
||||
continue;
|
||||
}
|
||||
for (var j = 0; j < parsedRule.declarations.length; j++) {
|
||||
var declaration = parsedRule.declarations[j];
|
||||
StringMapWrapper.set(StringMapWrapper.get(rule, "style"), declaration.property,
|
||||
declaration.value);
|
||||
StringMapWrapper.get(rule, "style").cssText +=
|
||||
declaration.property + ": " + declaration.value + ";";
|
||||
StringMapWrapper.set(
|
||||
StringMapWrapper.get(rule, 'style'), declaration.property, declaration.value);
|
||||
StringMapWrapper.get(rule, 'style').cssText +=
|
||||
declaration.property + ': ' + declaration.value + ';';
|
||||
}
|
||||
} else if (parsedRule.type == "media") {
|
||||
StringMapWrapper.set(rule, "type", 4);
|
||||
StringMapWrapper.set(rule, "media", {mediaText: parsedRule.media});
|
||||
} else if (parsedRule.type == 'media') {
|
||||
StringMapWrapper.set(rule, 'type', 4);
|
||||
StringMapWrapper.set(rule, 'media', {mediaText: parsedRule.media});
|
||||
if (parsedRule.rules) {
|
||||
StringMapWrapper.set(rule, "cssRules", this._buildRules(parsedRule.rules));
|
||||
StringMapWrapper.set(rule, 'cssRules', this._buildRules(parsedRule.rules));
|
||||
}
|
||||
}
|
||||
rules.push(rule);
|
||||
@ -533,11 +570,11 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
supportsDOMEvents(): boolean { return false; }
|
||||
supportsNativeShadowDOM(): boolean { return false; }
|
||||
getGlobalEventTarget(target: string): any {
|
||||
if (target == "window") {
|
||||
if (target == 'window') {
|
||||
return (<any>this.defaultDoc())._window;
|
||||
} else if (target == "document") {
|
||||
} else if (target == 'document') {
|
||||
return this.defaultDoc();
|
||||
} else if (target == "body") {
|
||||
} else if (target == 'body') {
|
||||
return this.defaultDoc().body;
|
||||
}
|
||||
}
|
||||
@ -545,10 +582,14 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
resetBaseElement(): void { throw 'not implemented'; }
|
||||
getHistory(): History { throw 'not implemented'; }
|
||||
getLocation(): Location { throw 'not implemented'; }
|
||||
getUserAgent(): string { return "Fake user agent"; }
|
||||
getData(el: any /** TODO #9100 */, name: string): string { return this.getAttribute(el, 'data-' + name); }
|
||||
getUserAgent(): string { return 'Fake user agent'; }
|
||||
getData(el: any /** TODO #9100 */, name: string): string {
|
||||
return this.getAttribute(el, 'data-' + name);
|
||||
}
|
||||
getComputedStyle(el: any /** TODO #9100 */): any { throw 'not implemented'; }
|
||||
setData(el: any /** TODO #9100 */, name: string, value: string) { this.setAttribute(el, 'data-' + name, value); }
|
||||
setData(el: any /** TODO #9100 */, name: string, value: string) {
|
||||
this.setAttribute(el, 'data-' + name, value);
|
||||
}
|
||||
// TODO(tbosch): move this into a separate environment class once we have it
|
||||
setGlobalVar(path: string, value: any) { setValueOnPath(global, path, value); }
|
||||
requestAnimationFrame(callback: any /** TODO #9100 */): number { return setTimeout(callback, 0); }
|
||||
@ -559,7 +600,10 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
getTransitionEnd(): string { return 'transitionend'; }
|
||||
supportsAnimation(): boolean { return true; }
|
||||
|
||||
replaceChild(el: any /** TODO #9100 */, newNode: any /** TODO #9100 */, oldNode: any /** TODO #9100 */) { throw new Error('not implemented'); }
|
||||
replaceChild(
|
||||
el: any /** TODO #9100 */, newNode: any /** TODO #9100 */, oldNode: any /** TODO #9100 */) {
|
||||
throw new Error('not implemented');
|
||||
}
|
||||
parse(templateHtml: string) { throw new Error('not implemented'); }
|
||||
invoke(el: Element, methodName: string, args: any[]): any { throw new Error('not implemented'); }
|
||||
getEventKey(event: any /** TODO #9100 */): string { throw new Error('not implemented'); }
|
||||
@ -572,186 +616,186 @@ export class Parse5DomAdapter extends DomAdapter {
|
||||
|
||||
// TODO: build a proper list, this one is all the keys of a HTMLInputElement
|
||||
var _HTMLElementPropertyList = [
|
||||
"webkitEntries",
|
||||
"incremental",
|
||||
"webkitdirectory",
|
||||
"selectionDirection",
|
||||
"selectionEnd",
|
||||
"selectionStart",
|
||||
"labels",
|
||||
"validationMessage",
|
||||
"validity",
|
||||
"willValidate",
|
||||
"width",
|
||||
"valueAsNumber",
|
||||
"valueAsDate",
|
||||
"value",
|
||||
"useMap",
|
||||
"defaultValue",
|
||||
"type",
|
||||
"step",
|
||||
"src",
|
||||
"size",
|
||||
"required",
|
||||
"readOnly",
|
||||
"placeholder",
|
||||
"pattern",
|
||||
"name",
|
||||
"multiple",
|
||||
"min",
|
||||
"minLength",
|
||||
"maxLength",
|
||||
"max",
|
||||
"list",
|
||||
"indeterminate",
|
||||
"height",
|
||||
"formTarget",
|
||||
"formNoValidate",
|
||||
"formMethod",
|
||||
"formEnctype",
|
||||
"formAction",
|
||||
"files",
|
||||
"form",
|
||||
"disabled",
|
||||
"dirName",
|
||||
"checked",
|
||||
"defaultChecked",
|
||||
"autofocus",
|
||||
"autocomplete",
|
||||
"alt",
|
||||
"align",
|
||||
"accept",
|
||||
"onautocompleteerror",
|
||||
"onautocomplete",
|
||||
"onwaiting",
|
||||
"onvolumechange",
|
||||
"ontoggle",
|
||||
"ontimeupdate",
|
||||
"onsuspend",
|
||||
"onsubmit",
|
||||
"onstalled",
|
||||
"onshow",
|
||||
"onselect",
|
||||
"onseeking",
|
||||
"onseeked",
|
||||
"onscroll",
|
||||
"onresize",
|
||||
"onreset",
|
||||
"onratechange",
|
||||
"onprogress",
|
||||
"onplaying",
|
||||
"onplay",
|
||||
"onpause",
|
||||
"onmousewheel",
|
||||
"onmouseup",
|
||||
"onmouseover",
|
||||
"onmouseout",
|
||||
"onmousemove",
|
||||
"onmouseleave",
|
||||
"onmouseenter",
|
||||
"onmousedown",
|
||||
"onloadstart",
|
||||
"onloadedmetadata",
|
||||
"onloadeddata",
|
||||
"onload",
|
||||
"onkeyup",
|
||||
"onkeypress",
|
||||
"onkeydown",
|
||||
"oninvalid",
|
||||
"oninput",
|
||||
"onfocus",
|
||||
"onerror",
|
||||
"onended",
|
||||
"onemptied",
|
||||
"ondurationchange",
|
||||
"ondrop",
|
||||
"ondragstart",
|
||||
"ondragover",
|
||||
"ondragleave",
|
||||
"ondragenter",
|
||||
"ondragend",
|
||||
"ondrag",
|
||||
"ondblclick",
|
||||
"oncuechange",
|
||||
"oncontextmenu",
|
||||
"onclose",
|
||||
"onclick",
|
||||
"onchange",
|
||||
"oncanplaythrough",
|
||||
"oncanplay",
|
||||
"oncancel",
|
||||
"onblur",
|
||||
"onabort",
|
||||
"spellcheck",
|
||||
"isContentEditable",
|
||||
"contentEditable",
|
||||
"outerText",
|
||||
"innerText",
|
||||
"accessKey",
|
||||
"hidden",
|
||||
"webkitdropzone",
|
||||
"draggable",
|
||||
"tabIndex",
|
||||
"dir",
|
||||
"translate",
|
||||
"lang",
|
||||
"title",
|
||||
"childElementCount",
|
||||
"lastElementChild",
|
||||
"firstElementChild",
|
||||
"children",
|
||||
"onwebkitfullscreenerror",
|
||||
"onwebkitfullscreenchange",
|
||||
"nextElementSibling",
|
||||
"previousElementSibling",
|
||||
"onwheel",
|
||||
"onselectstart",
|
||||
"onsearch",
|
||||
"onpaste",
|
||||
"oncut",
|
||||
"oncopy",
|
||||
"onbeforepaste",
|
||||
"onbeforecut",
|
||||
"onbeforecopy",
|
||||
"shadowRoot",
|
||||
"dataset",
|
||||
"classList",
|
||||
"className",
|
||||
"outerHTML",
|
||||
"innerHTML",
|
||||
"scrollHeight",
|
||||
"scrollWidth",
|
||||
"scrollTop",
|
||||
"scrollLeft",
|
||||
"clientHeight",
|
||||
"clientWidth",
|
||||
"clientTop",
|
||||
"clientLeft",
|
||||
"offsetParent",
|
||||
"offsetHeight",
|
||||
"offsetWidth",
|
||||
"offsetTop",
|
||||
"offsetLeft",
|
||||
"localName",
|
||||
"prefix",
|
||||
"namespaceURI",
|
||||
"id",
|
||||
"style",
|
||||
"attributes",
|
||||
"tagName",
|
||||
"parentElement",
|
||||
"textContent",
|
||||
"baseURI",
|
||||
"ownerDocument",
|
||||
"nextSibling",
|
||||
"previousSibling",
|
||||
"lastChild",
|
||||
"firstChild",
|
||||
"childNodes",
|
||||
"parentNode",
|
||||
"nodeType",
|
||||
"nodeValue",
|
||||
"nodeName",
|
||||
"closure_lm_714617",
|
||||
"__jsaction"
|
||||
'webkitEntries',
|
||||
'incremental',
|
||||
'webkitdirectory',
|
||||
'selectionDirection',
|
||||
'selectionEnd',
|
||||
'selectionStart',
|
||||
'labels',
|
||||
'validationMessage',
|
||||
'validity',
|
||||
'willValidate',
|
||||
'width',
|
||||
'valueAsNumber',
|
||||
'valueAsDate',
|
||||
'value',
|
||||
'useMap',
|
||||
'defaultValue',
|
||||
'type',
|
||||
'step',
|
||||
'src',
|
||||
'size',
|
||||
'required',
|
||||
'readOnly',
|
||||
'placeholder',
|
||||
'pattern',
|
||||
'name',
|
||||
'multiple',
|
||||
'min',
|
||||
'minLength',
|
||||
'maxLength',
|
||||
'max',
|
||||
'list',
|
||||
'indeterminate',
|
||||
'height',
|
||||
'formTarget',
|
||||
'formNoValidate',
|
||||
'formMethod',
|
||||
'formEnctype',
|
||||
'formAction',
|
||||
'files',
|
||||
'form',
|
||||
'disabled',
|
||||
'dirName',
|
||||
'checked',
|
||||
'defaultChecked',
|
||||
'autofocus',
|
||||
'autocomplete',
|
||||
'alt',
|
||||
'align',
|
||||
'accept',
|
||||
'onautocompleteerror',
|
||||
'onautocomplete',
|
||||
'onwaiting',
|
||||
'onvolumechange',
|
||||
'ontoggle',
|
||||
'ontimeupdate',
|
||||
'onsuspend',
|
||||
'onsubmit',
|
||||
'onstalled',
|
||||
'onshow',
|
||||
'onselect',
|
||||
'onseeking',
|
||||
'onseeked',
|
||||
'onscroll',
|
||||
'onresize',
|
||||
'onreset',
|
||||
'onratechange',
|
||||
'onprogress',
|
||||
'onplaying',
|
||||
'onplay',
|
||||
'onpause',
|
||||
'onmousewheel',
|
||||
'onmouseup',
|
||||
'onmouseover',
|
||||
'onmouseout',
|
||||
'onmousemove',
|
||||
'onmouseleave',
|
||||
'onmouseenter',
|
||||
'onmousedown',
|
||||
'onloadstart',
|
||||
'onloadedmetadata',
|
||||
'onloadeddata',
|
||||
'onload',
|
||||
'onkeyup',
|
||||
'onkeypress',
|
||||
'onkeydown',
|
||||
'oninvalid',
|
||||
'oninput',
|
||||
'onfocus',
|
||||
'onerror',
|
||||
'onended',
|
||||
'onemptied',
|
||||
'ondurationchange',
|
||||
'ondrop',
|
||||
'ondragstart',
|
||||
'ondragover',
|
||||
'ondragleave',
|
||||
'ondragenter',
|
||||
'ondragend',
|
||||
'ondrag',
|
||||
'ondblclick',
|
||||
'oncuechange',
|
||||
'oncontextmenu',
|
||||
'onclose',
|
||||
'onclick',
|
||||
'onchange',
|
||||
'oncanplaythrough',
|
||||
'oncanplay',
|
||||
'oncancel',
|
||||
'onblur',
|
||||
'onabort',
|
||||
'spellcheck',
|
||||
'isContentEditable',
|
||||
'contentEditable',
|
||||
'outerText',
|
||||
'innerText',
|
||||
'accessKey',
|
||||
'hidden',
|
||||
'webkitdropzone',
|
||||
'draggable',
|
||||
'tabIndex',
|
||||
'dir',
|
||||
'translate',
|
||||
'lang',
|
||||
'title',
|
||||
'childElementCount',
|
||||
'lastElementChild',
|
||||
'firstElementChild',
|
||||
'children',
|
||||
'onwebkitfullscreenerror',
|
||||
'onwebkitfullscreenchange',
|
||||
'nextElementSibling',
|
||||
'previousElementSibling',
|
||||
'onwheel',
|
||||
'onselectstart',
|
||||
'onsearch',
|
||||
'onpaste',
|
||||
'oncut',
|
||||
'oncopy',
|
||||
'onbeforepaste',
|
||||
'onbeforecut',
|
||||
'onbeforecopy',
|
||||
'shadowRoot',
|
||||
'dataset',
|
||||
'classList',
|
||||
'className',
|
||||
'outerHTML',
|
||||
'innerHTML',
|
||||
'scrollHeight',
|
||||
'scrollWidth',
|
||||
'scrollTop',
|
||||
'scrollLeft',
|
||||
'clientHeight',
|
||||
'clientWidth',
|
||||
'clientTop',
|
||||
'clientLeft',
|
||||
'offsetParent',
|
||||
'offsetHeight',
|
||||
'offsetWidth',
|
||||
'offsetTop',
|
||||
'offsetLeft',
|
||||
'localName',
|
||||
'prefix',
|
||||
'namespaceURI',
|
||||
'id',
|
||||
'style',
|
||||
'attributes',
|
||||
'tagName',
|
||||
'parentElement',
|
||||
'textContent',
|
||||
'baseURI',
|
||||
'ownerDocument',
|
||||
'nextSibling',
|
||||
'previousSibling',
|
||||
'lastChild',
|
||||
'firstChild',
|
||||
'childNodes',
|
||||
'parentNode',
|
||||
'nodeType',
|
||||
'nodeValue',
|
||||
'nodeName',
|
||||
'closure_lm_714617',
|
||||
'__jsaction'
|
||||
];
|
||||
|
@ -1,30 +1,13 @@
|
||||
import {
|
||||
APP_ID,
|
||||
NgZone,
|
||||
PLATFORM_COMMON_PROVIDERS,
|
||||
PLATFORM_INITIALIZER,
|
||||
APPLICATION_COMMON_PROVIDERS,
|
||||
RootRenderer
|
||||
} from '@angular/core';
|
||||
import {DirectiveResolver, ViewResolver, XHR, COMPILER_PROVIDERS} from '@angular/compiler';
|
||||
import {
|
||||
TestComponentBuilder,
|
||||
MockDirectiveResolver,
|
||||
MockViewResolver,
|
||||
TestComponentRenderer
|
||||
} from '@angular/compiler/testing';
|
||||
import {Parse5DomAdapter} from '../index';
|
||||
import {MockLocationStrategy} from '@angular/common/testing';
|
||||
import {COMPILER_PROVIDERS, DirectiveResolver, ViewResolver, XHR} from '@angular/compiler';
|
||||
import {MockDirectiveResolver, MockViewResolver, TestComponentBuilder, TestComponentRenderer} from '@angular/compiler/testing';
|
||||
import {APPLICATION_COMMON_PROVIDERS, APP_ID, NgZone, PLATFORM_COMMON_PROVIDERS, PLATFORM_INITIALIZER, RootRenderer} from '@angular/core';
|
||||
import {BrowserDetection, DOMTestComponentRenderer} from '@angular/platform-browser/testing';
|
||||
|
||||
import {AnimationDriver, NoOpAnimationDriver} from '../core_private';
|
||||
import {
|
||||
DOCUMENT,
|
||||
BROWSER_SANITIZATION_PROVIDERS,
|
||||
EventManager,
|
||||
EVENT_MANAGER_PLUGINS,
|
||||
ELEMENT_PROBE_PROVIDERS,
|
||||
DomEventsPlugin,
|
||||
} from '@angular/platform-browser';
|
||||
import {Parse5DomAdapter} from '../index';
|
||||
|
||||
import {DOCUMENT, BROWSER_SANITIZATION_PROVIDERS, EventManager, EVENT_MANAGER_PLUGINS, ELEMENT_PROBE_PROVIDERS, DomEventsPlugin,} from '@angular/platform-browser';
|
||||
import {getDOM, DomRootRenderer, DomRootRenderer_, DomSharedStylesHost, SharedStylesHost} from '../platform_browser_private';
|
||||
import {LocationStrategy} from '@angular/common';
|
||||
import {Log} from '@angular/core/testing';
|
||||
@ -40,7 +23,11 @@ function initServerTests() {
|
||||
export const TEST_SERVER_PLATFORM_PROVIDERS: Array<any /*Type | Provider | any[]*/> =
|
||||
/*@ts2dart_const*/[
|
||||
PLATFORM_COMMON_PROVIDERS,
|
||||
/*@ts2dart_Provider*/ {provide: PLATFORM_INITIALIZER, useValue: initServerTests, multi: true}
|
||||
/*@ts2dart_Provider*/ {
|
||||
provide: PLATFORM_INITIALIZER,
|
||||
useValue: initServerTests,
|
||||
multi: true
|
||||
}
|
||||
];
|
||||
|
||||
function appDoc() {
|
||||
@ -64,23 +51,23 @@ export const TEST_SERVER_APPLICATION_PROVIDERS: Array<any /*Type | Provider | an
|
||||
/*@ts2dart_const*/[
|
||||
// TODO(julie: when angular2/platform/server is available, use that instead of making our own
|
||||
// list here.
|
||||
APPLICATION_COMMON_PROVIDERS,
|
||||
COMPILER_PROVIDERS,
|
||||
BROWSER_SANITIZATION_PROVIDERS,
|
||||
APPLICATION_COMMON_PROVIDERS, COMPILER_PROVIDERS, BROWSER_SANITIZATION_PROVIDERS,
|
||||
/* @ts2dart_Provider */ {provide: DOCUMENT, useFactory: appDoc},
|
||||
/* @ts2dart_Provider */ {provide: DomRootRenderer, useClass: DomRootRenderer_},
|
||||
/* @ts2dart_Provider */ {provide: RootRenderer, useExisting: DomRootRenderer},
|
||||
/* @ts2dart_Provider */ {provide: AnimationDriver, useClass: NoOpAnimationDriver},
|
||||
EventManager,
|
||||
/* @ts2dart_Provider */ {provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true},
|
||||
/* @ts2dart_Provider */ {
|
||||
provide: EVENT_MANAGER_PLUGINS,
|
||||
useClass: DomEventsPlugin,
|
||||
multi: true
|
||||
},
|
||||
/* @ts2dart_Provider */ {provide: XHR, useClass: XHR},
|
||||
/* @ts2dart_Provider */ {provide: APP_ID, useValue: 'a'},
|
||||
/* @ts2dart_Provider */ {provide: SharedStylesHost, useExisting: DomSharedStylesHost},
|
||||
DomSharedStylesHost,
|
||||
ELEMENT_PROBE_PROVIDERS,
|
||||
DomSharedStylesHost, ELEMENT_PROBE_PROVIDERS,
|
||||
/* @ts2dart_Provider */ {provide: DirectiveResolver, useClass: MockDirectiveResolver},
|
||||
/* @ts2dart_Provider */ {provide: ViewResolver, useClass: MockViewResolver},
|
||||
Log,
|
||||
/* @ts2dart_Provider */ {provide: ViewResolver, useClass: MockViewResolver}, Log,
|
||||
/* @ts2dart_Provider */ {provide: TestComponentRenderer, useClass: DOMTestComponentRenderer},
|
||||
TestComponentBuilder,
|
||||
/* @ts2dart_Provider */ {provide: NgZone, useFactory: createNgZone},
|
||||
|
Reference in New Issue
Block a user