This repository has been archived by the owner on Dec 31, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding stub for a mock DOM for resource loading testing, per #113
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Mock for DOM resource loading | ||
|
||
(function UMD(name,context,definition){ | ||
if (typeof define === "function" && define.amd) { define(definition); } | ||
else if (typeof module !== "undefined" && module.exports) { module.exports = definition(); } | ||
else { context[name] = definition(name,context); } | ||
})("$DOM",this,function DEF(name,context){ | ||
"use strict"; | ||
|
||
return createDOM; | ||
|
||
|
||
// ************************************** | ||
|
||
function createDOM(opts) { | ||
var headElement = {}; | ||
var baseURI = ""; | ||
|
||
var $performance = { | ||
getEntriesByName: getEntriesByName, | ||
}; | ||
|
||
var $document = { | ||
head: headElement, | ||
baseURI: baseURI, | ||
getElementsByTagName: getElementsByTagName, | ||
createElement: createElement, | ||
}; | ||
|
||
var publicAPI = { | ||
document: $document, | ||
performance: $performance, | ||
}; | ||
|
||
return publicAPI; | ||
|
||
|
||
// ************************************** | ||
|
||
function getElementsByTagName() {} | ||
function createElement() {} | ||
function getEntriesByName() {} | ||
} | ||
}); |