mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
This commit is contained in:
parent
37e90e3dfe
commit
214f5d9fc3
4949 changed files with 1393320 additions and 29 deletions
1
node_modules/get-size/.nvmrc
generated
vendored
Normal file
1
node_modules/get-size/.nvmrc
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
16
|
7
node_modules/get-size/LICENSE.md
generated
vendored
Normal file
7
node_modules/get-size/LICENSE.md
generated
vendored
Normal file
|
@ -0,0 +1,7 @@
|
|||
Copyright (c) 2012-2021 [David DeSandro](https://desandro.com) and [contributors](https://github.com/desandro/get-size/graphs/contributors)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
33
node_modules/get-size/README.md
generated
vendored
Normal file
33
node_modules/get-size/README.md
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
# getSize
|
||||
|
||||
Get the size of elements. Used in [Masonry](https://masonry.desandro.com), [Isotope](https://isotope.metafizzy.co), & [Flickity](https://flickity.metafizzy.co).
|
||||
|
||||
``` js
|
||||
var size = getSize( elem );
|
||||
// elem can be an element
|
||||
var size = getSize( document.querySelector('.selector') )
|
||||
// elem can be a selector string
|
||||
var size = getSize('.selector')
|
||||
```
|
||||
|
||||
Returns an object with:
|
||||
|
||||
+ width, height
|
||||
+ innerWidth, innerHeight
|
||||
+ outerWidth, outerHeight
|
||||
+ paddingLeft, paddingTop, paddingRight, paddingBottom
|
||||
+ marginLeft, marginTop, marginRight, marginBottom
|
||||
+ borderLeftWidth, borderTopWidth, borderRightWidth, borderBottomWidth
|
||||
+ isBorderBox
|
||||
|
||||
Browser support: Chrome 51+, Firefox 50+, Edge 12+, Safari 10+,
|
||||
|
||||
## Install
|
||||
|
||||
npm: `npm install get-size`
|
||||
|
||||
Yarn: `yarn add get-size`
|
||||
|
||||
## MIT License
|
||||
|
||||
getSize is released under the MIT License. Have at it.
|
23
node_modules/get-size/bower.json
generated
vendored
Normal file
23
node_modules/get-size/bower.json
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"name": "get-size",
|
||||
"description": "measures element size",
|
||||
"main": "get-size.js",
|
||||
"authors": [
|
||||
"David DeSandro"
|
||||
],
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"size",
|
||||
"DOM"
|
||||
],
|
||||
"homepage": "https://github.com/desandro/get-size",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"package.json",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests",
|
||||
"sandbox.html"
|
||||
]
|
||||
}
|
124
node_modules/get-size/get-size.js
generated
vendored
Normal file
124
node_modules/get-size/get-size.js
generated
vendored
Normal file
|
@ -0,0 +1,124 @@
|
|||
/*!
|
||||
* Infinite Scroll v2.0.4
|
||||
* measure size of elements
|
||||
* MIT license
|
||||
*/
|
||||
|
||||
( function( window, factory ) {
|
||||
if ( typeof module == 'object' && module.exports ) {
|
||||
// CommonJS
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// browser global
|
||||
window.getSize = factory();
|
||||
}
|
||||
|
||||
} )( window, function factory() {
|
||||
|
||||
// -------------------------- helpers -------------------------- //
|
||||
|
||||
// get a number from a string, not a percentage
|
||||
function getStyleSize( value ) {
|
||||
let num = parseFloat( value );
|
||||
// not a percent like '100%', and a number
|
||||
let isValid = value.indexOf('%') == -1 && !isNaN( num );
|
||||
return isValid && num;
|
||||
}
|
||||
|
||||
// -------------------------- measurements -------------------------- //
|
||||
|
||||
let measurements = [
|
||||
'paddingLeft',
|
||||
'paddingRight',
|
||||
'paddingTop',
|
||||
'paddingBottom',
|
||||
'marginLeft',
|
||||
'marginRight',
|
||||
'marginTop',
|
||||
'marginBottom',
|
||||
'borderLeftWidth',
|
||||
'borderRightWidth',
|
||||
'borderTopWidth',
|
||||
'borderBottomWidth',
|
||||
];
|
||||
|
||||
let measurementsLength = measurements.length;
|
||||
|
||||
function getZeroSize() {
|
||||
let size = {
|
||||
width: 0,
|
||||
height: 0,
|
||||
innerWidth: 0,
|
||||
innerHeight: 0,
|
||||
outerWidth: 0,
|
||||
outerHeight: 0,
|
||||
};
|
||||
measurements.forEach( ( measurement ) => {
|
||||
size[ measurement ] = 0;
|
||||
} );
|
||||
return size;
|
||||
}
|
||||
|
||||
// -------------------------- getSize -------------------------- //
|
||||
|
||||
function getSize( elem ) {
|
||||
// use querySeletor if elem is string
|
||||
if ( typeof elem == 'string' ) elem = document.querySelector( elem );
|
||||
|
||||
// do not proceed on non-objects
|
||||
let isElement = elem && typeof elem == 'object' && elem.nodeType;
|
||||
if ( !isElement ) return;
|
||||
|
||||
let style = getComputedStyle( elem );
|
||||
|
||||
// if hidden, everything is 0
|
||||
if ( style.display == 'none' ) return getZeroSize();
|
||||
|
||||
let size = {};
|
||||
size.width = elem.offsetWidth;
|
||||
size.height = elem.offsetHeight;
|
||||
|
||||
let isBorderBox = size.isBorderBox = style.boxSizing == 'border-box';
|
||||
|
||||
// get all measurements
|
||||
measurements.forEach( ( measurement ) => {
|
||||
let value = style[ measurement ];
|
||||
let num = parseFloat( value );
|
||||
// any 'auto', 'medium' value will be 0
|
||||
size[ measurement ] = !isNaN( num ) ? num : 0;
|
||||
} );
|
||||
|
||||
let paddingWidth = size.paddingLeft + size.paddingRight;
|
||||
let paddingHeight = size.paddingTop + size.paddingBottom;
|
||||
let marginWidth = size.marginLeft + size.marginRight;
|
||||
let marginHeight = size.marginTop + size.marginBottom;
|
||||
let borderWidth = size.borderLeftWidth + size.borderRightWidth;
|
||||
let borderHeight = size.borderTopWidth + size.borderBottomWidth;
|
||||
|
||||
// overwrite width and height if we can get it from style
|
||||
let styleWidth = getStyleSize( style.width );
|
||||
if ( styleWidth !== false ) {
|
||||
size.width = styleWidth +
|
||||
// add padding and border unless it's already including it
|
||||
( isBorderBox ? 0 : paddingWidth + borderWidth );
|
||||
}
|
||||
|
||||
let styleHeight = getStyleSize( style.height );
|
||||
if ( styleHeight !== false ) {
|
||||
size.height = styleHeight +
|
||||
// add padding and border unless it's already including it
|
||||
( isBorderBox ? 0 : paddingHeight + borderHeight );
|
||||
}
|
||||
|
||||
size.innerWidth = size.width - ( paddingWidth + borderWidth );
|
||||
size.innerHeight = size.height - ( paddingHeight + borderHeight );
|
||||
|
||||
size.outerWidth = size.width + marginWidth;
|
||||
size.outerHeight = size.height + marginHeight;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
return getSize;
|
||||
|
||||
} );
|
3
node_modules/get-size/notes.md
generated
vendored
Normal file
3
node_modules/get-size/notes.md
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
<!-- add lint script -->
|
||||
<!-- add GitHub workflow -->
|
||||
|
52
node_modules/get-size/package.json
generated
vendored
Normal file
52
node_modules/get-size/package.json
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
{
|
||||
"name": "get-size",
|
||||
"version": "3.0.0",
|
||||
"description": "measures element size",
|
||||
"main": "get-size.js",
|
||||
"devDependencies": {
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-metafizzy": "^1.2.1",
|
||||
"qunit": "^2.17.2"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "npx eslint .",
|
||||
"test": "echo \"View test/ in browser\" && exit 1",
|
||||
"version": "node tasks/version.js && git add -A ."
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/desandro/get-size.git"
|
||||
},
|
||||
"keywords": [
|
||||
"size",
|
||||
"DOM"
|
||||
],
|
||||
"author": "David DeSandro",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/desandro/get-size/issues"
|
||||
},
|
||||
"homepage": "https://github.com/desandro/get-size",
|
||||
"eslintConfig": {
|
||||
"plugins": [
|
||||
"metafizzy"
|
||||
],
|
||||
"extends": "plugin:metafizzy/browser",
|
||||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
"rules": {
|
||||
"complexity": [
|
||||
"error",
|
||||
20
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
85
node_modules/get-size/sandbox.html
generated
vendored
Normal file
85
node_modules/get-size/sandbox.html
generated
vendored
Normal file
|
@ -0,0 +1,85 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>getSize</title>
|
||||
|
||||
<style>
|
||||
.container {
|
||||
width: 300px;
|
||||
height: 200px;
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.box {
|
||||
color: blue;
|
||||
background: pink;
|
||||
}
|
||||
|
||||
.border-box {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
#box1, #box2 {
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
border: 10px solid;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#box3, #box4 {
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
border: 0px solid;
|
||||
margin: 10%;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#box5, #box6 {
|
||||
width: 100px;
|
||||
height: 100px;
|
||||
border: 10px solid;
|
||||
margin: 10%;
|
||||
padding: 5%;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>getSize</h1>
|
||||
|
||||
<div class="container">
|
||||
<div id="box1" class="box">box1</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div id="box2" class="box border-box">box2</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div id="box3" class="box">box3</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div id="box4" class="box border-box">box4</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div id="box5" class="box">box5</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div id="box6" class="box border-box">box6</div>
|
||||
</div>
|
||||
|
||||
<script src="get-size.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
14
node_modules/get-size/tasks/version.js
generated
vendored
Normal file
14
node_modules/get-size/tasks/version.js
generated
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
/* eslint-env node */
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { version } = require('../package.json');
|
||||
|
||||
function dir( file ) {
|
||||
return path.resolve( __dirname, file );
|
||||
}
|
||||
|
||||
let content = fs.readFileSync( dir('../get-size.js'), 'utf8' );
|
||||
content = content.replace( /getSize v[\w.-]+/,
|
||||
`getSize v${version}` );
|
||||
fs.writeFileSync( dir('../get-size.js'), content, 'utf8' );
|
69
node_modules/get-size/test/index.html
generated
vendored
Normal file
69
node_modules/get-size/test/index.html
generated
vendored
Normal file
|
@ -0,0 +1,69 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Get Size Tests</title>
|
||||
|
||||
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css" />
|
||||
<link rel="stylesheet" href="tests.css" />
|
||||
|
||||
<script src="../node_modules/qunit/qunit/qunit.js"></script>
|
||||
<script src="../get-size.js"></script>
|
||||
<script src="tests.js"></script>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Get Size Tests</h1>
|
||||
|
||||
<div id="ex1" class="container">
|
||||
<div class="box"></div>
|
||||
</div>
|
||||
|
||||
<div id="ex2" class="container">
|
||||
<div class="box"></div>
|
||||
</div>
|
||||
|
||||
<div id="ex3" class="container">
|
||||
<div class="box"></div>
|
||||
</div>
|
||||
|
||||
<div id="ex4" class="container">
|
||||
<div class="box"></div>
|
||||
</div>
|
||||
|
||||
<div id="ex5" class="container">
|
||||
<div class="box"></div>
|
||||
</div>
|
||||
|
||||
<div id="ex6" class="container">
|
||||
<div class="box"></div>
|
||||
</div>
|
||||
|
||||
<div id="ex7" class="container">
|
||||
<div class="box"></div>
|
||||
</div>
|
||||
|
||||
<div id="ex8" class="container">
|
||||
<div class="box"></div>
|
||||
</div>
|
||||
|
||||
<div id="ex9" class="container">
|
||||
<div class="box"></div>
|
||||
</div>
|
||||
|
||||
<div id="hidden" class="container">
|
||||
<div class="box box1"></div>
|
||||
<div class="box box2"></div>
|
||||
</div>
|
||||
|
||||
<div id="percent" class="container">
|
||||
<div class="box"></div>
|
||||
</div>
|
||||
|
||||
<div id="qunit"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
95
node_modules/get-size/test/tests.css
generated
vendored
Normal file
95
node_modules/get-size/test/tests.css
generated
vendored
Normal file
|
@ -0,0 +1,95 @@
|
|||
body {
|
||||
font-family: sans-serif;
|
||||
width: 400px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.container {
|
||||
width: 400px;
|
||||
height: 200px;
|
||||
background: #333;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.box {
|
||||
background: #0AE;
|
||||
color: #F90;
|
||||
border-color: #F90;
|
||||
}
|
||||
|
||||
/* align to right side */
|
||||
#qunit {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 20px;
|
||||
margin-left: 440px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
|
||||
/* Boxes
|
||||
------------------------- */
|
||||
|
||||
#ex2 .box {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#ex3 .box {
|
||||
width: 50%;
|
||||
height: 50%;
|
||||
}
|
||||
|
||||
#ex4 .box,
|
||||
#ex5 .box {
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
border: 10px solid;
|
||||
}
|
||||
|
||||
|
||||
#ex5 .box {
|
||||
margin: 10px 20px 30px 40px;
|
||||
}
|
||||
|
||||
#ex6 .box {
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
padding: 10px 20px 30px 40px;
|
||||
}
|
||||
|
||||
#ex7 .box {
|
||||
height: 100px;
|
||||
padding: 10px 20px 30px 40px;
|
||||
}
|
||||
|
||||
#ex8 .box {
|
||||
position: relative;
|
||||
width: 66.6666%;
|
||||
height: 66.666%;
|
||||
}
|
||||
|
||||
/* border box */
|
||||
#ex9 .box {
|
||||
-webkit-box-sizing: border-box;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
height: 100%;
|
||||
border-style: solid;
|
||||
border-width: 10px 20px 30px 40px;
|
||||
padding: 10px 20px 30px 40px;
|
||||
}
|
||||
|
||||
#hidden .box {
|
||||
display: none;
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
padding: 10px 20px 30px 40px;
|
||||
margin: 10px 20px 30px 40px;
|
||||
}
|
||||
|
||||
#percent .box {
|
||||
width: 200px;
|
||||
height: 100px;
|
||||
margin-top: 20%;
|
||||
margin-left: 10%;
|
||||
}
|
161
node_modules/get-size/test/tests.js
generated
vendored
Normal file
161
node_modules/get-size/test/tests.js
generated
vendored
Normal file
|
@ -0,0 +1,161 @@
|
|||
/**
|
||||
* getSize tests
|
||||
* with QUnit
|
||||
**/
|
||||
|
||||
/* globals getSize, QUnit */
|
||||
|
||||
( function() {
|
||||
|
||||
function getBoxSize( num ) {
|
||||
let box = document.querySelector( '#ex' + num + ' .box' );
|
||||
return getSize( box );
|
||||
}
|
||||
|
||||
QUnit.test( 'arguments', function( assert ) {
|
||||
assert.ok( !getSize( 0 ), 'Number returns falsey' );
|
||||
assert.ok( !getSize( document.querySelector('#foobabbles') ),
|
||||
'bad querySelector returns falsey' );
|
||||
assert.ok( getSize('#ex1'), 'query selector string works' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'ex1: no styling', function( assert ) {
|
||||
let size = getBoxSize( 1 );
|
||||
assert.equal( size.width, 400, 'Inherit container width' );
|
||||
assert.equal( size.height, 0, 'No height' );
|
||||
assert.equal( size.isBorderBox, false, 'isBorderBox' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'ex2: height: 100%', function( assert ) {
|
||||
let size = getBoxSize( 2 );
|
||||
assert.equal( size.height, 200, 'Inherit height' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'ex3: width: 50%; height: 50%', function( assert ) {
|
||||
let size = getBoxSize( 3 );
|
||||
assert.equal( size.width, 200, 'half width' );
|
||||
assert.equal( size.height, 100, 'half height' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'ex4: border: 10px solid', function( assert ) {
|
||||
let size = getBoxSize( 4 );
|
||||
// console.log( size );
|
||||
assert.equal( size.width, 220, 'width = 220 width' );
|
||||
assert.equal( size.height, 120, 'height = 120 height' );
|
||||
assert.equal( size.innerWidth, 200, 'innerWidth = 200 width' );
|
||||
assert.equal( size.innerHeight, 100, 'innerHeight = 200 width' );
|
||||
assert.equal( size.outerWidth, 220, 'outerWidth = 200 width + 10 border + 10 border' );
|
||||
assert.equal( size.outerHeight, 120,
|
||||
'outerHeight = 100 height + 10 border + 10 border' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'ex5: border: 10px solid; margin: 15px', function( assert ) {
|
||||
// margin: 10px 20px 30px 40px;
|
||||
let size = getBoxSize( 5 );
|
||||
// console.log( size );
|
||||
assert.equal( size.width, 220, 'width = 220 width' );
|
||||
assert.equal( size.height, 120, 'height = 120 height' );
|
||||
assert.equal( size.marginTop, 10, 'marginTop' );
|
||||
assert.equal( size.marginRight, 20, 'marginRight' );
|
||||
assert.equal( size.marginBottom, 30, 'marginBottom' );
|
||||
assert.equal( size.marginLeft, 40, 'marginLeft ' );
|
||||
assert.equal( size.innerWidth, 200, 'innerWidth = 200 width' );
|
||||
assert.equal( size.innerHeight, 100, 'innerHeight = 200 width' );
|
||||
assert.equal( size.outerWidth, 280, 'outerWidth = 200 width + 20 border + 60 margin' );
|
||||
assert.equal( size.outerHeight, 160,
|
||||
'outerHeight = 100 height + 20 border + 40 margin' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'ex6: padding, set width/height', function( assert ) {
|
||||
let size = getBoxSize( 6 );
|
||||
// console.log( size );
|
||||
assert.equal( size.width, 260, 'width' );
|
||||
assert.equal( size.height, 140, 'height' );
|
||||
assert.equal( size.innerWidth, 200,
|
||||
'innerWidth = 200 width - 20 padding - 40 padding' );
|
||||
assert.equal( size.innerHeight, 100,
|
||||
'innerHeight = 200 height - 10 padding - 30 padding' );
|
||||
assert.equal( size.outerWidth, 260, 'outerWidth' );
|
||||
assert.equal( size.outerHeight, 140, 'outerHeight' );
|
||||
|
||||
} );
|
||||
|
||||
QUnit.test( 'ex7: padding, inherit width', function( assert ) {
|
||||
// padding: 10px 20px 30px 40px;
|
||||
let size = getBoxSize( 7 );
|
||||
// console.log( size );
|
||||
assert.equal( size.width, 400, 'width' );
|
||||
assert.equal( size.height, 140, 'height' );
|
||||
assert.equal( size.paddingTop, 10, 'paddingTop' );
|
||||
assert.equal( size.paddingRight, 20, 'paddingRight' );
|
||||
assert.equal( size.paddingBottom, 30, 'paddingBottom' );
|
||||
assert.equal( size.paddingLeft, 40, 'paddingLeft ' );
|
||||
assert.equal( size.innerWidth, 340,
|
||||
'innerWidth = 400 width - 20 padding - 40 padding' );
|
||||
assert.equal( size.innerHeight, 100,
|
||||
'innerHeight = 200 height - 10 padding - 30 padding' );
|
||||
assert.equal( size.outerWidth, 400, 'outerWidth' );
|
||||
assert.equal( size.outerHeight, 140, 'outerHeight' );
|
||||
|
||||
} );
|
||||
|
||||
QUnit.test( 'ex8: 66.666% values', function( assert ) {
|
||||
let size = getBoxSize( 8 );
|
||||
|
||||
if ( size.width % 1 ) {
|
||||
assert.ok( size.width > 266.6 && size.width < 266.7,
|
||||
'width is between 266.6 and 266.7' );
|
||||
} else {
|
||||
// IE8 and Safari
|
||||
assert.equal( size.width, 267, 'width is 267' );
|
||||
}
|
||||
|
||||
if ( size.height % 1 ) {
|
||||
assert.ok( size.height > 133.3 && size.height < 133.4,
|
||||
'height is between 133.3 and 133.4' );
|
||||
} else {
|
||||
// IE8
|
||||
assert.equal( size.height, 133, 'width is 133' );
|
||||
}
|
||||
} );
|
||||
|
||||
QUnit.test( 'ex9: border-box', function( assert ) {
|
||||
let size = getBoxSize( 9 );
|
||||
assert.equal( size.isBorderBox, true, 'isBorderBox' );
|
||||
assert.equal( size.width, 400, 'width' );
|
||||
assert.equal( size.height, 200, 'height' );
|
||||
assert.equal( size.innerWidth, 280, 'innerWidth' );
|
||||
assert.equal( size.innerHeight, 120, 'innerHeight' );
|
||||
assert.equal( size.outerWidth, 400, 'outerWidth' );
|
||||
assert.equal( size.outerHeight, 200, 'outerHeight' );
|
||||
} );
|
||||
|
||||
QUnit.test( 'display: none', function( assert ) {
|
||||
let size = getSize( document.querySelector('#hidden .box1') );
|
||||
assert.strictEqual( size.width, 0, 'width' );
|
||||
assert.strictEqual( size.height, 0, 'height' );
|
||||
assert.strictEqual( size.innerWidth, 0, 'innerWidth' );
|
||||
assert.strictEqual( size.innerHeight, 0, 'innerHeight' );
|
||||
assert.strictEqual( size.outerWidth, 0, 'outerWidth' );
|
||||
assert.strictEqual( size.outerHeight, 0, 'outerHeight' );
|
||||
|
||||
size.width = 300;
|
||||
|
||||
size = getSize( document.querySelector('#hidden .box2') );
|
||||
assert.strictEqual( size.width, 0, 'cannot over write zeroSize' );
|
||||
|
||||
} );
|
||||
|
||||
QUnit.test( 'percent values', function( assert ) {
|
||||
let size = getSize( document.querySelector('#percent .box') );
|
||||
assert.strictEqual( size.marginLeft, 40, 'marginLeft' );
|
||||
assert.strictEqual( size.marginTop, 80, 'marginTop' );
|
||||
assert.strictEqual( size.width, 200, 'width' );
|
||||
assert.strictEqual( size.height, 100, 'height' );
|
||||
assert.strictEqual( size.innerWidth, 200, 'innerWidth' );
|
||||
assert.strictEqual( size.innerHeight, 100, 'innerHeight' );
|
||||
assert.strictEqual( size.outerWidth, 240, 'outerWidth' );
|
||||
assert.strictEqual( size.outerHeight, 180, 'outerHeight' );
|
||||
} );
|
||||
|
||||
} )( window );
|
Loading…
Add table
Add a link
Reference in a new issue