Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion src/jsc/modules/minified_linkedjsdom.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,26 @@ var document = {
function Event(t) { this.type = t; }
Event.prototype.preventDefault = function() {};

function HTMLElement() {
this.style = {};
this.classList = { add: function() {}, remove: function() {}, toggle: function() {}, contains: function() { return false; } };
Comment thread
vjain008 marked this conversation as resolved.
this.children = [];
this.childNodes = [];
}
HTMLElement.prototype.setAttribute = function() {};
HTMLElement.prototype.getAttribute = function() { return null; };
HTMLElement.prototype.hasAttribute = function() { return false; };
HTMLElement.prototype.removeAttribute = function() {};
HTMLElement.prototype.appendChild = function(c) { this.children.push(c); this.childNodes.push(c); return c; };
HTMLElement.prototype.removeChild = function(c) { return c; };
Comment thread
vjain008 marked this conversation as resolved.
HTMLElement.prototype.addEventListener = function() {};
HTMLElement.prototype.removeEventListener = function() {};
HTMLElement.prototype.dispatchEvent = function() {};
Comment thread
vjain008 marked this conversation as resolved.
HTMLElement.prototype.getBoundingClientRect = function() { return {top:0,left:0,right:0,bottom:0,width:0,height:0,x:0,y:0}; };
HTMLElement.prototype.focus = function() {};
HTMLElement.prototype.blur = function() {};
HTMLElement.prototype.click = function() {};

function DOMParser() {}
DOMParser.prototype.parseFromString = function() { return document; };

Expand Down Expand Up @@ -114,11 +134,13 @@ var window = {
clearInterval: wrappedClearInterval,
addEventListener: function() {},
Event: Event,
HTMLElement: HTMLElement,
DOMParser: DOMParser,
Blob: Blob,
AbortController: AbortController,
fetch: fetch,
Promise: Promise
Promise: Promise,
frames: { length: 0 }
Comment thread
vjain008 marked this conversation as resolved.
};

window.window = window;
Expand All @@ -127,6 +149,7 @@ var navigator = window.navigator;
var location = window.location;
window.top = window;
var tv = window.tv = {};
var HTMLElement = window.HTMLElement;
Comment thread
vjain008 marked this conversation as resolved.
var DOMParser = window.DOMParser;
var Event = window.Event;
var Blob = window.Blob;
Expand Down