mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-02 14:29:55 +00:00
Fixed issue with fakedome TW_Node inheritence (#8195)
This commit is contained in:
parent
0adc6024d1
commit
01b2e864c1
@ -42,7 +42,7 @@ var TW_TextNode = function(text) {
|
|||||||
this.textContent = text + "";
|
this.textContent = text + "";
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.setPrototypeOf(TW_TextNode,TW_Node.prototype);
|
Object.setPrototypeOf(TW_TextNode.prototype,TW_Node.prototype);
|
||||||
|
|
||||||
Object.defineProperty(TW_TextNode.prototype, "nodeType", {
|
Object.defineProperty(TW_TextNode.prototype, "nodeType", {
|
||||||
get: function() {
|
get: function() {
|
||||||
@ -67,7 +67,7 @@ var TW_Element = function(tag,namespace) {
|
|||||||
this.namespaceURI = namespace || "http://www.w3.org/1999/xhtml";
|
this.namespaceURI = namespace || "http://www.w3.org/1999/xhtml";
|
||||||
};
|
};
|
||||||
|
|
||||||
Object.setPrototypeOf(TW_Element,TW_Node.prototype);
|
Object.setPrototypeOf(TW_Element.prototype,TW_Node.prototype);
|
||||||
|
|
||||||
Object.defineProperty(TW_Element.prototype, "style", {
|
Object.defineProperty(TW_Element.prototype, "style", {
|
||||||
get: function() {
|
get: function() {
|
||||||
|
27
editions/test/tiddlers/tests/test-fakedom.js
Normal file
27
editions/test/tiddlers/tests/test-fakedom.js
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/*\
|
||||||
|
title: test-fakedom.js
|
||||||
|
type: application/javascript
|
||||||
|
tags: [[$:/tags/test-spec]]
|
||||||
|
|
||||||
|
Tests the fakedom that Tiddlywiki occasionally uses.
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
describe("fakedom tests", function() {
|
||||||
|
|
||||||
|
it("properly assigns nodeType based on DOM standards", function() {
|
||||||
|
// According to MDN, ELEMENT_NODE == 1 && TEXT_NODE == 3
|
||||||
|
// There are others, but currently they're not implemented in fakedom
|
||||||
|
expect($tw.fakeDocument.createElement("div").nodeType).toBe(1);
|
||||||
|
expect($tw.fakeDocument.createElement("div").ELEMENT_NODE).toBe(1);
|
||||||
|
expect($tw.fakeDocument.createTextNode("text").nodeType).toBe(3);
|
||||||
|
expect($tw.fakeDocument.createTextNode("text").TEXT_NODE).toBe(3);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
})();
|
Loading…
Reference in New Issue
Block a user