1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 | 1× 1× 1× 1× 1× 1× 1× 1× 8× 2× 1× 1× 1× 1× 32753× 28936× 1082× 27854× 27854× 1040× 3817× 3817× 31671× 4× 4× 2× 2× 4× 4× 1× 1× 1× 1× 15× 4× 2× 2× 2× 4× 11× 11× 13× 1× 1× 16× 8× 8× 8× 18× 6× 6× 1050× 1045× 5× 1040× 1040× 1056× 1× 5× 5× 1× 1045× 1× 1× 20836× 31× 20805× 20805× 1× 1× 9× 4× 5× 5× 1× 1× 1× 6133× 1× 6133× 6133× 3074× 6133× 1× 6133× 6133× 9589× 9589× 3453× 6136× 9589× 1212× 9589× 9589× 9589× 9589× 6136× 5× 5× 5× 5× 5× 5× 5× 5× 5× 24986× 169× 561× 561× 561× 169× 26010× 1× 1× 1× 1× 1× 1× 1× 1648× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 1× 416× 416× 416× 255× 161× 161× 255× 255× 255× 1× 1× 1× 1× 1× 1× 1× 6× 42× 42× 83× 41× 42× 1× 1× 1× 1× 1× 1× 1× 1× 1× 10× 2× 41230× 28× 2× 16× 24776× 2× 16× 4× 26× 19× 2× 69× 6× 2× 1× 1× 1× | import { isObject, isFunction, isString, isArray, forEach, ArrayIterator } from '../util' import DOMEventListener from './DOMEventListener' const NOT_IMPLEMENTED = 'This method is not implemented.' /** A unified interface for DOM elements used by Substance. @abstract */ export default class DOMElement { /* The element's id. @property {String} DOMElement#id */ /* The element's tag name in lower case. @property {String} DOMElement#tagName */ /* @property {String} DOMElement#textContent */ /* The inner HTML string. @property {String} DOMElement#innerHTML */ /* The outer HTML string. @property {String} DOMElement#outerHTML */ /* An array of child nodes, including nodes such as TextNodes. @property {Array<DOMElement>} DOMElement#childNodes */ /* An array of child elements. @property {Array<DOMElement>} DOMElement#children children */ /* The computed height. @property {Array<DOMElement>} DOMElement#height */ /* The computed width. @property {Array<DOMElement>} DOMElement#width */ /** @returns the native element */ getNativeElement() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Checks if the element is a TextNode. @returns {Boolean} true if the element is of type `Node.TEXT_NODE` */ isTextNode() { /* istanbul ignore next */ return false } /** Checks if the element is actually an element as opposed to a node. @returns {Boolean} true if the element is of type `Node.ELEMENT_NODE` */ isElementNode() { /* istanbul ignore next */ return false } /** Checks if the element is a CommentNode. @returns {Boolean} true if the element is of type `Node.COMMENT_NODE` */ isCommentNode() { /* istanbul ignore next */ return false } /** Checks if the element is a DocumentNode. @returns {Boolean} true if the element is of type `Node.DOCUMENT_NODE` */ isDocumentNode() { /* istanbul ignore next */ return false } /** Get the tagName of this element. @private @note Considered as private API, in favor of the property {DOMElement.prototype.tagName} @returns {String} the tag name in lower-case. */ getTagName() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Set the tagName of this element. @private @note Considered as private API, in favor of the property {DOMElement.prototype.tagName} @param {String} tagName the new tag name @returns {this} */ setTagName(tagName) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Get the id of this element. @private @note Considered as private API, in favor of the property {DOMElement.prototype.id} @returns {String} the id. */ getId() { return this.getAttribute('id') } /** Set the id of this element. @private @note Considered as private API, in favor of the property {DOMElement.prototype.id} @param {String} id the new id @returns {this} */ setId(id) { this.setAttribute('id', id) } /** Checks if a CSS class is set. @param {String} className @returns {Boolean} true if the CSS class is set */ hasClass(className) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Adds a CSS class. @param {String} classString A space-separated string with CSS classes @returns {this} */ addClass(classString) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Removes a CSS class. @param {String} classString A space-separated string with CSS classes @returns {this} */ removeClass(classString) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } hasAttribute(name) { return Boolean(this.getAttribute(name)) } /** jQuery style getter and setter for attributes. @param {String} name @param {String} [value] if present the attribute will be set @returns {String|this} if used as getter the attribute value, otherwise this element for chaining */ attr() { if (arguments.length === 1) { if (isString(arguments[0])) { return this.getAttribute(arguments[0]) } else Eif (isObject(arguments[0])) { forEach(arguments[0], function(value, name) { this.setAttribute(name, value) }.bind(this)) } } else Eif (arguments.length === 2) { this.setAttribute(arguments[0], arguments[1]) } return this } /** Removes an attribute. @param {String} name @returns {this} */ removeAttr(name) { var names = name.split(/\s+/) if (names.length === 1) { this.removeAttribute(name) } else { names.forEach(function(name) { this.removeAttribute(name) }.bind(this)) } return this } /** Get the attribute with a given name. @returns {String} the attribute's value. */ getAttribute(name) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Set the attribute with a given name. @param {String} the attribute's value. @returns {this} */ setAttribute(name, value) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } removeAttribute(name) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } getAttributes() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** jQuery style getter and setter for HTML element properties. @param {String} name @param {String} [value] if present the property will be set @returns {String|this} if used as getter the property value, otherwise this element for chaining */ htmlProp() { if (arguments.length === 1) { if (isString(arguments[0])) { return this.getProperty(arguments[0]) } else Eif (isObject(arguments[0])) { forEach(arguments[0], function(value, name) { this.setProperty(name, value) }.bind(this)) } } else Eif (arguments.length === 2) { this.setProperty(arguments[0], arguments[1]) } return this } getProperty(name) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } setProperty(name, value) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** jQuery style getter and setter for the *value* of an element. @param {String} [value] The value to set. @returns {String|this} the value if used as a getter, `this` otherwise */ val(value) { if (arguments.length === 0) { return this.getValue() } else { this.setValue(value) return this } } getValue() { return this.getProperty('value') } setValue(value) { this.setProperty('value', value) return this } /** jQuery style method to set or get inline CSS styles. @param {String} name the style name @param {String} [value] the style value @returns {String|this} the style value or this if used as a setter */ css() { /* istanbul ignore else */ if (arguments.length === 1) { /* istanbul ignore else */ if (isString(arguments[0])) { return this.getStyle(arguments[0]) } else Eif (isObject(arguments[0])) { forEach(arguments[0], function(value, name) { this.setStyle(name, value) }.bind(this)) } else { throw new Error('Illegal arguments.') } } else Eif (arguments.length === 2) { this.setStyle(arguments[0], arguments[1]) } else { throw new Error('Illegal arguments.') } return this } getStyle(name) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } setStyle(name, value) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Gets or sets the text content of an element. @param {String} [text] The text content to set. @returns {String|this} The text content if used as a getter, `this` otherwise */ text(text) { if (arguments.length === 0) { return this.getTextContent() } else { this.setTextContent(text) } return this } /** Get the textContent of this element. @private @note Considered as private API, in favor of the property {DOMElement.prototype.innerHTML} @returns {String} */ getTextContent() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Set the textContent of this element. @private @note Considered as private API, in favor of the property {DOMElement.prototype.innerHTML} @param {String} text the new text content @returns {this} */ setTextContent(text) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** jQuery style getter and setter for the innerHTML of an element. @param {String} [html] The html to set. @returns {String|this} the inner html if used as a getter, `this` otherwise */ html(html) { if (arguments.length === 0) { return this.getInnerHTML() } else { this.setInnerHTML(html) } return this } /** Get the innerHTML of this element. @private @note Considered as private API, in favor of the property {@link DOMElement.prototype.innerHTML} @returns {String} */ getInnerHTML() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Set the innerHTML of this element. @private @note Considered as private API, in favor of the property {@link DOMElement.prototype.innerHTML} @param {String} text the new text content @returns {this} */ setInnerHTML(html) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Get the outerHTML of this element. @private @note Considered as private API, in favor of the property {@link DOMElement.prototype.outerHTML} @returns {String} */ getOuterHTML() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Registers an Element event handler. @param {String} event The event name. @param {Function} handler The handler function. @param {Object} [context] context where the function should be bound to @param {Object} [options] @param {Object} [options.capture] to register the event in the event's capture phase (bubbling top-down) @returns {this} */ on(eventName, handler, context, options) { /* istanbul ignore next */ Iif (!isString(eventName)) { throw new Error('Illegal argument: "event" must be a String.') } options = options || {} if (context) { options.context = context } /* istanbul ignore next */ Iif (!handler || !isFunction(handler)) { throw new Error('Illegal argument: invalid handler function for event ' + eventName) } this.addEventListener(eventName, handler, options) return this } /** Unregisters the handler of a given event. @param {String} event The event name. @returns {this} */ off(eventName, handler) { // el.off(this): disconnect all listeners bound to the given context if (arguments.length === 1 && !isString(eventName)) { let context = arguments[0] this.getEventListeners().filter(function(l) { return l.context === context }).forEach(function(l) { this.removeEventListener(l) }.bind(this)) } else { this.removeEventListener(eventName, handler) } return this } addEventListener(eventName, handler, options = {}) { let listener if (arguments.length === 1 && arguments[0]) { listener = arguments[0] } else { listener = this._createEventListener(eventName, handler, options) } if (!this.eventListeners) { this.eventListeners = [] } listener._el = this this.eventListeners.push(listener) this._addEventListenerNative(listener) return this } _createEventListener(eventName, handler, options) { return new DOMEventListener(eventName, handler, options) } _addEventListenerNative(listener) {} // eslint-disable-line removeEventListener(eventName, handler) { Iif (!this.eventListeners) return // console.log('removing event listener', eventName, handler); let listener = null, idx = -1 idx = DOMEventListener.findIndex(this.eventListeners, eventName, handler) listener = this.eventListeners[idx] Eif (idx > -1) { this.eventListeners.splice(idx, 1) // console.log('BrowserDOMElement.removeEventListener:', eventName, this.eventListeners.length); listener._el = null this._removeEventListenerNative(listener) } return this } _removeEventListenerNative(listener) {} // eslint-disable-line removeAllEventListeners() { if (!this.eventListeners) return for (let i = 0; i < this.eventListeners.length; i++) { let listener = this.eventListeners[i] // console.log('BrowserDOMElement.removeEventListener:', eventName, this.eventListeners.length); listener._el = null this._removeEventListenerNative(listener) } delete this.eventListeners } getEventListeners() { return this.eventListeners || [] } /** Gets the type of this element in lower-case. @private @note Considered as private API, in favor of the property {@link DOMElement.prototype.nodeType} @returns {String} */ getNodeType() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } getContentType() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } getChildCount() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Get child nodes of this element. This method provides a new array with wrapped native elements. Better use getChildAt(). @private Considered as private API, in favor of the property {DOMElement.prototype.childNodes} @returns {Array<DOMElement>} */ getChildNodes() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Get child elements of this element. This method provides a new array with wrapped native elements. Better use getChildAt(). @private Considered as private API, in favor of the property {DOMElement.prototype.children} @returns {Array<DOMElement>} */ getChildren() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } getChildAt(pos) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } getChildIndex(child) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } getChildNodeIterator() { return new ArrayIterator(this.getChildNodes()) } getLastChild() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } getFirstChild() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } getNextSibling() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } getPreviousSibling() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Creates a clone of the current element. @returns {DOMElement} A clone of this element. */ clone() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Creates a DOMElement. @param {String} str a tag name or an HTML element as string. @returns {DOMElement} */ createElement(str) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } createTextNode(text) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } createComment(data) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } createProcessingInstruction(name, data) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } createCDATASection(data) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Checks if a given CSS selector matches for this element. **Attention** This method is currently not implemented for {VirtualElement}. This means you should use it only in importer implementations. @param {String} cssSelector @returns {Boolean} */ is(cssSelector) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Get the parent element of this element. @returns {DOMElement} the parent element */ getParent() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Get the ownerDocument of this element. @returns {DOMElement} the document element */ getOwnerDocument() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Find the first descendant element matching the given CSS selector. Note this differs from jQuery.find() that it returns only one element. **Attention** This method is currently not implemented for {VirtualElement}. This means you can use it only in importer implementations, but not in render or exporter implementations. @param {String} cssSelector @returns {DOMElement} found element */ find(cssSelector) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Find all descendant elements matching the given CSS selector. **Attention** This method is currently not implemented for {VirtualElement}. This means you can use it only in importer implementations, but not in render or exporter implementations. @param {String} cssSelector @returns {Array<DOMElement>} found elements */ findAll(cssSelector) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Append a child element. @param {DOMElement|String} child An element or text to append @returns {this} */ append(child) { var children Eif (arguments.length === 1) { if (isArray(child)) { children = child } else { this.appendChild(child) return this } } else { children = arguments } Eif (children) { Array.prototype.forEach.call(children, this.appendChild.bind(this)) } return this } appendChild(child) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Insert a child element at a given position. @param {Number} pos insert position @param {DOMElement|String} child The child element or text to insert. @returns {this} */ insertAt(pos, child) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } insertBefore(newChild, before) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Remove the child at a given position. @param {Number} pos @returns {this} */ removeAt(pos) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } removeChild(child) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } replaceChild(oldChild, newChild) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } /** Removes this element from its parent. @returns {this} */ remove() { var parent = this.getParent() if (parent) { parent.removeChild(this) } } /** Removes all child nodes from this element. @returns {this} */ empty() { /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } serialize() { return this.getOuterHTML() } isInDocument() { let el = this while(el) { if (el.isDocumentNode()) { return true } el = el.getParent() } } /** Focusses this element. **Attention: this makes only sense for elements which are rendered in the browser** */ focus() { /* istanbul ignore next */ return this } /** Blur this element. */ blur() { /* istanbul ignore next */ return this } /** Trigger a click event on this element. */ click() { /* istanbul ignore next */ return this } /* API to retrieve layout information */ getWidth() { /* istanbul ignore next */ return 0 } getHeight() { /* istanbul ignore next */ return 0 } /** Outer height as provided by $.outerHeight(withMargin) */ getOuterHeight(withMargin) { // eslint-disable-line no-unused-vars /* istanbul ignore next */ return 0 } /** Offset values as provided by $.offset() */ getOffset() { /* istanbul ignore next */ return { top: 0, left: 0 } } /** Position values as provided by $.position() */ getPosition() { /* istanbul ignore next */ return { top: 0, left: 0 } } /** Get element factory conveniently @example var $$ = el.getElementFactory() $$('div').append('bla') */ getElementFactory() { return this.createElement.bind(this) } /** Triggers a custom event. @param {String} name @param {Object} data */ emit(name, data) { // eslint-disable-line /* istanbul ignore next */ throw new Error(NOT_IMPLEMENTED) } // properties get id() { return this.getId() } set id(id) { this.setId(id) } get tagName() { return this.getTagName() } set tagName(tagName) { this.setTagName(tagName) } get nodeName() { return this.getTagName() } get nodeType() { return this.getNodeType() } get className() { return this.getAttribute('class') } set className(className) { this.setAttribute('class', className) } get textContent() { return this.getTextContent() } set textContent(text) { this.setTextContent(text) } get innerHTML() { return this.getInnerHTML() } set innerHTML(html) { this.setInnerHTML(html) } get outerHTML() { return this.getOuterHTML() } get firstChild() { return this.getFirstChild() } get lastChild() { return this.getLastChild() } get nextSibling() { return this.getNextSibling() } get previousSibling() { return this.getPreviousSibling() } get parentNode() { return this.getParent() } get height() { return this.getHeight() } get width() { return this.getWidth() } get value() { return this.getValue() } set value(value) { return this.setValue(value) } } DOMElement.prototype._isDOMElement = true DOMElement.pxStyles = { top: true, bottom: true, left: true, right: true, height: true, width: true } DOMElement.EMPTY_HTML = '<html><head></head><body></body></html>' |