moved rrweb-snapshot into packages/rrweb-snapshot

This commit is contained in:
Mark-fenng
2021-07-22 17:54:51 +08:00
parent 69cb5dece0
commit bc319d510c
53 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
<!DOCTYPE html>
<html>
<head>
<title>The Book of Mozilla, 11:9</title>
<style type="text/css">
html {
background: maroon;
color: white;
font-style: italic;
}
#moztext {
margin-top: 15%;
font-size: 1.1em;
font-family: serif;
text-align: center;
line-height: 1.5;
}
#from {
font-size: 1.95em;
font-family: serif;
text-align: right;
}
em {
font-size: 1.3em;
line-height: 0;
}
a {
text-decoration: none;
color: white;
}
</style>
</head>
<body>
<p id="moztext">
Mammon slept. And the <em>beast reborn</em> spread over the earth and its numbers
grew legion. And they proclaimed the times and <em>sacrificed</em> crops unto the
fire, with the <em>cunning of foxes</em>. And they built a new world in their own
image as promised by the <em><a href="http://www.mozilla.org/about/mozilla-manifesto.html">
sacred words</a></em>, and <em><a href="http://wiki.mozilla.org/About:mozilla">spoke
</a></em> of the beast with their children. Mammon awoke, and lo! it was
<em>naught</em> but a follower.
</p>
<p id="from">
from <strong>The Book of Mozilla,</strong> 11:9<br /><small>(10th Edition)</small>
</p>
</body>
</html>

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>Title</h1>
</body>
</html>

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
<style>
.big {
width: 50px;
height: 50px;
}
.small {
width: 50px;
height: 100px;
float: left;
}
</style>
</head>
<body>
<div class="rr-block big">block 1</div>
<div>record 2</div>
<div class="rr-block small">block 3</div>
<div class="rr-block" style="height: 200px; width: 100px">block 3</div>
</body>
</html>

View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>with style sheet</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/pure@2.85.0/index.css"
/>
<link rel="stylesheet" href />
</head>
<body></body>
</html>

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>dynamic stylesheet</title>
<style></style>
<script>
const styleEl = document.querySelector('style');
const rules = [`body { margin: 0 }`, `p { background: lightpink }`];
rules.forEach((rule, idx) => {
styleEl.sheet.insertRule(rule, idx);
});
</script>
</head>
<body>
<p>p tag</p>
</body>
</html>

View File

@@ -0,0 +1,42 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>form fields</title>
</head>
<body>
<form>
<label for="text">
<input type="text" />
</label>
<label for="radio">
<input type="radio" />
</label>
<label for="checkbox">
<input type="checkbox" />
</label>
<label for="textarea">
<textarea name="" id="" cols="30" rows="10"></textarea>
</label>
<label for="select">
<select name="" id="">
<option value="1">1</option>
<option value="2">2</option>
</select>
</label>
<label>
<input name="tagName" />
</label>
</form>
</body>
<script>
document.querySelector('input[type="text"]').value = '1';
document.querySelector('input[type="radio"]').checked = true;
document.querySelector('input[type="checkbox"]').checked = true;
document.querySelector('textarea').value = '1234';
document.querySelector('select').value = '2';
</script>
</html>

View File

@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>hover selector</title>
<style>
div:hover {
background: orange;
}
div:hover::after {
position: absolute;
left: 0;
top: 100%;
content: 'dropdown';
width: 100px;
height: 200px;
background: lightblue;
}
</style>
</head>
<body>
<div>hover me</div>
</body>
</html>

View File

@@ -0,0 +1 @@
<button>inner iframe button</button>

View File

@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>iframe</title>
</head>
<body>
<iframe src="/html/iframe-inner.html" width="100" height="50"></iframe>
</body>
</html>

View File

@@ -0,0 +1,3 @@
<html foo='bar' ''>
</html>

View File

@@ -0,0 +1,9 @@
<!DOCTYPE >
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Invalid Doctype</title>
</head>
<body></body>
</html>

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<alt="">Hello</alt="">
<d123-_+!@#$%^&*()>Hello</d123-_+!@#$%^&*()>
<ale#></ale#>
</body>
</html>

View File

@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Document</title>
</head>
<body>
<p class="rr-mask">mask 1</p>
<div class="rr-mask">
<span>mask 2</span>
</div>
<div class="rr-mask">mask 3</div>
</body>
</html>

View File

@@ -0,0 +1,8 @@
<html>
<body>
<picture>
<source type="image/webp" srcset="assets/img/characters/robot.webp" />
<img src="assets/img/characters/robot.png" />
</picture>
</body>
</html>

View File

@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<link rel="preload" href="https://example/path/to/preload.js" as="script" />
<link rel="prefetch" href="https://example/path/to/prefetch.js" />
</head>
<body></body>
</html>

View File

@@ -0,0 +1,209 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>shadow DOM</title>
</head>
<body>
<fancy-tabs background>
<button slot="title">Tab 1</button>
<button slot="title" selected>Tab 2</button>
<button slot="title">Tab 3</button>
<section>content panel 1</section>
<section>content panel 2</section>
<section>content panel 3</section>
</fancy-tabs>
<script>
(function () {
'use strict';
// Feature detect
if (!(window.customElements && document.body.attachShadow)) {
document.querySelector('fancy-tabs').innerHTML =
"<b>Your browser doesn't support Shadow DOM and Custom Elements v1.</b>";
return;
}
let selected_ = null;
// See https://www.w3.org/TR/wai-aria-practices-1.1/#tabpanel
customElements.define(
'fancy-tabs',
class extends HTMLElement {
constructor() {
super(); // always call super() first in the ctor.
// Create shadow DOM for the component.
let shadowRoot = this.attachShadow({ mode: 'open' });
shadowRoot.innerHTML = `
<style>
:host {
display: inline-block;
width: 650px;
font-family: 'Roboto Slab';
contain: content;
}
:host([background]) {
background: var(--background-color, #9E9E9E);
border-radius: 10px;
padding: 10px;
}
#panels {
box-shadow: 0 2px 2px rgba(0, 0, 0, .3);
background: white;
border-radius: 3px;
padding: 16px;
height: 250px;
overflow: auto;
}
#tabs {
display: inline-flex;
-webkit-user-select: none;
user-select: none;
}
#tabs slot {
display: inline-flex; /* Safari bug. Treats <slot> as a parent */
}
/* Safari does not support #id prefixes on ::slotted
See https://bugs.webkit.org/show_bug.cgi?id=160538 */
#tabs ::slotted(*) {
font: 400 16px/22px 'Roboto';
padding: 16px 8px;
margin: 0;
text-align: center;
width: 100px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
cursor: pointer;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
background: linear-gradient(#fafafa, #eee);
border: none; /* if the user users a <button> */
}
#tabs ::slotted([aria-selected="true"]) {
font-weight: 600;
background: white;
box-shadow: none;
}
#tabs ::slotted(:focus) {
z-index: 1; /* make sure focus ring doesn't get buried */
}
#panels ::slotted([aria-hidden="true"]) {
display: none;
}
</style>
<div id="tabs">
<slot id="tabsSlot" name="title"></slot>
</div>
<div id="panels">
<slot id="panelsSlot"></slot>
</div>
`;
}
get selected() {
return selected_;
}
set selected(idx) {
selected_ = idx;
this._selectTab(idx);
// Updated the element's selected attribute value when
// backing property changes.
this.setAttribute('selected', idx);
}
connectedCallback() {
this.setAttribute('role', 'tablist');
const tabsSlot = this.shadowRoot.querySelector('#tabsSlot');
const panelsSlot = this.shadowRoot.querySelector('#panelsSlot');
this.tabs = tabsSlot.assignedNodes({ flatten: true });
this.panels = panelsSlot
.assignedNodes({ flatten: true })
.filter((el) => {
return el.nodeType === Node.ELEMENT_NODE;
});
// Add aria role="tabpanel" to each content panel.
for (let [i, panel] of this.panels.entries()) {
panel.setAttribute('role', 'tabpanel');
panel.setAttribute('tabindex', 0);
}
// Save refer to we can remove listeners later.
this._boundOnTitleClick = this._onTitleClick.bind(this);
this._boundOnKeyDown = this._onKeyDown.bind(this);
tabsSlot.addEventListener('click', this._boundOnTitleClick);
tabsSlot.addEventListener('keydown', this._boundOnKeyDown);
this.selected = this._findFirstSelectedTab() || 0;
}
disconnectedCallback() {
const tabsSlot = this.shadowRoot.querySelector('#tabsSlot');
tabsSlot.removeEventListener('click', this._boundOnTitleClick);
tabsSlot.removeEventListener('keydown', this._boundOnKeyDown);
}
_onTitleClick(e) {
if (e.target.slot === 'title') {
this.selected = this.tabs.indexOf(e.target);
e.target.focus();
}
}
_onKeyDown(e) {
switch (e.code) {
case 'ArrowUp':
case 'ArrowLeft':
e.preventDefault();
var idx = this.selected - 1;
idx = idx < 0 ? this.tabs.length - 1 : idx;
this.tabs[idx].click();
break;
case 'ArrowDown':
case 'ArrowRight':
e.preventDefault();
var idx = this.selected + 1;
this.tabs[idx % this.tabs.length].click();
break;
default:
break;
}
}
_findFirstSelectedTab() {
let selectedIdx;
for (let [i, tab] of this.tabs.entries()) {
tab.setAttribute('role', 'tab');
// Allow users to declaratively select a tab
// Highlight last tab which has the selected attribute.
if (tab.hasAttribute('selected')) {
selectedIdx = i;
}
}
return selectedIdx;
}
_selectTab(idx = null) {
for (let i = 0, tab; (tab = this.tabs[i]); ++i) {
let select = i === idx;
tab.setAttribute('tabindex', select ? 0 : -1);
tab.setAttribute('aria-selected', select);
this.panels[i].setAttribute('aria-hidden', !select);
}
}
},
);
})();
</script>
</body>
</html>

View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>video</title>
</head>
<body>
<video controls>
<source src=http://techslides.com/demos/sample-videos/small.webm
type=video/webm> <source
src=http://techslides.com/demos/sample-videos/small.ogv type=video/ogg>
<source src=http://techslides.com/demos/sample-videos/small.mp4
type=video/mp4> <source
src=http://techslides.com/demos/sample-videos/small.3gp type=video/3gp>
</video>
</body>
</html>

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<a href="./basic.html"></a>
<alt="">Hello</alt="">
<alt34>Hello</alt34>
<d123-_+!@#$%^&*()>Hello</d123-_+!@#$%^&*()>
<ale#></ale#>
<img src="./a.jpg" alt="" srcset="">
<img src="./a.jpg" alt="" srcset="/a.jpg">
<img src="./a.jpg" alt="" srcset="http://exmple.com/a.jpg ">
<img src="./a.jpg" alt="" srcset="/a.jpg 3x, /a.jpg 45x , /b.png">
<img src="./a.jpg" alt="" srcset="/300,400/a.jpg 300w,b.png">
</body>
</html>

View File

@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>with script</title>
</head>
<body>
<script src="/js/a.js"></script>
<script>
var a = 1 + 1;
</script>
</body>
</html>

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>with style sheet with import</title>
<link rel="stylesheet" href="/css/style-with-import.css">
</head>
<body>
</body>
</html>

View File

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>with style sheet</title>
<link rel="stylesheet" href="/css/style.css">
</head>
<body>
</body>
</html>