mirror of
https://github.com/lrsjng/h5ai.git
synced 2025-05-24 12:07:10 -04:00
Clean up tests.
This commit is contained in:
parent
c4fa90a747
commit
3a2e61b163
53 changed files with 70 additions and 22837 deletions
|
@ -1,33 +1,33 @@
|
|||
(function () {
|
||||
var title;
|
||||
var htmlId;
|
||||
var htmlClasses;
|
||||
var bodyId;
|
||||
var bodyClasses;
|
||||
var $pinnedElements;
|
||||
const win = global.window;
|
||||
const doc = win.document;
|
||||
const jq = win.jQuery;
|
||||
let title;
|
||||
let htmlId;
|
||||
let htmlClasses;
|
||||
let bodyId;
|
||||
let bodyClasses;
|
||||
let $pinnedElements;
|
||||
|
||||
function pinHtml() {
|
||||
title = document.title;
|
||||
htmlId = $('html').attr('id');
|
||||
htmlClasses = $('html').attr('class');
|
||||
bodyId = $('body').attr('id');
|
||||
bodyClasses = $('body').attr('class');
|
||||
$pinnedElements = $('head,body').children();
|
||||
}
|
||||
function pinHtml() {
|
||||
title = doc.title;
|
||||
htmlId = jq('html').attr('id');
|
||||
htmlClasses = jq('html').attr('class');
|
||||
bodyId = jq('body').attr('id');
|
||||
bodyClasses = jq('body').attr('class');
|
||||
$pinnedElements = jq('head,body').children();
|
||||
}
|
||||
|
||||
function restoreHtml() {
|
||||
document.title = title;
|
||||
$('html').attr('id', htmlId);
|
||||
$('html').attr('class', htmlClasses);
|
||||
$('body').attr('id', bodyId);
|
||||
$('body').attr('class', bodyClasses);
|
||||
$('head,body').children().not($pinnedElements).remove();
|
||||
if (window.localStorage && window.localStorage.clear) {
|
||||
window.localStorage.clear();
|
||||
}
|
||||
}
|
||||
function restoreHtml() {
|
||||
doc.title = title;
|
||||
jq('html').attr('id', htmlId);
|
||||
jq('html').attr('class', htmlClasses);
|
||||
jq('body').attr('id', bodyId);
|
||||
jq('body').attr('class', bodyClasses);
|
||||
jq('head,body').children().not($pinnedElements).remove();
|
||||
win.localStorage.clear();
|
||||
}
|
||||
|
||||
window.util = window.util || {};
|
||||
window.util.pinHtml = pinHtml;
|
||||
window.util.restoreHtml = restoreHtml;
|
||||
}());
|
||||
module.exports = {
|
||||
pinHtml,
|
||||
restoreHtml
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue