|
|
|
@ -6,28 +6,27 @@
|
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
var parse5 = require('parse5/index');
|
|
|
|
|
const parse5 = require('parse5');
|
|
|
|
|
|
|
|
|
|
import {ListWrapper, StringMapWrapper} from '../src/facade/collection';
|
|
|
|
|
import {DomAdapter, setRootDomAdapter} from './private_import_platform-browser';
|
|
|
|
|
import {isPresent, isBlank, global, setValueOnPath, DateWrapper} from '../src/facade/lang';
|
|
|
|
|
import {isPresent, isBlank, global, setValueOnPath} from '../src/facade/lang';
|
|
|
|
|
import {SelectorMatcher, CssSelector} from './private_import_compiler';
|
|
|
|
|
|
|
|
|
|
var parser: any /** TODO #9100 */ = null;
|
|
|
|
|
var serializer: any /** TODO #9100 */ = null;
|
|
|
|
|
var treeAdapter: any /** TODO #9100 */ = null;
|
|
|
|
|
let treeAdapter: any;
|
|
|
|
|
|
|
|
|
|
var _attrToPropMap: {[key: string]: string} = {
|
|
|
|
|
const _attrToPropMap: {[key: string]: string} = {
|
|
|
|
|
'class': 'className',
|
|
|
|
|
'innerHtml': 'innerHTML',
|
|
|
|
|
'readonly': 'readOnly',
|
|
|
|
|
'tabindex': 'tabIndex',
|
|
|
|
|
};
|
|
|
|
|
var defDoc: any /** TODO #9100 */ = null;
|
|
|
|
|
|
|
|
|
|
var mapProps = ['attribs', 'x-attribsNamespace', 'x-attribsPrefix'];
|
|
|
|
|
let defDoc: any = null;
|
|
|
|
|
|
|
|
|
|
function _notImplemented(methodName: any /** TODO #9100 */) {
|
|
|
|
|
const mapProps = ['attribs', 'x-attribsNamespace', 'x-attribsPrefix'];
|
|
|
|
|
|
|
|
|
|
function _notImplemented(methodName: string) {
|
|
|
|
|
return new Error('This method is not implemented in Parse5DomAdapter: ' + methodName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -40,18 +39,16 @@ function _notImplemented(methodName: any /** TODO #9100 */) {
|
|
|
|
|
*/
|
|
|
|
|
export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
static makeCurrent() {
|
|
|
|
|
parser = new parse5.Parser(parse5.TreeAdapters.htmlparser2);
|
|
|
|
|
serializer = new parse5.Serializer(parse5.TreeAdapters.htmlparser2);
|
|
|
|
|
treeAdapter = parser.treeAdapter;
|
|
|
|
|
treeAdapter = parse5.treeAdapters.htmlparser2;
|
|
|
|
|
setRootDomAdapter(new Parse5DomAdapter());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
hasProperty(element: any /** TODO #9100 */, name: string): boolean {
|
|
|
|
|
hasProperty(element: any, name: string): boolean {
|
|
|
|
|
return _HTMLElementPropertyList.indexOf(name) > -1;
|
|
|
|
|
}
|
|
|
|
|
// TODO(tbosch): don't even call this method when we run the tests on server side
|
|
|
|
|
// by not using the DomRenderer in tests. Keeping this for now to make tests happy...
|
|
|
|
|
setProperty(el: /*element*/ any, name: string, value: any) {
|
|
|
|
|
setProperty(el: any, name: string, value: any) {
|
|
|
|
|
if (name === 'innerHTML') {
|
|
|
|
|
this.setInnerHTML(el, value);
|
|
|
|
|
} else if (name === 'className') {
|
|
|
|
@ -62,173 +59,158 @@ export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
}
|
|
|
|
|
// TODO(tbosch): don't even call this method when we run the tests on server side
|
|
|
|
|
// by not using the DomRenderer in tests. Keeping this for now to make tests happy...
|
|
|
|
|
getProperty(el: /*element*/ any, name: string): any { return el[name]; }
|
|
|
|
|
getProperty(el: any, name: string): any { return el[name]; }
|
|
|
|
|
|
|
|
|
|
logError(error: any /** TODO #9100 */) { console.error(error); }
|
|
|
|
|
logError(error: string) { console.error(error); }
|
|
|
|
|
|
|
|
|
|
log(error: any /** TODO #9100 */) { console.log(error); }
|
|
|
|
|
log(error: string) { console.log(error); }
|
|
|
|
|
|
|
|
|
|
logGroup(error: any /** TODO #9100 */) { console.error(error); }
|
|
|
|
|
logGroup(error: string) { console.error(error); }
|
|
|
|
|
|
|
|
|
|
logGroupEnd() {}
|
|
|
|
|
|
|
|
|
|
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];
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
_recursive(result, childNode, selector, matcher);
|
|
|
|
|
}
|
|
|
|
|
query(selector: any) { throw _notImplemented('query'); }
|
|
|
|
|
querySelector(el: any, selector: string): any { return this.querySelectorAll(el, selector)[0]; }
|
|
|
|
|
querySelectorAll(el: any, selector: string): any[] {
|
|
|
|
|
const res: any[] = [];
|
|
|
|
|
const _recursive = (result: any, node: any, selector: any, matcher: any) => {
|
|
|
|
|
let cNodes = node.childNodes;
|
|
|
|
|
if (cNodes && cNodes.length > 0) {
|
|
|
|
|
for (let i = 0; i < cNodes.length; i++) {
|
|
|
|
|
const childNode = cNodes[i];
|
|
|
|
|
if (this.elementMatches(childNode, selector, matcher)) {
|
|
|
|
|
result.push(childNode);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
var matcher = new SelectorMatcher();
|
|
|
|
|
_recursive(result, childNode, selector, matcher);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
const 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, selector: string, matcher: any = null): boolean {
|
|
|
|
|
if (this.isElementNode(node) && selector === '*') {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
var result = false;
|
|
|
|
|
let result = false;
|
|
|
|
|
if (selector && selector.charAt(0) == '#') {
|
|
|
|
|
result = this.getAttribute(node, 'id') == selector.substring(1);
|
|
|
|
|
} else if (selector) {
|
|
|
|
|
var result = false;
|
|
|
|
|
if (matcher == null) {
|
|
|
|
|
if (!matcher) {
|
|
|
|
|
matcher = new SelectorMatcher();
|
|
|
|
|
matcher.addSelectables(CssSelector.parse(selector));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var cssSelector = new CssSelector();
|
|
|
|
|
const cssSelector = new CssSelector();
|
|
|
|
|
cssSelector.setElement(this.tagName(node));
|
|
|
|
|
if (node.attribs) {
|
|
|
|
|
for (var attrName in node.attribs) {
|
|
|
|
|
for (const attrName in node.attribs) {
|
|
|
|
|
cssSelector.addAttribute(attrName, node.attribs[attrName]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var classList = this.classList(node);
|
|
|
|
|
for (var i = 0; i < classList.length; i++) {
|
|
|
|
|
const classList = this.classList(node);
|
|
|
|
|
for (let i = 0; i < classList.length; i++) {
|
|
|
|
|
cssSelector.addClassName(classList[i]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
matcher.match(
|
|
|
|
|
cssSelector,
|
|
|
|
|
function(selector: any /** TODO #9100 */, cb: any /** TODO #9100 */) { result = true; });
|
|
|
|
|
matcher.match(cssSelector, function(selector: any, cb: any) { result = true; });
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
on(el: any /** TODO #9100 */, evt: any /** TODO #9100 */, listener: any /** TODO #9100 */) {
|
|
|
|
|
var listenersMap: {[k: string]: any} = el._eventListenersMap;
|
|
|
|
|
on(el: any, evt: any, listener: any) {
|
|
|
|
|
let listenersMap: {[k: string]: any} = el._eventListenersMap;
|
|
|
|
|
if (!listenersMap) {
|
|
|
|
|
var listenersMap: {[k: string]: any} = {};
|
|
|
|
|
listenersMap = {};
|
|
|
|
|
el._eventListenersMap = listenersMap;
|
|
|
|
|
}
|
|
|
|
|
const listeners = listenersMap[evt] || [];
|
|
|
|
|
listenersMap[evt] = [...listeners, listener];
|
|
|
|
|
}
|
|
|
|
|
onAndCancel(
|
|
|
|
|
el: any /** TODO #9100 */, evt: any /** TODO #9100 */,
|
|
|
|
|
listener: any /** TODO #9100 */): Function {
|
|
|
|
|
onAndCancel(el: any, evt: any, listener: any): Function {
|
|
|
|
|
this.on(el, evt, listener);
|
|
|
|
|
return () => { ListWrapper.remove(<any[]>(el._eventListenersMap[evt]), listener); };
|
|
|
|
|
}
|
|
|
|
|
dispatchEvent(el: any /** TODO #9100 */, evt: any /** TODO #9100 */) {
|
|
|
|
|
if (isBlank(evt.target)) {
|
|
|
|
|
dispatchEvent(el: any, evt: any) {
|
|
|
|
|
if (!evt.target) {
|
|
|
|
|
evt.target = el;
|
|
|
|
|
}
|
|
|
|
|
if (isPresent(el._eventListenersMap)) {
|
|
|
|
|
var listeners: any = el._eventListenersMap[evt.type];
|
|
|
|
|
if (isPresent(listeners)) {
|
|
|
|
|
for (var i = 0; i < listeners.length; i++) {
|
|
|
|
|
if (el._eventListenersMap) {
|
|
|
|
|
const listeners: any = el._eventListenersMap[evt.type];
|
|
|
|
|
if (listeners) {
|
|
|
|
|
for (let i = 0; i < listeners.length; i++) {
|
|
|
|
|
listeners[i](evt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (isPresent(el.parent)) {
|
|
|
|
|
if (el.parent) {
|
|
|
|
|
this.dispatchEvent(el.parent, evt);
|
|
|
|
|
}
|
|
|
|
|
if (isPresent(el._window)) {
|
|
|
|
|
if (el._window) {
|
|
|
|
|
this.dispatchEvent(el._window, evt);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
createMouseEvent(eventType: any /** TODO #9100 */): Event { return this.createEvent(eventType); }
|
|
|
|
|
createMouseEvent(eventType: any): Event { return this.createEvent(eventType); }
|
|
|
|
|
createEvent(eventType: string): Event {
|
|
|
|
|
var evt = <Event>{
|
|
|
|
|
let event = <Event>{
|
|
|
|
|
type: eventType,
|
|
|
|
|
defaultPrevented: false,
|
|
|
|
|
preventDefault: () => { (<any>evt).defaultPrevented = true; }
|
|
|
|
|
preventDefault: () => { (<any>event).defaultPrevented = true; }
|
|
|
|
|
};
|
|
|
|
|
return evt;
|
|
|
|
|
return event;
|
|
|
|
|
}
|
|
|
|
|
preventDefault(evt: any /** TODO #9100 */) { evt.returnValue = false; }
|
|
|
|
|
isPrevented(evt: any /** TODO #9100 */): boolean {
|
|
|
|
|
return isPresent(evt.returnValue) && !evt.returnValue;
|
|
|
|
|
preventDefault(event: any) { event.returnValue = false; }
|
|
|
|
|
isPrevented(event: any): boolean { return isPresent(event.returnValue) && !event.returnValue; }
|
|
|
|
|
getInnerHTML(el: any): string {
|
|
|
|
|
return parse5.serialize(this.templateAwareRoot(el), {treeAdapter});
|
|
|
|
|
}
|
|
|
|
|
getInnerHTML(el: any /** TODO #9100 */): string {
|
|
|
|
|
return serializer.serialize(this.templateAwareRoot(el));
|
|
|
|
|
getTemplateContent(el: any): Node { return null; }
|
|
|
|
|
getOuterHTML(el: any): string {
|
|
|
|
|
const fragment = treeAdapter.createDocumentFragment();
|
|
|
|
|
this.appendChild(fragment, el);
|
|
|
|
|
return parse5.serialize(fragment, {treeAdapter});
|
|
|
|
|
}
|
|
|
|
|
getTemplateContent(el: any /** TODO #9100 */): Node {
|
|
|
|
|
return null; // no <template> support in parse5.
|
|
|
|
|
}
|
|
|
|
|
getOuterHTML(el: any /** TODO #9100 */): string {
|
|
|
|
|
serializer.html = '';
|
|
|
|
|
serializer._serializeElement(el);
|
|
|
|
|
return serializer.html;
|
|
|
|
|
}
|
|
|
|
|
nodeName(node: any /** TODO #9100 */): string { return node.tagName; }
|
|
|
|
|
nodeValue(node: any /** TODO #9100 */): string { return node.nodeValue; }
|
|
|
|
|
nodeName(node: any): string { return node.tagName; }
|
|
|
|
|
nodeValue(node: any): string { return node.nodeValue; }
|
|
|
|
|
type(node: any): string { throw _notImplemented('type'); }
|
|
|
|
|
content(node: any /** TODO #9100 */): string { return node.childNodes[0]; }
|
|
|
|
|
firstChild(el: any /** TODO #9100 */): Node { return el.firstChild; }
|
|
|
|
|
nextSibling(el: any /** TODO #9100 */): Node { return el.nextSibling; }
|
|
|
|
|
parentElement(el: any /** TODO #9100 */): Node { return el.parent; }
|
|
|
|
|
childNodes(el: any /** TODO #9100 */): Node[] { return el.childNodes; }
|
|
|
|
|
childNodesAsList(el: any /** TODO #9100 */): any[] {
|
|
|
|
|
var childNodes = el.childNodes;
|
|
|
|
|
var res = new Array(childNodes.length);
|
|
|
|
|
for (var i = 0; i < childNodes.length; i++) {
|
|
|
|
|
content(node: any): string { return node.childNodes[0]; }
|
|
|
|
|
firstChild(el: any): Node { return el.firstChild; }
|
|
|
|
|
nextSibling(el: any): Node { return el.nextSibling; }
|
|
|
|
|
parentElement(el: any): Node { return el.parent; }
|
|
|
|
|
childNodes(el: any): Node[] { return el.childNodes; }
|
|
|
|
|
childNodesAsList(el: any): any[] {
|
|
|
|
|
const childNodes = el.childNodes;
|
|
|
|
|
const res = new Array(childNodes.length);
|
|
|
|
|
for (let i = 0; i < childNodes.length; i++) {
|
|
|
|
|
res[i] = childNodes[i];
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
clearNodes(el: any /** TODO #9100 */) {
|
|
|
|
|
clearNodes(el: any) {
|
|
|
|
|
while (el.childNodes.length > 0) {
|
|
|
|
|
this.remove(el.childNodes[0]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
appendChild(el: any /** TODO #9100 */, node: any /** TODO #9100 */) {
|
|
|
|
|
appendChild(el: any, node: any) {
|
|
|
|
|
this.remove(node);
|
|
|
|
|
treeAdapter.appendChild(this.templateAwareRoot(el), node);
|
|
|
|
|
}
|
|
|
|
|
removeChild(el: any /** TODO #9100 */, node: any /** TODO #9100 */) {
|
|
|
|
|
if (ListWrapper.contains(el.childNodes, node)) {
|
|
|
|
|
removeChild(el: any, node: any) {
|
|
|
|
|
if (el.childNodes.indexOf(node) > -1) {
|
|
|
|
|
this.remove(node);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
remove(el: any /** TODO #9100 */): HTMLElement {
|
|
|
|
|
var parent = el.parent;
|
|
|
|
|
remove(el: any): HTMLElement {
|
|
|
|
|
const parent = el.parent;
|
|
|
|
|
if (parent) {
|
|
|
|
|
var index = parent.childNodes.indexOf(el);
|
|
|
|
|
const index = parent.childNodes.indexOf(el);
|
|
|
|
|
parent.childNodes.splice(index, 1);
|
|
|
|
|
}
|
|
|
|
|
var prev = el.previousSibling;
|
|
|
|
|
var next = el.nextSibling;
|
|
|
|
|
const prev = el.previousSibling;
|
|
|
|
|
const next = el.nextSibling;
|
|
|
|
|
if (prev) {
|
|
|
|
|
prev.next = next;
|
|
|
|
|
}
|
|
|
|
@ -240,45 +222,48 @@ export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
el.parent = null;
|
|
|
|
|
return el;
|
|
|
|
|
}
|
|
|
|
|
insertBefore(el: any /** TODO #9100 */, node: any /** TODO #9100 */) {
|
|
|
|
|
insertBefore(el: any, node: any) {
|
|
|
|
|
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));
|
|
|
|
|
}
|
|
|
|
|
insertAfter(el: any /** TODO #9100 */, node: any /** TODO #9100 */) {
|
|
|
|
|
insertAllBefore(el: any, nodes: any) { nodes.forEach((n: any) => this.insertBefore(el, n)); }
|
|
|
|
|
insertAfter(el: any, node: any) {
|
|
|
|
|
if (el.nextSibling) {
|
|
|
|
|
this.insertBefore(el.nextSibling, node);
|
|
|
|
|
} else {
|
|
|
|
|
this.appendChild(el.parent, node);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setInnerHTML(el: any /** TODO #9100 */, value: any /** TODO #9100 */) {
|
|
|
|
|
setInnerHTML(el: any, value: any) {
|
|
|
|
|
this.clearNodes(el);
|
|
|
|
|
var content = parser.parseFragment(value);
|
|
|
|
|
for (var i = 0; i < content.childNodes.length; i++) {
|
|
|
|
|
const content = parse5.parseFragment(value, {treeAdapter});
|
|
|
|
|
for (let i = 0; i < content.childNodes.length; i++) {
|
|
|
|
|
treeAdapter.appendChild(el, content.childNodes[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
getText(el: any /** TODO #9100 */, isRecursive?: boolean): string {
|
|
|
|
|
getText(el: any, isRecursive?: boolean): string {
|
|
|
|
|
if (this.isTextNode(el)) {
|
|
|
|
|
return el.data;
|
|
|
|
|
} else if (this.isCommentNode(el)) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.isCommentNode(el)) {
|
|
|
|
|
// In the DOM, comments within an element return an empty string for textContent
|
|
|
|
|
// 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 '';
|
|
|
|
|
} else {
|
|
|
|
|
var textContent = '';
|
|
|
|
|
for (var i = 0; i < el.childNodes.length; i++) {
|
|
|
|
|
textContent += this.getText(el.childNodes[i], true);
|
|
|
|
|
}
|
|
|
|
|
return textContent;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!el.childNodes || el.childNodes.length == 0) {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let textContent = '';
|
|
|
|
|
for (let i = 0; i < el.childNodes.length; i++) {
|
|
|
|
|
textContent += this.getText(el.childNodes[i], true);
|
|
|
|
|
}
|
|
|
|
|
return textContent;
|
|
|
|
|
}
|
|
|
|
|
setText(el: any /** TODO #9100 */, value: string) {
|
|
|
|
|
|
|
|
|
|
setText(el: any, value: string) {
|
|
|
|
|
if (this.isTextNode(el) || this.isCommentNode(el)) {
|
|
|
|
|
el.data = value;
|
|
|
|
|
} else {
|
|
|
|
@ -286,25 +271,25 @@ export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
if (value !== '') treeAdapter.insertText(el, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
getValue(el: any /** TODO #9100 */): string { return el.value; }
|
|
|
|
|
setValue(el: any /** TODO #9100 */, value: string) { el.value = value; }
|
|
|
|
|
getChecked(el: any /** TODO #9100 */): boolean { return el.checked; }
|
|
|
|
|
setChecked(el: any /** TODO #9100 */, value: boolean) { el.checked = value; }
|
|
|
|
|
getValue(el: any): string { return el.value; }
|
|
|
|
|
setValue(el: any, value: string) { el.value = value; }
|
|
|
|
|
getChecked(el: any): boolean { return el.checked; }
|
|
|
|
|
setChecked(el: any, 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 content = parser.parseFragment(html);
|
|
|
|
|
treeAdapter.appendChild(template, content);
|
|
|
|
|
createTemplate(html: any): HTMLElement {
|
|
|
|
|
const template = treeAdapter.createElement('template', 'http://www.w3.org/1999/xhtml', []);
|
|
|
|
|
const content = parse5.parseFragment(html, {treeAdapter});
|
|
|
|
|
treeAdapter.setTemplateContent(template, content);
|
|
|
|
|
return template;
|
|
|
|
|
}
|
|
|
|
|
createElement(tagName: any /** TODO #9100 */): HTMLElement {
|
|
|
|
|
createElement(tagName: any): HTMLElement {
|
|
|
|
|
return treeAdapter.createElement(tagName, 'http://www.w3.org/1999/xhtml', []);
|
|
|
|
|
}
|
|
|
|
|
createElementNS(ns: any /** TODO #9100 */, tagName: any /** TODO #9100 */): HTMLElement {
|
|
|
|
|
createElementNS(ns: any, tagName: any): HTMLElement {
|
|
|
|
|
return treeAdapter.createElement(tagName, ns, []);
|
|
|
|
|
}
|
|
|
|
|
createTextNode(text: string): Text {
|
|
|
|
|
var t = <any>this.createComment(text);
|
|
|
|
|
const t = <any>this.createComment(text);
|
|
|
|
|
t.type = 'text';
|
|
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
@ -313,23 +298,23 @@ export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
'script', 'http://www.w3.org/1999/xhtml', [{name: attrName, value: attrValue}]);
|
|
|
|
|
}
|
|
|
|
|
createStyleElement(css: string): HTMLStyleElement {
|
|
|
|
|
var style = this.createElement('style');
|
|
|
|
|
const style = this.createElement('style');
|
|
|
|
|
this.setText(style, css);
|
|
|
|
|
return <HTMLStyleElement>style;
|
|
|
|
|
}
|
|
|
|
|
createShadowRoot(el: any /** TODO #9100 */): HTMLElement {
|
|
|
|
|
createShadowRoot(el: any): HTMLElement {
|
|
|
|
|
el.shadowRoot = treeAdapter.createDocumentFragment();
|
|
|
|
|
el.shadowRoot.parent = el;
|
|
|
|
|
return el.shadowRoot;
|
|
|
|
|
}
|
|
|
|
|
getShadowRoot(el: any /** TODO #9100 */): Element { return el.shadowRoot; }
|
|
|
|
|
getHost(el: any /** TODO #9100 */): string { return el.host; }
|
|
|
|
|
getShadowRoot(el: any): Element { return el.shadowRoot; }
|
|
|
|
|
getHost(el: any): string { return el.host; }
|
|
|
|
|
getDistributedNodes(el: any): Node[] { throw _notImplemented('getDistributedNodes'); }
|
|
|
|
|
clone(node: Node): Node {
|
|
|
|
|
var _recursive = (node: any /** TODO #9100 */) => {
|
|
|
|
|
var nodeClone = Object.create(Object.getPrototypeOf(node));
|
|
|
|
|
for (var prop in node) {
|
|
|
|
|
var desc = Object.getOwnPropertyDescriptor(node, prop);
|
|
|
|
|
const _recursive = (node: any) => {
|
|
|
|
|
const nodeClone = Object.create(Object.getPrototypeOf(node));
|
|
|
|
|
for (const prop in node) {
|
|
|
|
|
const desc = Object.getOwnPropertyDescriptor(node, prop);
|
|
|
|
|
if (desc && 'value' in desc && typeof desc.value !== 'object') {
|
|
|
|
|
nodeClone[prop] = node[prop];
|
|
|
|
|
}
|
|
|
|
@ -342,17 +327,17 @@ export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
mapProps.forEach(mapName => {
|
|
|
|
|
if (isPresent(node[mapName])) {
|
|
|
|
|
nodeClone[mapName] = {};
|
|
|
|
|
for (var prop in node[mapName]) {
|
|
|
|
|
for (const prop in node[mapName]) {
|
|
|
|
|
nodeClone[mapName][prop] = node[mapName][prop];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
var cNodes = node.children;
|
|
|
|
|
const cNodes = node.children;
|
|
|
|
|
if (cNodes) {
|
|
|
|
|
var cNodesClone = new Array(cNodes.length);
|
|
|
|
|
for (var i = 0; i < cNodes.length; i++) {
|
|
|
|
|
var childNode = cNodes[i];
|
|
|
|
|
var childNodeClone = _recursive(childNode);
|
|
|
|
|
const cNodesClone = new Array(cNodes.length);
|
|
|
|
|
for (let i = 0; i < cNodes.length; i++) {
|
|
|
|
|
const childNode = cNodes[i];
|
|
|
|
|
const childNodeClone = _recursive(childNode);
|
|
|
|
|
cNodesClone[i] = childNodeClone;
|
|
|
|
|
if (i > 0) {
|
|
|
|
|
childNodeClone.prev = cNodesClone[i - 1];
|
|
|
|
@ -366,109 +351,101 @@ export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
};
|
|
|
|
|
return _recursive(node);
|
|
|
|
|
}
|
|
|
|
|
getElementsByClassName(element: any /** TODO #9100 */, name: string): HTMLElement[] {
|
|
|
|
|
getElementsByClassName(element: any, name: string): HTMLElement[] {
|
|
|
|
|
return this.querySelectorAll(element, '.' + name);
|
|
|
|
|
}
|
|
|
|
|
getElementsByTagName(element: any, name: string): HTMLElement[] {
|
|
|
|
|
throw _notImplemented('getElementsByTagName');
|
|
|
|
|
}
|
|
|
|
|
classList(element: any /** TODO #9100 */): string[] {
|
|
|
|
|
var classAttrValue: any /** TODO #9100 */ = null;
|
|
|
|
|
var attributes = element.attribs;
|
|
|
|
|
classList(element: any): string[] {
|
|
|
|
|
let classAttrValue: any = null;
|
|
|
|
|
const attributes = element.attribs;
|
|
|
|
|
if (attributes && attributes.hasOwnProperty('class')) {
|
|
|
|
|
classAttrValue = attributes['class'];
|
|
|
|
|
}
|
|
|
|
|
return classAttrValue ? classAttrValue.trim().split(/\s+/g) : [];
|
|
|
|
|
}
|
|
|
|
|
addClass(element: any /** TODO #9100 */, className: string) {
|
|
|
|
|
var classList = this.classList(element);
|
|
|
|
|
var index = classList.indexOf(className);
|
|
|
|
|
addClass(element: any, className: string) {
|
|
|
|
|
const classList = this.classList(element);
|
|
|
|
|
let index = classList.indexOf(className);
|
|
|
|
|
if (index == -1) {
|
|
|
|
|
classList.push(className);
|
|
|
|
|
element.attribs['class'] = element.className = classList.join(' ');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
removeClass(element: any /** TODO #9100 */, className: string) {
|
|
|
|
|
var classList = this.classList(element);
|
|
|
|
|
var index = classList.indexOf(className);
|
|
|
|
|
removeClass(element: any, className: string) {
|
|
|
|
|
const classList = this.classList(element);
|
|
|
|
|
let index = classList.indexOf(className);
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
classList.splice(index, 1);
|
|
|
|
|
element.attribs['class'] = element.className = classList.join(' ');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
hasClass(element: any /** TODO #9100 */, className: string): boolean {
|
|
|
|
|
hasClass(element: any, className: string): boolean {
|
|
|
|
|
return ListWrapper.contains(this.classList(element), className);
|
|
|
|
|
}
|
|
|
|
|
hasStyle(element: any /** TODO #9100 */, styleName: string, styleValue: string = null): boolean {
|
|
|
|
|
var value = this.getStyle(element, styleName) || '';
|
|
|
|
|
hasStyle(element: any, styleName: string, styleValue: string = null): boolean {
|
|
|
|
|
const value = this.getStyle(element, styleName) || '';
|
|
|
|
|
return styleValue ? value == styleValue : value.length > 0;
|
|
|
|
|
}
|
|
|
|
|
/** @internal */
|
|
|
|
|
_readStyleAttribute(element: any /** TODO #9100 */) {
|
|
|
|
|
var styleMap = {};
|
|
|
|
|
var attributes = element.attribs;
|
|
|
|
|
_readStyleAttribute(element: any) {
|
|
|
|
|
const styleMap = {};
|
|
|
|
|
const attributes = element.attribs;
|
|
|
|
|
if (attributes && attributes.hasOwnProperty('style')) {
|
|
|
|
|
var styleAttrValue = attributes['style'];
|
|
|
|
|
var styleList = styleAttrValue.split(/;+/g);
|
|
|
|
|
for (var i = 0; i < styleList.length; i++) {
|
|
|
|
|
const styleAttrValue = attributes['style'];
|
|
|
|
|
const styleList = styleAttrValue.split(/;+/g);
|
|
|
|
|
for (let i = 0; i < styleList.length; i++) {
|
|
|
|
|
if (styleList[i].length > 0) {
|
|
|
|
|
var elems = styleList[i].split(/:+/g);
|
|
|
|
|
(styleMap as any /** TODO #9100 */)[elems[0].trim()] = elems[1].trim();
|
|
|
|
|
const elems = styleList[i].split(/:+/g);
|
|
|
|
|
(styleMap as any)[elems[0].trim()] = elems[1].trim();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return styleMap;
|
|
|
|
|
}
|
|
|
|
|
/** @internal */
|
|
|
|
|
_writeStyleAttribute(element: any /** TODO #9100 */, styleMap: any /** TODO #9100 */) {
|
|
|
|
|
var styleAttrValue = '';
|
|
|
|
|
for (var key in styleMap) {
|
|
|
|
|
var newValue = styleMap[key];
|
|
|
|
|
if (newValue && newValue.length > 0) {
|
|
|
|
|
_writeStyleAttribute(element: any, styleMap: any) {
|
|
|
|
|
let styleAttrValue = '';
|
|
|
|
|
for (const key in styleMap) {
|
|
|
|
|
const newValue = styleMap[key];
|
|
|
|
|
if (newValue) {
|
|
|
|
|
styleAttrValue += key + ':' + styleMap[key] + ';';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
setStyle(element: any, styleName: string, styleValue: string) {
|
|
|
|
|
const styleMap = this._readStyleAttribute(element);
|
|
|
|
|
(styleMap as any)[styleName] = styleValue;
|
|
|
|
|
this._writeStyleAttribute(element, styleMap);
|
|
|
|
|
}
|
|
|
|
|
removeStyle(element: any /** TODO #9100 */, styleName: string) {
|
|
|
|
|
this.setStyle(element, styleName, null);
|
|
|
|
|
removeStyle(element: any, styleName: string) { this.setStyle(element, styleName, null); }
|
|
|
|
|
getStyle(element: any, styleName: string): string {
|
|
|
|
|
const styleMap = this._readStyleAttribute(element);
|
|
|
|
|
return styleMap.hasOwnProperty(styleName) ? (styleMap as any)[styleName] : '';
|
|
|
|
|
}
|
|
|
|
|
getStyle(element: any /** TODO #9100 */, styleName: string): string {
|
|
|
|
|
var styleMap = this._readStyleAttribute(element);
|
|
|
|
|
return styleMap.hasOwnProperty(styleName) ? (styleMap as any /** TODO #9100 */)[styleName] : '';
|
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
for (var i = 0; i < elAttrs.length; i++) {
|
|
|
|
|
var attrib = elAttrs[i];
|
|
|
|
|
tagName(element: any): string { return element.tagName == 'style' ? 'STYLE' : element.tagName; }
|
|
|
|
|
attributeMap(element: any): Map<string, string> {
|
|
|
|
|
const res = new Map<string, string>();
|
|
|
|
|
const elAttrs = treeAdapter.getAttrList(element);
|
|
|
|
|
for (let i = 0; i < elAttrs.length; i++) {
|
|
|
|
|
const attrib = elAttrs[i];
|
|
|
|
|
res.set(attrib.name, attrib.value);
|
|
|
|
|
}
|
|
|
|
|
return res;
|
|
|
|
|
}
|
|
|
|
|
hasAttribute(element: any /** TODO #9100 */, attribute: string): boolean {
|
|
|
|
|
hasAttribute(element: any, attribute: string): boolean {
|
|
|
|
|
return element.attribs && element.attribs.hasOwnProperty(attribute);
|
|
|
|
|
}
|
|
|
|
|
hasAttributeNS(element: any /** TODO #9100 */, ns: string, attribute: string): boolean {
|
|
|
|
|
throw 'not implemented';
|
|
|
|
|
}
|
|
|
|
|
getAttribute(element: any /** TODO #9100 */, attribute: string): string {
|
|
|
|
|
hasAttributeNS(element: any, ns: string, attribute: string): boolean { throw 'not implemented'; }
|
|
|
|
|
getAttribute(element: any, attribute: string): string {
|
|
|
|
|
return element.attribs && element.attribs.hasOwnProperty(attribute) ?
|
|
|
|
|
element.attribs[attribute] :
|
|
|
|
|
null;
|
|
|
|
|
}
|
|
|
|
|
getAttributeNS(element: any /** TODO #9100 */, ns: string, attribute: string): string {
|
|
|
|
|
throw 'not implemented';
|
|
|
|
|
}
|
|
|
|
|
setAttribute(element: any /** TODO #9100 */, attribute: string, value: string) {
|
|
|
|
|
getAttributeNS(element: any, ns: string, attribute: string): string { throw 'not implemented'; }
|
|
|
|
|
setAttribute(element: any, attribute: string, value: string) {
|
|
|
|
|
if (attribute) {
|
|
|
|
|
element.attribs[attribute] = value;
|
|
|
|
|
if (attribute === 'class') {
|
|
|
|
@ -476,25 +453,23 @@ export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
setAttributeNS(element: any /** TODO #9100 */, ns: string, attribute: string, value: string) {
|
|
|
|
|
setAttributeNS(element: any, ns: string, attribute: string, value: string) {
|
|
|
|
|
throw 'not implemented';
|
|
|
|
|
}
|
|
|
|
|
removeAttribute(element: any /** TODO #9100 */, attribute: string) {
|
|
|
|
|
removeAttribute(element: any, attribute: string) {
|
|
|
|
|
if (attribute) {
|
|
|
|
|
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, ns: string, name: string) { throw 'not implemented'; }
|
|
|
|
|
templateAwareRoot(el: any): any {
|
|
|
|
|
return this.isTemplateElement(el) ? treeAdapter.getTemplateContent(el) : el;
|
|
|
|
|
}
|
|
|
|
|
createHtmlDocument(): Document {
|
|
|
|
|
var newDoc = treeAdapter.createDocument();
|
|
|
|
|
const newDoc = treeAdapter.createDocument();
|
|
|
|
|
newDoc.title = 'fake title';
|
|
|
|
|
var head = treeAdapter.createElement('head', null, []);
|
|
|
|
|
var body = treeAdapter.createElement('body', 'http://www.w3.org/1999/xhtml', []);
|
|
|
|
|
const head = treeAdapter.createElement('head', null, []);
|
|
|
|
|
const body = treeAdapter.createElement('body', 'http://www.w3.org/1999/xhtml', []);
|
|
|
|
|
this.appendChild(newDoc, head);
|
|
|
|
|
this.appendChild(newDoc, body);
|
|
|
|
|
newDoc['head'] = head;
|
|
|
|
@ -502,31 +477,22 @@ export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
newDoc['_window'] = StringMapWrapper.create();
|
|
|
|
|
return newDoc;
|
|
|
|
|
}
|
|
|
|
|
defaultDoc(): Document {
|
|
|
|
|
if (defDoc === null) {
|
|
|
|
|
defDoc = this.createHtmlDocument();
|
|
|
|
|
}
|
|
|
|
|
return defDoc;
|
|
|
|
|
}
|
|
|
|
|
getBoundingClientRect(el: any /** TODO #9100 */): any {
|
|
|
|
|
return {left: 0, top: 0, width: 0, height: 0};
|
|
|
|
|
}
|
|
|
|
|
defaultDoc(): Document { return defDoc = defDoc || this.createHtmlDocument(); }
|
|
|
|
|
getBoundingClientRect(el: any): 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';
|
|
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
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); }
|
|
|
|
|
adoptNode(node: any /** TODO #9100 */): any { return node; }
|
|
|
|
|
getHref(el: any /** TODO #9100 */): string { return el.href; }
|
|
|
|
|
resolveAndSetHref(el: any /** TODO #9100 */, baseUrl: string, href: string) {
|
|
|
|
|
isTextNode(node: any): boolean { return treeAdapter.isTextNode(node); }
|
|
|
|
|
isCommentNode(node: any): boolean { return treeAdapter.isCommentNode(node); }
|
|
|
|
|
isElementNode(node: any): boolean { return node ? treeAdapter.isElementNode(node) : false; }
|
|
|
|
|
hasShadowRoot(node: any): boolean { return isPresent(node.shadowRoot); }
|
|
|
|
|
isShadowRoot(node: any): boolean { return this.getShadowRoot(node) == node; }
|
|
|
|
|
importIntoDoc(node: any): any { return this.clone(node); }
|
|
|
|
|
adoptNode(node: any): any { return node; }
|
|
|
|
|
getHref(el: any): string { return el.href; }
|
|
|
|
|
resolveAndSetHref(el: any, baseUrl: string, href: string) {
|
|
|
|
|
if (href == null) {
|
|
|
|
|
el.href = baseUrl;
|
|
|
|
|
} else {
|
|
|
|
@ -534,11 +500,11 @@ export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/** @internal */
|
|
|
|
|
_buildRules(parsedRules: any /** TODO #9100 */, css?: any /** TODO #9100 */) {
|
|
|
|
|
var rules: any[] /** TODO #9100 */ = [];
|
|
|
|
|
for (var i = 0; i < parsedRules.length; i++) {
|
|
|
|
|
var parsedRule = parsedRules[i];
|
|
|
|
|
var rule: {[key: string]: any} = {};
|
|
|
|
|
_buildRules(parsedRules: any, css?: any) {
|
|
|
|
|
const rules: any[] = [];
|
|
|
|
|
for (let i = 0; i < parsedRules.length; i++) {
|
|
|
|
|
const parsedRule = parsedRules[i];
|
|
|
|
|
const rule: {[key: string]: any} = {};
|
|
|
|
|
rule['cssText'] = css;
|
|
|
|
|
rule['style'] = {content: '', cssText: ''};
|
|
|
|
|
if (parsedRule.type == 'rule') {
|
|
|
|
@ -553,9 +519,8 @@ export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
if (isBlank(parsedRule.declarations)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
for (var j = 0; j < parsedRule.declarations.length; j++) {
|
|
|
|
|
var declaration = parsedRule.declarations[j];
|
|
|
|
|
|
|
|
|
|
for (let j = 0; j < parsedRule.declarations.length; j++) {
|
|
|
|
|
const declaration = parsedRule.declarations[j];
|
|
|
|
|
rule['style'] = declaration.property[declaration.value];
|
|
|
|
|
rule['style'].cssText += declaration.property + ': ' + declaration.value + ';';
|
|
|
|
|
}
|
|
|
|
@ -586,28 +551,21 @@ export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
getComputedStyle(el: any /** TODO #9100 */): any { throw 'not implemented'; }
|
|
|
|
|
setData(el: any /** TODO #9100 */, name: string, value: string) {
|
|
|
|
|
this.setAttribute(el, 'data-' + name, value);
|
|
|
|
|
}
|
|
|
|
|
getData(el: any, name: string): string { return this.getAttribute(el, 'data-' + name); }
|
|
|
|
|
getComputedStyle(el: any): any { throw 'not implemented'; }
|
|
|
|
|
setData(el: any, 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); }
|
|
|
|
|
supportsWebAnimation(): boolean { return false; }
|
|
|
|
|
performanceNow(): number { return DateWrapper.toMillis(DateWrapper.now()); }
|
|
|
|
|
performanceNow(): number { return Date.now(); }
|
|
|
|
|
getAnimationPrefix(): string { return ''; }
|
|
|
|
|
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, newNode: any, oldNode: any) { 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'); }
|
|
|
|
|
getEventKey(event: any): string { throw new Error('not implemented'); }
|
|
|
|
|
|
|
|
|
|
supportsCookies(): boolean { return false; }
|
|
|
|
|
getCookie(name: string): string { throw new Error('not implemented'); }
|
|
|
|
@ -616,7 +574,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TODO: build a proper list, this one is all the keys of a HTMLInputElement
|
|
|
|
|
var _HTMLElementPropertyList = [
|
|
|
|
|
const _HTMLElementPropertyList = [
|
|
|
|
|
'webkitEntries',
|
|
|
|
|
'incremental',
|
|
|
|
|
'webkitdirectory',
|
|
|
|
@ -798,5 +756,5 @@ var _HTMLElementPropertyList = [
|
|
|
|
|
'nodeValue',
|
|
|
|
|
'nodeName',
|
|
|
|
|
'closure_lm_714617',
|
|
|
|
|
'__jsaction'
|
|
|
|
|
'__jsaction',
|
|
|
|
|
];
|
|
|
|
|