Initial commit
This commit is contained in:
commit
27d1c97944
1
css/bundle.min.css
vendored
Normal file
1
css/bundle.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
/*! normalize.css v4.2.0 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}progress{vertical-align:baseline}[hidden],template{display:none}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit;font-weight:bolder}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}svg:not(:root){overflow:hidden}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}button,input,optgroup,select,textarea{font:inherit;margin:0}optgroup{font-weight:700}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-input-placeholder{color:inherit;opacity:.54}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.DlHighlight pre{margin:0;padding:0}.DlHighlight .keyword{color:#d75f00;font-weight:700}.DlHighlight .builtin{color:#2aa198}.DlHighlight .string{color:#af8700}.DlHighlight .string .after,.DlHighlight .string .before{color:#5f5faf}.DlHighlight .hashkey{color:#a51}.DlHighlight .hasharrow{color:red}.DlHighlight .paren{font-weight:700}.DlHighlight .operator{color:#b58900}.DlHighlight .error{background-color:#c00;color:#fff}.DlHighlight .defun{font-weight:700}.DLHighlight .undefined,.DlHighlight .xml-tagangle{color:#268bd2}.DlHighlight .xml-tag-close .before{color:#52a}.DlHighlight .xml-entity{color:#b2a}.DlHighlight .xml-entity .after,.DlHighlight .xml-entity .before{color:#607}*{display:border-box}datalist,datalist option{visibility:hidden}hr{margin:1em 0}form>div,header,main{padding:1em}label{display:block;padding:.75em 0;text-shadow:#fff 3px 3px 10px}label:after{content:':'}fieldset{margin-bottom:1em;border-radius:.25em}fieldset fieldset{background:#eee}fieldset fieldset fieldset{background:#ddd}fieldset fieldset fieldset fieldset{background:#ccc}legend{padding:.25em;border:1px solid #ddd;border-radius:.25em}code{font-family:Consolas,Monaco,sans-serif;overflow-x:scroll;white-space:nowrap}code,legend{background:#fdf6e3}.form-field{display:block}.form-field .example,.form-field code{display:-moz-inline-box;display:inline-block;vertical-align:top;margin:.5em auto}.form-field .example{width:32%}.form-field code{border:1px solid #ddd;border-radius:.25em;margin-left:.5em;padding:.5em;width:64%}.example{text-align:center}.example>*{margin:0 auto;text-align:left;width:90%}.example>code{width:inherit}output{text-align:left}input:active+label,input:focus+label,input:hover+label{font-size:1.5em;font-weight:700}[type=checkbox]+label,[type=option]+label{font-weight:400}[type=checkbox]:checked+label,[type=option]:checked+label{font-weight:700}[required]:valid+label{color:green}[required]:invalid+label{font-weight:700;color:red}.antipattern{background:#c77}.antipattern fieldset{background:#a55}
|
1
css/dlH.min.css
vendored
Normal file
1
css/dlH.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
.DlHighlight pre{margin:0;padding:0}.DlHighlight .keyword{color:#d75f00;font-weight:700}.DlHighlight .builtin{color:#2aa198}.DlHighlight .string{color:#af8700}.DlHighlight .string .after,.DlHighlight .string .before{color:#5f5faf}.DlHighlight .hashkey{color:#a51}.DlHighlight .hasharrow{color:red}.DlHighlight .paren{font-weight:700}.DlHighlight .operator{color:#b58900}.DlHighlight .error{background-color:#c00;color:#fff}.DlHighlight .defun{font-weight:700}.DLHighlight .undefined,.DlHighlight .xml-tagangle{color:#268bd2}.DlHighlight .xml-tag-close .before{color:#52a}.DlHighlight .xml-entity{color:#b2a}.DlHighlight .xml-entity .after,.DlHighlight .xml-entity .before{color:#607}
|
1
css/normalize.min.css
vendored
Normal file
1
css/normalize.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
/*! normalize.css v4.2.0 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;line-height:1.15;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,main,menu,nav,section,summary{display:block}audio,canvas,progress,video{display:inline-block}audio:not([controls]){display:none;height:0}progress{vertical-align:baseline}[hidden],template{display:none}a{background-color:transparent;-webkit-text-decoration-skip:objects}a:active,a:hover{outline-width:0}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:inherit;font-weight:bolder}dfn{font-style:italic}h1{font-size:2em;margin:.67em 0}mark{background-color:#ff0;color:#000}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}svg:not(:root){overflow:hidden}code,kbd,pre,samp{font-family:monospace,monospace;font-size:1em}figure{margin:1em 40px}hr{box-sizing:content-box;height:0;overflow:visible}button,input,optgroup,select,textarea{font:inherit;margin:0}optgroup{font-weight:700}button,input{overflow:visible}button,select{text-transform:none}[type=reset],[type=submit],button,html [type=button]{-webkit-appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-cancel-button,[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-input-placeholder{color:inherit;opacity:.54}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}
|
4
css/old-ie.css
Normal file
4
css/old-ie.css
Normal file
@ -0,0 +1,4 @@
|
||||
.form-field .example, .form-field code{
|
||||
zoom:1;
|
||||
display: inline;
|
||||
}
|
35
css/src/dlH.css
Normal file
35
css/src/dlH.css
Normal file
@ -0,0 +1,35 @@
|
||||
/* Generics */
|
||||
.DlHighlight pre { margin: 0; padding: 0; }
|
||||
|
||||
.DlHighlight .keyword { color: #d75f00; font-weight: bold; }
|
||||
|
||||
.DlHighlight .builtin { color: #2aa198; }
|
||||
|
||||
.DlHighlight .string { color: #af8700; }
|
||||
.DlHighlight .string .before, .DlHighlight .string .after { color: #5f5faf; }
|
||||
|
||||
.DlHighlight .hashkey { color: #a51; }
|
||||
|
||||
.DlHighlight .hasharrow { color: #f00; }
|
||||
|
||||
.DlHighlight .paren { font-weight: bold; }
|
||||
|
||||
.DlHighlight .operator { color: #b58900; }
|
||||
|
||||
.DlHighlight .error { background-color: #c00; color: #fff; }
|
||||
|
||||
.DlHighlight .defun { font-weight: bold; }
|
||||
|
||||
.DLHighlight .undefined {
|
||||
color: #268bd2;
|
||||
}
|
||||
|
||||
/* XML */
|
||||
.DlHighlight .xml-tagangle {
|
||||
color: #268bd2;
|
||||
}
|
||||
|
||||
.DlHighlight .xml-tag-close .before { color: #52a; }
|
||||
|
||||
.DlHighlight .xml-entity { color: #b2a; }
|
||||
.DlHighlight .xml-entity .before, .DlHighlight .xml-entity .after { color: #607; }
|
422
css/src/normalize.css
vendored
Normal file
422
css/src/normalize.css
vendored
Normal file
@ -0,0 +1,422 @@
|
||||
/*! normalize.css v4.2.0 | MIT License | github.com/necolas/normalize.css */
|
||||
|
||||
/**
|
||||
* 1. Change the default font family in all browsers (opinionated).
|
||||
* 2. Correct the line height in all browsers.
|
||||
* 3. Prevent adjustments of font size after orientation changes in IE and iOS.
|
||||
*/
|
||||
|
||||
html {
|
||||
font-family: sans-serif; /* 1 */
|
||||
line-height: 1.15; /* 2 */
|
||||
-ms-text-size-adjust: 100%; /* 3 */
|
||||
-webkit-text-size-adjust: 100%; /* 3 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the margin in all browsers (opinionated).
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* HTML5 display definitions
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 9-.
|
||||
* 1. Add the correct display in Edge, IE, and Firefox.
|
||||
* 2. Add the correct display in IE.
|
||||
*/
|
||||
|
||||
article,
|
||||
aside,
|
||||
details, /* 1 */
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
main, /* 2 */
|
||||
menu,
|
||||
nav,
|
||||
section,
|
||||
summary { /* 1 */
|
||||
display: block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 9-.
|
||||
*/
|
||||
|
||||
audio,
|
||||
canvas,
|
||||
progress,
|
||||
video {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct display in iOS 4-7.
|
||||
*/
|
||||
|
||||
audio:not([controls]) {
|
||||
display: none;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct vertical alignment in Chrome, Firefox, and Opera.
|
||||
*/
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct display in IE 10-.
|
||||
* 1. Add the correct display in IE.
|
||||
*/
|
||||
|
||||
template, /* 1 */
|
||||
[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Links
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Remove the gray background on active links in IE 10.
|
||||
* 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
|
||||
*/
|
||||
|
||||
a {
|
||||
background-color: transparent; /* 1 */
|
||||
-webkit-text-decoration-skip: objects; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the outline on focused links when they are also active or hovered
|
||||
* in all browsers (opinionated).
|
||||
*/
|
||||
|
||||
a:active,
|
||||
a:hover {
|
||||
outline-width: 0;
|
||||
}
|
||||
|
||||
/* Text-level semantics
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Remove the bottom border in Firefox 39-.
|
||||
* 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
|
||||
*/
|
||||
|
||||
abbr[title] {
|
||||
border-bottom: none; /* 1 */
|
||||
text-decoration: underline; /* 2 */
|
||||
text-decoration: underline dotted; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent the duplicate application of `bolder` by the next rule in Safari 6.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font weight in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font style in Android 4.3-.
|
||||
*/
|
||||
|
||||
dfn {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the font size and margin on `h1` elements within `section` and
|
||||
* `article` contexts in Chrome, Firefox, and Safari.
|
||||
*/
|
||||
|
||||
h1 {
|
||||
font-size: 2em;
|
||||
margin: 0.67em 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct background and color in IE 9-.
|
||||
*/
|
||||
|
||||
mark {
|
||||
background-color: #ff0;
|
||||
color: #000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prevent `sub` and `sup` elements from affecting the line height in
|
||||
* all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
/* Embedded content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* Remove the border on images inside links in IE 10-.
|
||||
*/
|
||||
|
||||
img {
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide the overflow in IE.
|
||||
*/
|
||||
|
||||
svg:not(:root) {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* Grouping content
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Correct the inheritance and scaling of font size in all browsers.
|
||||
* 2. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
pre,
|
||||
samp {
|
||||
font-family: monospace, monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the correct margin in IE 8.
|
||||
*/
|
||||
|
||||
figure {
|
||||
margin: 1em 40px;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in Firefox.
|
||||
* 2. Show the overflow in Edge and IE.
|
||||
*/
|
||||
|
||||
hr {
|
||||
box-sizing: content-box; /* 1 */
|
||||
height: 0; /* 1 */
|
||||
overflow: visible; /* 2 */
|
||||
}
|
||||
|
||||
/* Forms
|
||||
========================================================================== */
|
||||
|
||||
/**
|
||||
* 1. Change font properties to `inherit` in all browsers (opinionated).
|
||||
* 2. Remove the margin in Firefox and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font: inherit; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the font weight unset by the previous rule.
|
||||
*/
|
||||
|
||||
optgroup {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the overflow in IE.
|
||||
* 1. Show the overflow in Edge.
|
||||
*/
|
||||
|
||||
button,
|
||||
input { /* 1 */
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inheritance of text transform in Edge, Firefox, and IE.
|
||||
* 1. Remove the inheritance of text transform in Firefox.
|
||||
*/
|
||||
|
||||
button,
|
||||
select { /* 1 */
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
|
||||
* controls in Android 4.
|
||||
* 2. Correct the inability to style clickable types in iOS and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
html [type="button"], /* 1 */
|
||||
[type="reset"],
|
||||
[type="submit"] {
|
||||
-webkit-appearance: button; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner border and padding in Firefox.
|
||||
*/
|
||||
|
||||
button::-moz-focus-inner,
|
||||
[type="button"]::-moz-focus-inner,
|
||||
[type="reset"]::-moz-focus-inner,
|
||||
[type="submit"]::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the focus styles unset by the previous rule.
|
||||
*/
|
||||
|
||||
button:-moz-focusring,
|
||||
[type="button"]:-moz-focusring,
|
||||
[type="reset"]:-moz-focusring,
|
||||
[type="submit"]:-moz-focusring {
|
||||
outline: 1px dotted ButtonText;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the border, margin, and padding in all browsers (opinionated).
|
||||
*/
|
||||
|
||||
fieldset {
|
||||
border: 1px solid #c0c0c0;
|
||||
margin: 0 2px;
|
||||
padding: 0.35em 0.625em 0.75em;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the text wrapping in Edge and IE.
|
||||
* 2. Correct the color inheritance from `fieldset` elements in IE.
|
||||
* 3. Remove the padding so developers are not caught out when they zero out
|
||||
* `fieldset` elements in all browsers.
|
||||
*/
|
||||
|
||||
legend {
|
||||
box-sizing: border-box; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
display: table; /* 1 */
|
||||
max-width: 100%; /* 1 */
|
||||
padding: 0; /* 3 */
|
||||
white-space: normal; /* 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the default vertical scrollbar in IE.
|
||||
*/
|
||||
|
||||
textarea {
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Add the correct box sizing in IE 10-.
|
||||
* 2. Remove the padding in IE 10-.
|
||||
*/
|
||||
|
||||
[type="checkbox"],
|
||||
[type="radio"] {
|
||||
box-sizing: border-box; /* 1 */
|
||||
padding: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the cursor style of increment and decrement buttons in Chrome.
|
||||
*/
|
||||
|
||||
[type="number"]::-webkit-inner-spin-button,
|
||||
[type="number"]::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the odd appearance in Chrome and Safari.
|
||||
* 2. Correct the outline style in Safari.
|
||||
*/
|
||||
|
||||
[type="search"] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
outline-offset: -2px; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the inner padding and cancel buttons in Chrome and Safari on OS X.
|
||||
*/
|
||||
|
||||
[type="search"]::-webkit-search-cancel-button,
|
||||
[type="search"]::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/**
|
||||
* Correct the text style of placeholders in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
::-webkit-input-placeholder {
|
||||
color: inherit;
|
||||
opacity: 0.54;
|
||||
}
|
||||
|
||||
/**
|
||||
* 1. Correct the inability to style clickable types in iOS and Safari.
|
||||
* 2. Change font properties to `inherit` in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button; /* 1 */
|
||||
font: inherit; /* 2 */
|
||||
}
|
117
css/src/style.css
Normal file
117
css/src/style.css
Normal file
@ -0,0 +1,117 @@
|
||||
* {
|
||||
display: border-box;
|
||||
}
|
||||
|
||||
datalist, datalist option {
|
||||
visibility:hidden;
|
||||
}
|
||||
|
||||
hr {
|
||||
margin:1em 0;
|
||||
}
|
||||
|
||||
header, main, form > div {
|
||||
padding:1em;
|
||||
}
|
||||
label {
|
||||
display: block;
|
||||
padding:0.75em 0;
|
||||
text-shadow: #fff 3px 3px 10px;
|
||||
}
|
||||
label::after {
|
||||
content: ':';
|
||||
}
|
||||
fieldset {
|
||||
margin-bottom: 1em;
|
||||
border-radius: 0.25em;
|
||||
}
|
||||
fieldset fieldset { background: #eee;}
|
||||
fieldset fieldset fieldset { background: #ddd; }
|
||||
fieldset fieldset fieldset fieldset { background: #ccc; }
|
||||
|
||||
legend {
|
||||
padding: 0.25em;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 0.25em;
|
||||
}
|
||||
|
||||
code {
|
||||
font-family: Consolas, Monaco, sans-serif;
|
||||
overflow-x: scroll;
|
||||
white-space:nowrap;
|
||||
}
|
||||
|
||||
code, legend {
|
||||
background:#fdf6e3;
|
||||
}
|
||||
|
||||
.form-field {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.form-field .example, .form-field code {
|
||||
/* Old Mozilla */
|
||||
display:-moz-inline-box;
|
||||
/* Modern */
|
||||
display:inline-block;
|
||||
vertical-align:top;
|
||||
margin: 0.5em auto;
|
||||
}
|
||||
|
||||
.form-field .example {
|
||||
width: 32%;
|
||||
}
|
||||
|
||||
.form-field code {
|
||||
border: 1px solid #ddd;
|
||||
border-radius:0.25em;
|
||||
margin-left: 0.5em;
|
||||
padding:0.5em;
|
||||
width: 64%;
|
||||
}
|
||||
|
||||
.example {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.example > * {
|
||||
margin: 0 auto;
|
||||
text-align:left;
|
||||
width:90%;
|
||||
}
|
||||
|
||||
.example > code {
|
||||
width: inherit;
|
||||
}
|
||||
|
||||
output {
|
||||
text-align:left;
|
||||
}
|
||||
|
||||
input:active + label, input:hover + label, input:focus + label {
|
||||
font-size:1.5em;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
[type="checkbox"] + label, [type="option"] + label{
|
||||
font-weight:normal;
|
||||
}
|
||||
|
||||
[type="checkbox"]:checked + label, [type="option"]:checked + label {
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
[required]:valid + label {
|
||||
color: green;
|
||||
}
|
||||
[required]:invalid + label {
|
||||
font-weight:bold;
|
||||
color: red;
|
||||
}
|
||||
|
||||
.antipattern {
|
||||
background: #c77;
|
||||
}
|
||||
.antipattern fieldset {
|
||||
background: #a55;
|
||||
}
|
1
css/style.min.css
vendored
Normal file
1
css/style.min.css
vendored
Normal file
@ -0,0 +1 @@
|
||||
*{display:border-box}datalist,datalist option{visibility:hidden}hr{margin:1em 0}form>div,header,main{padding:1em}label{display:block;padding:.75em 0;text-shadow:#fff 3px 3px 10px}label:after{content:':'}fieldset{margin-bottom:1em;border-radius:.25em}fieldset fieldset{background:#eee}fieldset fieldset fieldset{background:#ddd}fieldset fieldset fieldset fieldset{background:#ccc}legend{padding:.25em;border:1px solid #ddd;border-radius:.25em}code{font-family:Consolas,Monaco,sans-serif;overflow-x:scroll;white-space:nowrap}code,legend{background:#fdf6e3}.form-field{display:block}.form-field .example,.form-field code{display:-moz-inline-box;display:inline-block;vertical-align:top;margin:.5em auto}.form-field .example{width:32%}.form-field code{border:1px solid #ddd;border-radius:.25em;margin-left:.5em;padding:.5em;width:64%}.example{text-align:center}.example>*{margin:0 auto;text-align:left;width:90%}.example>code{width:inherit}output{text-align:left}input:active+label,input:focus+label,input:hover+label{font-size:1.5em;font-weight:700}[type=checkbox]+label,[type=option]+label{font-weight:400}[type=checkbox]:checked+label,[type=option]:checked+label{font-weight:700}[required]:valid+label{color:green}[required]:invalid+label{font-weight:700;color:red}.antipattern{background:#c77}.antipattern fieldset{background:#a55}
|
760
index.html
Normal file
760
index.html
Normal file
@ -0,0 +1,760 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Form Fields Cheatsheet</title>
|
||||
<meta charset="UTF-8" />
|
||||
<!--[if lt IE 9]>
|
||||
<script src="js/polyfills/html5shiv.min.js"></script>
|
||||
<script src="js/polyfills/ie-array-slice-shim.js"></script>
|
||||
<![endif]-->
|
||||
<link rel="stylesheet" href="css/bundle.min.css" />
|
||||
<!--[if lt IE 8]>
|
||||
<link rel="stylesheet" href="css/old-ie.css" />
|
||||
<script src="js/polyfills/Dom/CSS_selector_engine.ielt8.js"></script>
|
||||
<script>document.OLD_IE = true;</script>
|
||||
<![endif]-->
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>HTML Forms Best Practice Cheetsheet</h1>
|
||||
</header>
|
||||
<main>
|
||||
<h2>Sections</h2>
|
||||
<ul>
|
||||
<li><a href="#user-auth">User authentication / signup</a></li>
|
||||
<li><a href="#auth-pass-dupe">Authentication Password duplication (For signup or reset)</a></li>
|
||||
<li><a href="#personal-info">Personal Information</a></li>
|
||||
<li><a href="#organization-info">Organization / Business Information</a></li>
|
||||
<li><a href="#phone-numbers">Phone Numbers</a></li>
|
||||
<li><a href="#contact-info">Contact Information</a></li>
|
||||
<li><a href="#addresses">Addresses</a></li>
|
||||
<li><a href="#cc-info">Credit Card Information</a></li>
|
||||
<li><a href="#money">Money / Currency</a></li>
|
||||
<li><a href="#date-and-time">Date / Time</a></li>
|
||||
<li><a href="#buttons">Buttons</a></li>
|
||||
<li><a href="#other-elements">Other Form Elements</a></li>
|
||||
<li><a href="#antipatterns">Anti-Patterns</a></li>
|
||||
</ul>
|
||||
<hr />
|
||||
<div id="polyfills-loaded"></div>
|
||||
<form action="#" oninput="result.value=parseInt(output1.value) * parseInt(output2.value)">
|
||||
<div id="user-auth">
|
||||
<h3>User authentication / signup</h3>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="username">Username</label>
|
||||
<input id="username" name="username" type="text" autocorrect="off" autocomplete="username" placeholder="timbl" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="new-pass">New Password</label>
|
||||
<input id="new-pass" name="new-pass" type="password" maxlength="50" autocorrect="off" autocomplete="new-password" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="current-pass">Current Password</label>
|
||||
<input id="current-pass" name="current-pass" type="password" maxlength="50" autocorrect="off" autocomplete="current-password" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div id="auth-pass-dupe">
|
||||
<h3>Authentication Password duplication (For signup or reset)</h3>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="confirm-pass-1">Password</label>
|
||||
<input id="confirm-pass-1" name="confirm-pass-1" type="password" maxlength="50" autocorrect="off" autocomplete="new-password" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="confirm-pass-2">Confirm Password</label>
|
||||
<input id="confirm-pass-2" name="confirm-pass-2" type="password" maxlength="50" autocorrect="off" autocomplete="new-password" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div id="personal-info">
|
||||
<h3>Personal Information</h3>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="name">Full Name</label>
|
||||
<input id="name" name="name" type="text" autocorrect="off" autocomplete="name" placeholder="Sir Timothy John Berners-Lee, OM, KBE, FRS, FREng, FRSA" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Split Name Fields</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="prefix">Prefix or title</label>
|
||||
<input id="prefix" name="prefix" type="text" autocorrect="off" autocomplete="honorific-prefix" placeholder="Sir" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="given-name">First / Given Name</label>
|
||||
<input id="given-name" name="given-name" type="text" autocorrect="off" autocomplete="given-name" placeholder="Timothy" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="additional-name">Middle / Additional Name</label>
|
||||
<input id="additional-name" name="additional-name" type="text" autocorrect="off" autocomplete="additional-name" placeholder="John" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="family-name">Last / Family Name</label>
|
||||
<input id="family-name" name="family-name" type="text" autocorrect="off" autocomplete="family-name" placeholder="Berners-Lee" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="suffix">Suffix</label>
|
||||
<input id="suffix" name="suffix" type="text" autocorrect="off" autocomplete="honorific-suffix" placeholder="OM, KBE, FRS, FREng, FRSA" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="nickname">Nickname</label>
|
||||
<input id="nickname" name="nickname" type="text" autocorrect="off" autocomplete="nickname" placeholder="Tim" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="bday">Birthday</label>
|
||||
<input id="bday" name="bday" type="date" autocorrect="off" autocomplete="bday" placeholder="1955-06-08" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Split Birthday</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="bday-day">Birthday Day of the Month</label>
|
||||
<input id="bday-day" name="bday-day" type="number" min="1" max="31" step="1" autocorrect="off" autocomplete="bday-day" placeholder="8" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="bday-month">Birthday Month</label>
|
||||
<input id="bday-month" name="bday-month" type="number" min="1" max="12" step="1" autocorrect="off" autocomplete="bday-month" placeholder="6" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="bday-year">Birthday Year</label>
|
||||
<input id="bday-year" name="bday-year" type="number" min="1900" step="1" autocorrect="off" autocomplete="bday-year" placeholder="1955" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="sex">Sex</label>
|
||||
<input id="sex" name="sex" type="text" autocomplete="sex" placeholder="Male" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="url">Favorite URL</label>
|
||||
<input id="url" name="url" type="url" autocorrect="off" autocomplete="url" placeholder="https://www.w3.org/People/Berners-Lee/" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="photo-url">Photo / Portrait / Avatar</label>
|
||||
<input id="photo-url" name="photo-url" type="url" autocorrect="off" autocomplete="photo" placeholder="https://www.w3.org/Press/Stock/Berners-Lee/2001-europaeum-eighth.jpg" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<hr />
|
||||
<div id="organization-info">
|
||||
<h3>Organization / Business Information</h3>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="organization">Organization / Business</label>
|
||||
<input id="organization" name="organization" type="text" autocorrect="off" autocomplete="organization" placeholder="World Wide Web Consortium" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="organization-title">Organization / Business Title</label>
|
||||
<input id="organization-title" name="organization-title" type="text" autocorrect="off" autocomplete="organization-title" placeholder="Professor" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div id="phone-numbers">
|
||||
<h3>Phone Numbers</h3>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="phone">Phone Number</label>
|
||||
<input id="phone" name="phone" type="tel" autocorrect="off" autocomplete="tel" placeholder="+1 617 253 5702" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="phone-ext">Phone extension</label>
|
||||
<input id="phone-ext" name="phone-ext" type="text" autocorrect="off" autocomplete="tel-extension" pattern="\d*" placeholder="1000" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Split Phone Number</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="tel-country-code">Country Code</label>
|
||||
<input id="tel-country-code" name="tel-country-code" type="text" autocorrect="off" autocomplete="tel-country-code" pattern="\+\d+" placeholder="+1" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="tel-national">National number</label>
|
||||
<input id="tel-national" name="tel-national" type="text" autocorrect="off" autocomplete="tel-national" pattern="(\d+ ?)+" placeholder="617 253 5702" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Split National Number</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="tel-area-code">Area Code</label>
|
||||
<input id="tel-area-code" name="tel-area-code" type="text" autocorrect="off" autocomplete="tel-area-code" pattern="\d*" placeholder="617" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="tel-local">Local Number</label>
|
||||
<input id="tel-local" name="tel-local" type="text" autocorrect="off" autocomplete="tel-local" pattern="\d*" placeholder="2535702" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Split Local Number</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="tel-local-prefix">Local Prefix</label>
|
||||
<input id="tel-local-prefix" name="tel-local-prefix" type="text" autocorrect="off" autocomplete="tel-local-prefix" pattern="\d*" placeholder="253" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="tel-local-suffix">Local Suffix</label>
|
||||
<input id="tel-local-suffix" name="tel-local-suffix" type="text" autocorrect="off" autocomplete="tel-local-suffix" pattern="\d*" placeholder="5702" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
</div>
|
||||
<hr />
|
||||
<div id="contact-info">
|
||||
<h3>Contact Information</h3>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="email">Email</label>
|
||||
<input id="email" name="email" type="email" autocapitalize="off" autocorrect="off" autocomplete="email" placeholder="timbl@w3.org" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="im-url">Instant Messaging URL</label>
|
||||
<input id="im-url" name="im-url" type="url" autocorrect="off" autocomplete="impp" placeholder="irc://example.org/timbl,isuser" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<hr />
|
||||
<div id="addresses">
|
||||
<h3>Addresses</h3>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="textarea-address">Street Address</label>
|
||||
<textarea id="textarea-address" name="textarea-address" autocorrect="off" autocomplete="street-address" placeholder="32 Vassar Street MIT Room 32-G524"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Split Street Address</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="address-line">Address Line 1</label>
|
||||
<input id="address-line" name="address-line" type="text" autocorrect="off" autocomplete="address-line1" placeholder="32 Vassar Street" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="address-line2">Address Line 2</label>
|
||||
<input id="address-line2" name="address-line2" type="text" autocorrect="off" autocomplete="address-line2" placeholder="MIT Room 32-G524" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="address-line3">Address Line 3</label>
|
||||
<input id="address-line3" name="address-line3" type="text" autocorrect="off" autocomplete="address-line3" placeholder="" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="state">State / Province (Address Level 1)</label>
|
||||
<input id="state" name="state" type="text" autocorrect="off" autocomplete="address-level1" placeholder="MA" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="city">City (Address Level 2)</label>
|
||||
<input id="city" name="city" type="text" autocorrect="off" autocomplete="address-level2" placeholder="Cambridge" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="address-level-3">Address Level 3 (Administrative area smaller than level 2)</label>
|
||||
<input id="address-level-3" name="address-level-3" type="text" autocorrect="off" autocomplete="address-level-3" placeholder="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="address-level-4">Address Level 4 (Administrative area smaller than level 3)</label>
|
||||
<input id="address-level-4" name="address-level-4" type="text" autocorrect="off" autocomplete="address-level-4" placeholder="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="country">Country Name</label>
|
||||
<input id="country" name="country" type="text" autocorrect="off" autocomplete="country-name" placeholder="United States" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="country-code">Country Code</label>
|
||||
<input id="country-code" name="country-code" type="text" autocorrect="off" autocomplete="country" placeholder="US" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="zip">Postal Code (Pattern varies by country)</label>
|
||||
<input id="zip" name="zip" type="text" pattern="\d*" autocorrect="off" autocomplete="postal-code" placeholder="02139" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div id="cc-info">
|
||||
<h3>Credit Card Information</h3>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="cc-type">Credit Card Type</label>
|
||||
<input id="cc-type" name="cc-type" type="text" autocorrect="off" autocomplete="cc-type" placeholder="Visa" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="cc-name">Credit Card Name</label>
|
||||
<input id="cc-name" name="cc-name" type="text" autocorrect="off" autocomplete="cc-name" placeholder="Tim Berners-Lee" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Split Credit Card Name</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="cc-given-name">First / Given Name</label>
|
||||
<input id="cc-given-name" name="cc-given-name" type="text" autocorrect="off" autocomplete="cc-given-name" placeholder="Tim" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="cc-additional-name">Middle / Additional Name</label>
|
||||
<input id="cc-additional-name" name="cc-additional-name" type="text" autocorrect="off" autocomplete="cc-additional-name" placeholder="" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="cc-family-name">Last / Family Name</label>
|
||||
<input id="cc-family-name" name="cc-family-name" type="text" autocorrect="off" autocomplete="cc-family-name" placeholder="Berners-Lee" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="cc-number">Credit Card Number</label>
|
||||
<input id="cc-number" name="cc-number" type="text" pattern="\d*" novalidate="novaidate" autocorrect="off" autocomplete="cc-number" placeholder="4111111111111111" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="cc-csc">Credit Card Security Code</label>
|
||||
<input id="cc-csc" name="cc-csc" type="text" pattern="\d*" novalidate="novalidate" autocorrect="off" autocomplete="cc-csc" placeholder="419" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>Combined Month Expiration</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="cc-exp">Credit Card Expiration Month</label>
|
||||
<input id="cc-exp" name="cc-exp" type="month" autocorrect="off" autocomplete="cc-exp" placeholder="2014-12" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Separate Month / Year Expiration</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="cc-exp-month">Expiration Month</label>
|
||||
<input id="cc-exp-month" name="cc-exp-month" type="number" autocorrect="off" min="1" max="12" step="1" autocomplete="cc-exp-month" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="cc-exp-year">Expiration Year</label>
|
||||
<input id="cc-exp-year" name="cc-exp-year" type="number" autocorrect="off" min="2000" step="1" autocomplete="cc-exp-year" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<hr />
|
||||
<div id="money">
|
||||
<h3>Money / Currency</h3>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="currency">Currency Code</label>
|
||||
<input id="currency" name="currency" type="text" autocorrect="off" autocomplete="transaction-currency" placeholder="GBP" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="price">Price / Bid</label>
|
||||
<input id="price" name="price" type="number" min="0.00" step="0.01" autocorrect="off" autocomplete="transaction-amount" placeholder="401.00" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div id="date-and-time">
|
||||
<h3>Date / Time</h3>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="date">Date</label>
|
||||
<input id="date" name="date" type="date" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="form-field">
|
||||
<div class="example">
|
||||
|
||||
</div>
|
||||
</div> -->
|
||||
</div>
|
||||
<hr />
|
||||
<div id="buttons">
|
||||
<h3>Buttons</h3>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="input-submit">Input Type Submit</label>
|
||||
<input id="input-submit" name="input-submit" type="submit" value="Push me to send form" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="button-submit">Button Type Submit</label>
|
||||
<button id="button-submit" name="button-submit" type="submit">Push me to send form</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div id="other-elements">
|
||||
<h3>Other Form Elements</h3>
|
||||
|
||||
<fieldset>
|
||||
<legend>Input with Datalist</legend>
|
||||
|
||||
<p>Note: set <code>display:none</code> on <code>datalist</code> element to hide options from browsers that don't understand the <code>datalist</code> element.</p>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="favorite-browser">What's your favorite web browser?</label>
|
||||
<input id="favorite-browser" name="favorite-browser" type="text" list="browser-list" />
|
||||
<datalist id="browser-list">
|
||||
<option value="Avant Browser"></option>
|
||||
<option value="Brave"></option>
|
||||
<option value="Google Chrome">Chrome</option>
|
||||
<option value="Google Chromium">Chromium</option>
|
||||
<option value="Citrio"></option>
|
||||
<option value="Cốc Cốc">Coc Coc</option>
|
||||
<option value="Dillo"></option>
|
||||
<option value="Dooble"></option>
|
||||
<option value="Microsoft Edge">Edge</option>
|
||||
<option value="Epic"></option>
|
||||
<option value="Mozilla Firefox">Firefox</option>
|
||||
<option value="Gnuzilla"></option>
|
||||
<option value="iCab"></option>
|
||||
<option value="Gnu IceCat">IceCat</option>
|
||||
<option value="Internet Explorer"></option>
|
||||
<option value="Konqueror"></option>
|
||||
<option value="K-Meleon"></option>
|
||||
<option value="Links"></option>
|
||||
<option value="Lunascape"></option>
|
||||
<option value="Lynx"></option>
|
||||
<option value="Maxthon"></option>
|
||||
<option value="Midori"></option>
|
||||
<option value="NetSurf"></option>
|
||||
<option value="OmniWeb"></option>
|
||||
<option value="Opera"></option>
|
||||
<option value="Otter Browser"></option>
|
||||
<option value="Pale Moon"></option>
|
||||
<option value="QupZilla"></option>
|
||||
<option value="Roccat Browser"></option>
|
||||
<option value="Rekonq"></option>
|
||||
<option value="Safari"></option>
|
||||
<option value="Seamonkey"></option>
|
||||
<option value="Servo"></option>
|
||||
<option value="Sleipnir"></option>
|
||||
<option value="surf"></option>
|
||||
<option value="Torch"></option>
|
||||
<option value="Uzbl"></option>
|
||||
<option value="Vivaldi"></option>
|
||||
<option value="w3m"></option>
|
||||
<option value="WebPositive"></option>
|
||||
<option value="xombrero"></option>
|
||||
<option value="Yandex.Browser"></option>
|
||||
</datalist>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Multiselect without Option Groups</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="select-no-optgroup-multi">Favorite Web Browsers</label>
|
||||
<select id="select-no-optgroup-multi" name="select-no-optgroup-multi" multiple="multiple" size="15">
|
||||
<option value="http://www.avantbrowser.com/">Avant Browser</option>
|
||||
<option value="https://brave.com/" selected="selected">Brave</option>
|
||||
<option value="https://www.google.com/chrome/">Chrome</option>
|
||||
<option value="http://citrio.com/">Citrio</option>
|
||||
<option value="https://coccoc.com/">Cốc Cốc</option>
|
||||
<option value="http://www.dillo.org/">Dillo</option>
|
||||
<option value="http://dooble.sourceforge.net/">Dooble</option>
|
||||
<option value="https://www.microsoft.com/en-us/windows/microsoft-edge">Edge</option>
|
||||
<option value="https://www.epicbrowser.com/">Epic</option>
|
||||
<option value="https://www.mozilla.org/en-US/firefox/products/" selected="selected">Firefox</option>
|
||||
<option value="http://www.icab.de/">iCab</option>
|
||||
<option value="https://www.gnu.org/software/gnuzilla/">IceCat</option>
|
||||
<option value="https://www.microsoft.com/en-us/download/internet-explorer.aspx">Internet Explorer</option>
|
||||
<option value="https://konqueror.org/" selected="selected">Konqueror</option>
|
||||
<option value="http://kmeleonbrowser.org/">K-Meleon</option>
|
||||
<option value="http://links.twibright.com/">Links</option>
|
||||
<option value="http://www.lunascape.tv/">Lunascape</option>
|
||||
<option value="http://lynx.browser.org/">Lynx</option>
|
||||
<option value="http://www.maxthon.com/">Maxthon</option>
|
||||
<option value="http://midori-browser.org/">Midori</option>
|
||||
<option value="http://www.netsurf-browser.org/">NetSurf</option>
|
||||
<option value="https://www.omnigroup.com/more">OmniWeb</option>
|
||||
<option value="http://www.opera.com/">Opera</option>
|
||||
<option value="https://otter-browser.org/">Otter Browser</option>
|
||||
<option value="https://www.palemoon.org/">Pale Moon</option>
|
||||
<option value="http://www.qupzilla.com/">QupZilla</option>
|
||||
<option value="http://runecats.com/roccat.html">Roccat Browser</option>
|
||||
<option value="https://rekonq.kde.org/">Rekonq</option>
|
||||
<option value="http://www.apple.com/safari/">Safari</option>
|
||||
<option value="http://www.seamonkey-project.org/">Seamonkey</option>
|
||||
<option value="https://servo.org/">Servo</option>
|
||||
<option value="http://www.fenrir-inc.com/jp/sleipnir/">Sleipnir</option>
|
||||
<option value="http://surf.suckless.org/">surf</option>
|
||||
<option value="http://torchbrowser.com/">Torch</option>
|
||||
<option value="https://www.uzbl.org/">Uzbl</option>
|
||||
<option value="https://vivaldi.com/" selected="selected">Vivaldi</option>
|
||||
<option value="http://w3m.sourceforge.net/">w3m</option>
|
||||
<option value="https://www.haiku-os.org/docs/userguide/en/applications/webpositive.html">WebPositive</option>
|
||||
<option value="https://github.com/conformal/xombrero/wiki">xombrero</option>
|
||||
<option value="https://browser.yandex.com/desktop/">Yandex.Browser</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Select w/ Optgroups</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="movie-language">Favorite Movie Language</label>
|
||||
<select id="movie-language">
|
||||
<optgroup label="Western Languages">
|
||||
<option value="en">English</option>
|
||||
<option value="fr">French</option>
|
||||
<option value="es">Spanish</option>
|
||||
</optgroup>
|
||||
<optgroup label="Eastern Languages">
|
||||
<option value="cn">Chinese</option>
|
||||
<option value="jp">Japanese</option>
|
||||
<option value="kr">Korean</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
|
||||
|
||||
<fieldset>
|
||||
<legend>Checkboxes</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<h4>Select your favorite fruit(s)</h4>
|
||||
<label>Apple <input id="cb-1" name="fruit[]" type="checkbox" value="apple" /></label>
|
||||
<label>Orange <input id="cb-2" name="fruit[]" type="checkbox" value="orange" /></label>
|
||||
<label>Watermelon <input id="cb-3" name="fruit[]" type="checkbox" value="watermelon" /></label>
|
||||
<label>Something else <input id="cb-4" name="fruit[]" type="checkbox" value="other" /></label>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Output/Display Elements</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="progress">Progress Bar</label>
|
||||
<progress id="progress" value="70" max="100" title="70%">70 %</progress>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="meter">Meter Element</label>
|
||||
<meter id="meter" name="meter" min="-50" low="-20" high="130" max="170" optimum="70" value="65">65 Degrees</meter>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<fieldset>
|
||||
<legend>The Output Element</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<p>See <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/output" title="MDN article on the 'Output' element">the MDN article</a>.</p>
|
||||
<div class="example">
|
||||
<label for="result">Output Element</label>
|
||||
<input id="output1" name="output1" type="number" min="0" max="100" size="3" value="8" /> *
|
||||
<input id="output2" name="output2" type="number" min="0" max="100" size="3" value="4"/> =
|
||||
<output id="result" for="output1 output2">32</output>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
</fieldset>
|
||||
</div>
|
||||
<hr />
|
||||
<div id="antipatterns" class="antipattern">
|
||||
<h3>Anti-Patterns</h3>
|
||||
<fieldset>
|
||||
<legend>Deprecated Elements</legend>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="keygen">Keygen</label>
|
||||
<keygen id="keygen" name="keygen" keytype="rsa" />
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset>
|
||||
<legend>Multiple Select with Optgroups</legend>
|
||||
|
||||
<p>Note: Browser support varies. Recommend against for maximum compatibility.</p>
|
||||
|
||||
<div class="form-field">
|
||||
<div class="example">
|
||||
<label for="movie-favorite">Favorite Way(s) to watch a movie</label>
|
||||
<select id="movie-favorite" multiple="multiple" size="10">
|
||||
<optgroup label="Language">
|
||||
<option value="sub">Subtitled</option>
|
||||
<option value="orig-dub">Original Language - No subtitles</option>
|
||||
<option value="dub">Dubbed in your Language</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="Screen Shape">
|
||||
<option value="fullscreen">Fullscreen</option>
|
||||
<option value="widescreen">Widescreen</option>
|
||||
</optgroup>
|
||||
|
||||
<optgroup label="Location">
|
||||
<option value="theatre">Theatre</option>
|
||||
<option value="home">At Home</option>
|
||||
</optgroup>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
|
||||
<!-- Do the JavaScript magic -->
|
||||
<script src="js/load-scripts.js"></script>
|
||||
</body>
|
||||
</html>
|
2
js/index.min.js
vendored
Normal file
2
js/index.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
js/index.min.js.map
Normal file
1
js/index.min.js.map
Normal file
File diff suppressed because one or more lines are too long
3
js/load-scripts.js
Normal file
3
js/load-scripts.js
Normal file
@ -0,0 +1,3 @@
|
||||
(function(){function c(b){var a=document.createElement("script");a.src=b;a.async=!1;document.body.appendChild(a)}for(var a=[[!document.body.outerHTML,"js/polyfills/Dom/Element.outerHTML.min.js"],[!Array.from,"js/polyfills/EcmaScript/Array.from.js"],[!Array.isArray,"js/polyfills/EcmaScript/Array.isArray.js"],[!Array.from,"js/polyfills/EcmaScript/Array.from.js"],[!Array.prototype.filter,"js/polyfills/EcmaScript/Array.prototype.filter.js"],[!Array.prototype.forEach,"js/polyfills/EcmaScript/Array.prototype.forEach.js"],
|
||||
[!Array.prototype.includes,"js/polyfills/EcmaScript/Array.prototype.includes.js"],[!Array.prototype.reduce,"js/polyfills/EcmaScript/Array.prototype.reduce.js"],[!String.prototype.repeat,"js/polyfills/EcmaScript/String.prototype.repeat.js"],[!String.prototype.trim,"js/polyfills/EcmaScript/String.prototype.trim.js"]],d=a.length,b=0;b<d;b++)a[b][0]&&c(a[b][1]);c("js/index.min.js")})();
|
||||
//# sourceMappingURL=load-scripts.js.map
|
8
js/load-scripts.js.map
Normal file
8
js/load-scripts.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/load-scripts.js",
|
||||
"lineCount":2,
|
||||
"mappings":"AAAC,SAAS,EAAG,CAGZA,QAASA,EAAc,CAACC,CAAD,CAAM,CAC5B,IAAIC,EAAMC,QAAAC,cAAA,CAAuB,QAAvB,CACVF,EAAAD,IAAA,CAAUA,CACVC,EAAAG,MAAA,CAAY,CAAA,CACZF,SAAAG,KAAAC,YAAA,CAA0BL,CAA1B,CAJ4B,CA4B7B,IAlBA,IAAIM,EAAY,CACf,CAAC,CAACL,QAAAG,KAAAG,UAAF,CAA2B,2CAA3B,CADe,CAEf,CAAC,CAACC,KAAAC,KAAF,CAAc,uCAAd,CAFe,CAGf,CAAC,CAACD,KAAAE,QAAF,CAAiB,0CAAjB,CAHe,CAIf,CAAC,CAACF,KAAAC,KAAF,CAAc,uCAAd,CAJe,CAKf,CAAC,CAACD,KAAAG,UAAAC,OAAF,CAA0B,mDAA1B,CALe,CAMf,CAAC,CAACJ,KAAAG,UAAAE,QAAF,CAA2B,oDAA3B,CANe;AAOf,CAAC,CAACL,KAAAG,UAAAG,SAAF,CAA4B,qDAA5B,CAPe,CASf,CAAC,CAACN,KAAAG,UAAAI,OAAF,CAA0B,mDAA1B,CATe,CAUf,CAAC,CAACC,MAAAL,UAAAM,OAAF,CAA2B,oDAA3B,CAVe,CAWf,CAAC,CAACD,MAAAL,UAAAO,KAAF,CAAyB,kDAAzB,CAXe,CAAhB,CAcIC,EAAgBb,CAAAc,OAdpB,CAeIC,EAAI,CAGR,CAAOA,CAAP,CAAWF,CAAX,CAA0BE,CAAA,EAA1B,CACKf,CAAA,CAAUe,CAAV,CAAA,CAAa,CAAb,CAAJ,EACCvB,CAAA,CAAeQ,CAAA,CAAUe,CAAV,CAAA,CAAa,CAAb,CAAf,CAKFvB,EAAA,CAAe,iBAAf,CAtCY,CAAZ,CAAD;",
|
||||
"sources":["src/load-scripts.js"],
|
||||
"names":["loadBodyScript","src","tag","document","createElement","async","body","appendChild","polyfills","outerHTML","Array","from","isArray","prototype","filter","forEach","includes","reduce","String","repeat","trim","polyfillCount","length","i"]
|
||||
}
|
3
js/loadScripts.js
Normal file
3
js/loadScripts.js
Normal file
@ -0,0 +1,3 @@
|
||||
(function(){function c(b){var a=document.createElement("script");a.src=b;document.body.appendChild(a)}for(var a=[[!document.body.outerHTML,"js/polyfills/Dom/outerHTML.min.js"],[!Array.from,"js/polyfills/EcmaScript/Array.from.js"],[!Array.isArray,"js/polyfills/EcmaScript/Array.isArray.js"],[!Array.from,"js/polyfills/EcmaScript/Array.from.js"],[!Array.prototype.filter,"js/polyfills/EcmaScript/Array.prototype.filter.js"],[!Array.prototype.forEach,"js/polyfills/EcmaScript/Array.prototype.forEach.js"],
|
||||
[!Array.prototype.includes,"js/polyfills/EcmaScript/Array.prototype.includes.js"],[!Array.prototype.map,"js/polyfills/EcmaScript/Array.prototype.map.js"],[!Array.prototype.reduce,"js/polyfills/EcmaScript/Array.prototype.reduce.js"],[!String.prototype.repeat,"js/polyfills/EcmaScript/String.prototype.repeat.js"],[!String.prototype.trim,"js/polyfills/EcmaScript/String.prototype.trim.js"]],d=a.length,b=0;b<d;b++)a[b][0]&&c(a[b][1]);c("js/index.min.js")})();
|
||||
//# sourceMappingURL=loadScripts.js.map
|
8
js/loadScripts.js.map
Normal file
8
js/loadScripts.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/loadScripts.js",
|
||||
"lineCount":2,
|
||||
"mappings":"AAAC,SAAQ,EAAG,CACXA,QAASA,EAAe,CAACC,CAAD,CAAM,CAC7B,IAAIC,EAAMC,QAAAC,cAAA,CAAuB,QAAvB,CACVF,EAAAD,IAAA,CAAUA,CACVE,SAAAE,KAAAC,YAAA,CAA0BJ,CAA1B,CAH6B,CA2B9B,IAlBA,IAAIK,EAAY,CACf,CAAC,CAACJ,QAAAE,KAAAG,UAAF,CAA2B,mCAA3B,CADe,CAEf,CAAC,CAACC,KAAAC,KAAF,CAAc,uCAAd,CAFe,CAGf,CAAC,CAACD,KAAAE,QAAF,CAAiB,0CAAjB,CAHe,CAIf,CAAC,CAACF,KAAAC,KAAF,CAAc,uCAAd,CAJe,CAKf,CAAC,CAACD,KAAAG,UAAAC,OAAF,CAA0B,mDAA1B,CALe,CAMf,CAAC,CAACJ,KAAAG,UAAAE,QAAF,CAA2B,oDAA3B,CANe;AAOf,CAAC,CAACL,KAAAG,UAAAG,SAAF,CAA4B,qDAA5B,CAPe,CAQf,CAAC,CAACN,KAAAG,UAAAI,IAAF,CAAuB,gDAAvB,CARe,CASf,CAAC,CAACP,KAAAG,UAAAK,OAAF,CAA0B,mDAA1B,CATe,CAUf,CAAC,CAACC,MAAAN,UAAAO,OAAF,CAA2B,oDAA3B,CAVe,CAWf,CAAC,CAACD,MAAAN,UAAAQ,KAAF,CAAyB,kDAAzB,CAXe,CAAhB,CAcIC,EAAgBd,CAAAe,OAdpB,CAeIC,EAAI,CAGR,CAAMA,CAAN,CAAUF,CAAV,CAAyBE,CAAA,EAAzB,CACKhB,CAAA,CAAUgB,CAAV,CAAA,CAAa,CAAb,CAAJ,EACCvB,CAAA,CAAeO,CAAA,CAAUgB,CAAV,CAAA,CAAa,CAAb,CAAf,CAKFvB,EAAA,CAAe,iBAAf,CAnCW,CAAX,CAAA;",
|
||||
"sources":["src/loadScripts.js"],
|
||||
"names":["loadBodyScript","src","tag","document","createElement","body","appendChild","polyfills","outerHTML","Array","from","isArray","prototype","filter","forEach","includes","map","reduce","String","repeat","trim","polyfillCount","length","i"]
|
||||
}
|
24
js/polyfills/Dom/CSS_selector_engine.ielt8.js
Normal file
24
js/polyfills/Dom/CSS_selector_engine.ielt8.js
Normal file
@ -0,0 +1,24 @@
|
||||
/* qS[A]/matches polyfill | @version 1.0 | MIT License | github.com/termi */
|
||||
;(function(){
|
||||
var d=void 0,j=!0,s=null,u=!1,w=window;function C(){throw Error("SYNTAX_ERR");}
|
||||
function aa(a,c,e,i,g,k,t,z,f){var P=e||[],q=!!g,x=!q&&c&&"number"==typeof c.length&&c.nodeType===d,n=q&&(c={})||(!c?document:x?c[0]:c),Q,B=0,b,y,l,J=ba[(a[1]||"").replace(ca,"")]||0,W=2<J,E=a[2],R=!!E,F=a[3],L=!!F,G=a[4],M=!!G,ea="*"===E,r,X,A,v,h,m,D,fa,H,ga,p,N;if(R)if(E=ea?s:E.replace("|",":")){if(A=n)A=(A=n&&(n.ownerDocument||n).documentElement)?"HTML"!==A.nodeName:u;(m=A)||(E=E.toUpperCase())}else R=u;if(M&&(G=G.replace(da," "),!I||1!==J))fa=RegExp(G.replace(K,O));if(A=a[5]){A=ha.call(A,"][");
|
||||
for(r=-1;v=A[++r];)if((A[r]=v=v.match(ia))||C(),v[0]=v.input=v.index=s,v[2]=ja[v[2]],(p=v[3])&&" i"==p.substr(p.length-2))v[3]=p.substr(0,p.length-2),v[4]=j}if(a=a[6]){a=ha.call(a,":");for(r=-1;h=a[++r];)if((a[r]=h=h.match(ka))||C(),h[0]=h.input=h.index=s,p=h[1]=la[h[1]],2>p&&h[2])ma.test(h[2])?"even"===h[2]?h[2]=[s,2]:"odd"===h[2]?h[2]=[s,2,"%",1]:(h[2]=h[2].match(na),h[2][0]=s):h[2]=[s,0,"%",h[2]],h[3]=p?"nodeIndexLast":"nodeIndex",h[4]=p?"lastChild":"firstChild",h[5]=p?"previousSibling":"nextSibling";
|
||||
else if(17===p)f||C(),q=j,g=x?c:[c],a[r]=s;else if(12==p&&(m=h[2]))oa.test(m.charAt(0))&&oa.test(m.charAt(m.length-1))&&(h[2]=m.substr(1,m.length-2));1==a.length&&a[0]===s&&(a=s)}q&&(J=0);if(1==J)if(L){L=9===n.nodeType?n:n.ownerDocument;if(pa){g=L.getElementsByName(F);H=[];for(r=-1;b=g[++r];)b.id==F&&H.push(b)}else{H=[];for(g=[];b=L.getElementById(F);)g.push(b),m="id"in b?b.id:b.getAttribute("id"),m==F&&H.push(b),b.setAttribute("id",F+" _");for(r=-1;b=g[++r];)b.setAttribute("id",F)}g=s;L=u}else M=
|
||||
M&&!I,R=R&&I&&!!G;q=(!x||1===c.length)&&!t&&!i&&!A&&!a&&!R&&!M&&!L&&!z;do{switch(J){case 0:b=g[0];break;case 1:if(F)if(g=[],H.length)if(1<H.length)for(r=-1;b=H[++r];){if(9===n.nodeType||n.contains(b))g.push(b),H.splice(r--,1)}else g=H;else return P;else"BODY"===E&&9===n.nodeType?(g=[n.body],M=!!G,q=q&&!M):g=!G||!I?n.getElementsByTagName(E||"*"):"getElementsByClassName"in n?n.getElementsByClassName(G):I.call(n,G);b=g[0];break;case 2:g=n.children;b=g[0];break;case 3:Q=c[B+1];case 4:if(!(b=S(n)))continue}if(q)return g;
|
||||
x=0;if(b){do if((!ea||1===b.nodeType)&&!(i&&(X=b.sourceIndex)in e)){if(f=!(R&&(y=b.nodeName.toUpperCase())!==E||L&&b.id!==F||M&&(!b.className||!fa.test(b.className)))){if(A)for(r=-1;f&&(v=A[++r]);)if(m=v[2],l=qa(b,v[1]),l===s)f=8===m;else switch(v[4]&&(l=l.toUpperCase()),D=v[3],m){case 1:f=!!l||""===l;break;case 2:f=l===D;break;case 3:case 8:f=RegExp("(^| +)"+D+"($| +)").test(l);8===m&&(f=!f);break;case 4:case 5:case 6:p=l.indexOf(D);f=6===m?!!~p:5===m?p==l.length-D.length:!p;break;case 7:f=l===D||
|
||||
!!~l.indexOf(D+"-");break;case 9:f=!!~(" "+l.replace(ra," ")+" ").indexOf(" "+D+" ")}if(f&&a)for(r=-1;f&&(h=a[++r]);)switch(m=h[1],m){case 0:case 1:if(!m&&!h[3])break;D=h[3];l=h[4];ga=h[5];h=h[2];N=b[D]||0;m=h[3]?("%"===h[2]?-1:1)*h[3]:0;p=h[1];if(N)f=!p?!(N+m):!((N+m)%p);else{f=u;l=b.parentNode[l];do if(1==l.nodeType&&(l[D]=++N)&&b===l&&(!p?!(N+m):!((N+m)%p)))f=j;while(!f&&(l=l[ga]))}break;case 2:case 3:for(l=b;(l=l.previousSibling)&&1!==l.nodeType;);f=!l;if(!f||3==m){for(;(l=W?4===J?s:b===Q?s:S(b):
|
||||
g[++x])&&l.parentNode==b.parentNode;);!W&&4!==J&&--x;break}case 4:f=!S(b);break;case 5:f="HTML"==(y||b.nodeName.toUpperCase());break;case 6:f=!b.firstChild;break;case 7:f=!!b.checked;break;case 8:f=b.lang==h||b.ownerDocument.documentElement.lang==h;break;case 9:case 10:f="disabled"in b&&"form"in b&&(10==m?b.disabled===j&&"hidden"!==b.type:b.disabled===u);break;case 11:f=b.parentNode.selectedIndex&&!!b.selected;break;case 12:f=!!~(b.textContent||b.data||b.innerText||b.nodeValue||b.value||"").indexOf(h[2]);
|
||||
break;case 13:case 14:f=T.call(b,h[2]);13==m&&(f=!f);break;case 15:case 16:y||(y=b.nodeName.toUpperCase());f=("INPUT"==y||"TEXTAREA"==y||sa.call(b.__getAttribute__||b.getAttribute,b,"contenteditable")!==s)&&!b.a;16==m&&(f=!f);break;case 18:f=b==n.ownerDocument.activeElement;break;default:C()}}if(f){if(k)return[b];if(z){P[B]=b;break}else i?P[X]=b:(t&&(t[X]=j),P.push(b))}y=s}while(b=W?4===J?s:b===Q?s:S(b):g[++x])}b=s}while(n=c[++B]);return P}
|
||||
function ta(a,c,e){var i=!!e&&9===this.nodeType,g=[],k,t,z,f,e=i?e:this;if(ua)try{if(i&&va)return U(ua.call(this,a,e));z=(t="number"==typeof e.length&&e.nodeType===d)?e[0]:e;f=0;do{if(c)return[(9===z.nodeType?wa:xa).call(z,a)];k=(9===z.nodeType?ua:ya).call(z,a);k.length&&(g=t?g.concat(za.call(k)):k)}while(t&&(z=e[++f]));return U(g)}catch(P){g=[]}var a=Aa.call(a.replace(Ba,"$1")),q,x=j;z=u;var n;f=!!document.querySelector.__noorder__||!!document.querySelectorAll.__noorder__;var Q=a.replace(Ca,"@=").replace(Da,
|
||||
Ea).match(Fa),B,b,y;for(k=e;q=Q.shift();){i=Q[0];t=!i||","===i.charAt(0);if(!z)if(x&&"nodeType"in e&&9===e.nodeType&&"BODY"===q.toUpperCase())k=[e.body],t&&(g=k);else if(x&&":root"===q)k=[(9===e.nodeType?e:e.ownerDocument).documentElement],t&&(g=k);else if(k&&(!(e=k)||0===k.length))k=s,z=j;else{n=t&&(n||!!i||1<e.length);k=!f&&n;k=(q=q.match(Ga))?aa(q,e,t&&!B?g:[],k,s,c&&t&&!B,u,B,x):[];if(B){for(y=b.length;0<y--;)k[y]||(k.splice(y,1),b.splice(y,1));if(t&&b.length){if(c)return b[0];g=g.concat(b)}}if(q&&
|
||||
q[7]!==d&&k.length&&!t){B&&C();B=j;b=[];x=-1;for(y=k.length;++x<y;)b.push(k[x])}(","===a||!q)&&C()}if(c&&t&&k.length)return k[0];if(x=t)!g.length&&k&&(n=u,g=U(k)),k=s,e=this,z=u,B&&(b=B=d);if(!i||","===i)break}return n?U(g):g}w.Element||((w.Element=ActiveXObject).prototype.ie=j);w.HTMLElement||(w.HTMLElement=w.Element);w.Node||(w.Node=w.Element);
|
||||
var V=w.Element.prototype,K=/\s*(\S+)\s*/g,O="(?=(^|.*\\s)$1(\\s|$))",Ha=/^([\w\-\|]+)?((?:\.(?:[\w-]+))+)?$|^#([\w-]+$)/,Ba=/\s*([,>+~\s])\s*/g,Ca=/~=/g,Fa=/(^|,|>|\+|~|\s).*?(?=[,>+~\s]|$)/g,da=/\./g,ra=/\s/g,Ga=/^([,>+~\s])?([\w\-\|\*]*)#?([\w-]*)((?:\.?[\w-])*)(\[.+\])?(?::([^!]+))?(!)?$/,ia=/^\[?['"]?(.*?)['"]?(?:([\*~&\^\$@!]?=)['"]?(.*?)['"]?)?\]?$/,ka=/^([^(]+)(?:\((.+)\))?$/,Da=/\-child\((\dn)\+(\d)\)/g,Ea="-child\\($1%$2\\)",na=/(?:([-]?\d*)n)?(?:(%|-)(\d*))?/,Ia=/([,>+~\s])/,Ja=/^\s+/,
|
||||
ca=/\s/,ma=/\D/,oa=/['"]/,ba={"":1,",":1,">":2,"~":3,"+":4},ja={"":1,"=":2,"&=":3,"^=":4,"$=":5,"*=":6,"|=":7,"!=":8,"@=":9},la={"nth-child":0,"nth-last-child":1,"only-child":2,"first-child":3,"last-child":4,root:5,empty:6,checked:7,lang:8,enabled:9,disabled:10,selected:11,contains:12,not:13,matches:14,"read-only":15,"read-write":16,scope:17,focus:18,"nth-match":19,column:20,"nth-column":21},Ka={checked:s,disabled:s,ismap:s,multiple:s,readonly:s,selected:s},La={value:"defaultValue",checked:"defaultChecked",
|
||||
selected:"defaultSelected"},Ma={action:s,cite:s,codebase:s,data:s,href:s,longdesc:s,lowsrc:s,src:s,usemap:s},Y=document.documentElement;function U(a){for(var c=a.length>>>0,e=new Z,i=0;i<c;++i)i in a&&e.push(a[i]);return e}
|
||||
var pa=j,S="nextElementSibling"in Y?function(a){return a.nextElementSibling}:function(a){for(;(a=a.nextSibling)&&1!=a.nodeType;);return a},Aa=String.prototype.trim||function(){for(var a=this.replace(Ja,""),c=a.length;ca.test(a.charAt(--c)););return a.slice(0,c+1)},ha=String.prototype.split,za=Array.prototype.slice,Na,$,I=s,Z,T,qa,sa=Function.prototype.call,xa=Y.querySelector,ya=Y.querySelectorAll,wa=document.querySelector,ua=document.querySelectorAll,va=u,Oa,Pa=document.createElement("input");
|
||||
Pa.setAttribute("value",5);Oa=5!=Pa.defaultValue;Z=function(){};Z.prototype=[];$=new Z;$.push(1);!$.length&&!("NodeList"in w)&&($=document.createElement("iframe"),$.style.display="none",document.body.appendChild($),$.contentWindow.document.write("<script>parent.NodeList=Array;<\/script>"),Z=w.NodeList);I||(Na=function(a){var c=[],e=this.all,i,g=-1;if(e.length)for(a=RegExp((a+"").replace(K,O));i=e[++g];)i.className&&a.test(i.className)&&c.push(i);return c});
|
||||
qa=Oa?function(a,c){c=c.toLowerCase();return La[c]!==d?a[La[c]]||"":Ma[c]!==d?a.getAttribute(c,2)||"":Ka[c]!==d?a.getAttribute(c)?c:"":(a=a.getAttributeNode(c))&&a.value||""}:function(a,c){return a.getAttribute(c)};
|
||||
T=Y.matches||Y.webkitMatchesSelector||Y.mozMatchesSelector||Y.msMatchesSelector||Y.oMatchesSelector?function(a){if(!a)return u;if("*"===a||":root"===a&&this===Y||"body"===a&&this===document.body)return j;var c,e,i=u;if(!Ia.test(a)&&(c=this.parentNode)&&"querySelector"in c)i=c.querySelector(a),i!==s&&(i=i===this);if(!i&&i!==s&&(c=this.ownerDocument))for(e in a=c.querySelectorAll(a),a)if(Object.prototype.hasOwnProperty.call(a,e)&&(i=a[e]===this))return j;return!!i}:function(a){if(!a)return u;if("*"===
|
||||
a||this===Y&&":root"===a||this===document.body&&"BODY"===a.toUpperCase())return j;var c,e,i=u,g,a=Aa.call(a);if(c=a.match(Ha))switch(a.charAt(0)){case "#":return this.id===a.slice(1);default:return i=!(e=c[2])||this.className&&RegExp(e.replace(da," ").replace(K,O)).test(this.className),!!(i&&!(e=c[1])||this.tagName&&this.tagName.toUpperCase()===e.toUpperCase())}else{if(Ia.test(a)){e=ta.call(this.ownerDocument,a);for(g in e)if(Object.prototype.hasOwnProperty.call(e,g)&&(i=e[g]===this))return j;return u}e=
|
||||
aa(a.match(Ga),s,s,u,this,j);return e[0]===this}};$="matchesSelector";Y[$]||(V.matches=Y.matches=V[$]=Y[$]=T);$="matches";$ in V||(V[$]=document.documentElement[$]=V.matchesSelector);$="querySelectorAll";V[$]=Y[$]=document[$]=function(a,c){return ta.call(this,a,u,c)};$="querySelector";V[$]=Y[$]=document[$]=function(a,c){return ta.call(this,a,j,c)||s};$="getElementsByClassName";document[$]||(V[$]=Y[$]=document[$]=Na);V=$=s;
|
||||
})();
|
75
js/polyfills/Dom/Element.outerHTML.js
Normal file
75
js/polyfills/Dom/Element.outerHTML.js
Normal file
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* outerHTML.js
|
||||
* Cross-browser full HTMLElement.outerHTML implementation.
|
||||
*
|
||||
* 2011-11-14
|
||||
*
|
||||
* By Eli Grey, http://eligrey.com
|
||||
* Public Domain.
|
||||
* NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
|
||||
*/
|
||||
|
||||
if (typeof document !== "undefined" && typeof document.createElementNS !== "undefined" && !("outerHTML" in document.createElementNS("http://www.w3.org/1999/xhtml", "_"))) {
|
||||
|
||||
(function(view) {
|
||||
"use strict";
|
||||
|
||||
var
|
||||
container = document.createElementNS("http://www.w3.org/1999/xhtml", "_")
|
||||
, elem_proto = (view.HTMLElement || view.Element).prototype
|
||||
, xml_serializer = new XMLSerializer
|
||||
, outerHTML_getter = function() {
|
||||
var
|
||||
node = this
|
||||
, html
|
||||
;
|
||||
if (document.xmlVersion) {
|
||||
return xml_serializer.serializeToString(node);
|
||||
} else {
|
||||
container.appendChild(node.cloneNode(false));
|
||||
html = container.innerHTML.replace("><", ">" + node.innerHTML + "<");
|
||||
container.innerHTML = "";
|
||||
return html;
|
||||
}
|
||||
}
|
||||
, outerHTML_setter = function(html) {
|
||||
var
|
||||
node = this
|
||||
, parent = node.parentNode
|
||||
, child
|
||||
;
|
||||
if (parent === null) {
|
||||
DOMException.code = DOMException.NOT_FOUND_ERR;
|
||||
throw DOMException;
|
||||
}
|
||||
container.innerHTML = html;
|
||||
while ((child = container.firstChild)) {
|
||||
parent.insertBefore(child, node);
|
||||
}
|
||||
parent.removeChild(node);
|
||||
}
|
||||
;
|
||||
|
||||
if (Object.defineProperty) {
|
||||
var outerHTML_prop_desc = {
|
||||
get: outerHTML_getter
|
||||
, set: outerHTML_setter
|
||||
, enumerable: true
|
||||
, configurable: true
|
||||
};
|
||||
try {
|
||||
Object.defineProperty(elem_proto, "outerHTML", outerHTML_prop_desc);
|
||||
} catch (ex) { // IE 8 doesn't support enumerable:true
|
||||
if (ex.number === -0x7FF5EC54) {
|
||||
outerHTML_prop_desc.enumerable = false;
|
||||
Object.defineProperty(elem_proto, "outerHTML", outerHTML_prop_desc);
|
||||
}
|
||||
}
|
||||
} else if (Object.prototype.__defineGetter__ && Object.prototype.__defineSetter__) {
|
||||
elem_proto.__defineGetter__("outerHTML", outerHTML_getter);
|
||||
elem_proto.__defineSetter__("outerHTML", outerHTML_setter);
|
||||
}
|
||||
|
||||
}(self));
|
||||
|
||||
}
|
4
js/polyfills/Dom/Element.outerHTML.min.js
vendored
Normal file
4
js/polyfills/Dom/Element.outerHTML.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
"undefined"===typeof document||"undefined"===typeof document.createElementNS||"outerHTML"in document.createElementNS("http://www.w3.org/1999/xhtml","_")||function(a){function e(b){var a=this.parentNode;if(null===a)throw DOMException.a=DOMException.NOT_FOUND_ERR,DOMException;for(c.innerHTML=b;b=c.firstChild;)a.insertBefore(b,this);a.removeChild(this)}function f(){var a;if(document.xmlVersion)return g.serializeToString(this);c.appendChild(this.cloneNode(!1));a=c.innerHTML.replace("><",">"+this.innerHTML+
|
||||
"<");c.innerHTML="";return a}var c=document.createElementNS("http://www.w3.org/1999/xhtml","_");a=(a.HTMLElement||a.Element).prototype;var g=new XMLSerializer;if(Object.defineProperty){var d={get:f,set:e,enumerable:!0,configurable:!0};try{Object.defineProperty(a,"outerHTML",d)}catch(b){-2146823252===b.b&&(d.enumerable=!1,Object.defineProperty(a,"outerHTML",d))}}else Object.prototype.__defineGetter__&&Object.prototype.__defineSetter__&&(a.__defineGetter__("outerHTML",f),a.__defineSetter__("outerHTML",
|
||||
e))}(self);
|
||||
//# sourceMappingURL=Element.outerHTML.min.js.map
|
8
js/polyfills/Dom/Element.outerHTML.min.js.map
Normal file
8
js/polyfills/Dom/Element.outerHTML.min.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/polyfills/Dom/Element.outerHTML.min.js",
|
||||
"lineCount":3,
|
||||
"mappings":"AAWwB,WAAxB,GAAI,MAAOA,SAAX,EAA2E,WAA3E,GAAuC,MAAOA,SAAAC,gBAA9C,EAA4F,WAA5F,EAA2GD,SAAAC,gBAAA,CAAyB,8BAAzB,CAAyD,GAAzD,CAA3G,EAEC,QAAQ,CAACC,CAAD,CAAO,CAqBMC,QAAA,EAAQ,CAACC,CAAD,CAAO,CAAA,IAGhCC,EADOC,IACEC,WAGZ,IAAe,IAAf,GAAIF,CAAJ,CAEC,KADAG,aAAAC,EACMD,CADcA,YAAAE,cACdF,CAAAA,YAAN,CAGD,IADAG,CAAAC,UACA,CADsBR,CACtB,CAAQS,CAAR,CAAgBF,CAAAG,WAAhB,CAAA,CACCT,CAAAU,aAAA,CAAoBF,CAApB,CAVSP,IAUT,CAEDD,EAAAW,YAAA,CAZUV,IAYV,CAdmC,CAdfW,QAAA,EAAQ,EAAG,CAC/B,IAEGb,CAEH,IAAIJ,QAAAkB,WAAJ,CACC,MAAOC,EAAAC,kBAAA,CAJEd,IAIF,CAEPK,EAAAU,YAAA,CANSf,IAMagB,UAAA,CAAe,CAAA,CAAf,CAAtB,CACAlB,EAAA,CAAOO,CAAAC,UAAAW,QAAA,CAA4B,IAA5B,CAAkC,GAAlC,CAPEjB,IAOsCM,UAAxC;AAAyD,GAAzD,CACPD,EAAAC,UAAA,CAAsB,EACtB,OAAOR,EAXuB,CAPjB,IAIbO,EAAYX,QAAAC,gBAAA,CAAyB,8BAAzB,CAAyD,GAAzD,CACZuB,EAAAA,CAAaC,CAACvB,CAAAwB,YAADD,EAAqBvB,CAAAyB,QAArBF,WALA,KAMbN,EAAiB,IAAIS,aAiCxB,IAAIC,MAAAC,eAAJ,CAA2B,CAC1B,IAAIC,EAAsB,CACvBC,IAAKf,CADkB,CAEvBgB,IAAK9B,CAFkB,CAGvB+B,WAAY,CAAA,CAHW,CAIvBC,aAAc,CAAA,CAJS,CAM1B,IAAI,CACHN,MAAAC,eAAA,CAAsBN,CAAtB,CAAkC,WAAlC,CAA+CO,CAA/C,CADG,CAEF,MAAOK,CAAP,CAAW,CACO,WAAnB,GAAIA,CAAAC,EAAJ,GACCN,CAAAG,WACA,CADiC,CAAA,CACjC,CAAAL,MAAAC,eAAA,CAAsBN,CAAtB,CAAkC,WAAlC,CAA+CO,CAA/C,CAFD,CADY,CATa,CAA3B,IAeWF,OAAAJ,UAAAa,iBAAJ,EAAyCT,MAAAJ,UAAAc,iBAAzC,GACNf,CAAAc,iBAAA,CAA4B,WAA5B,CAAyCrB,CAAzC,CACA,CAAAO,CAAAe,iBAAA,CAA4B,WAA5B;AAAyCpC,CAAzC,CAFM,CAtDS,CAAf,CA2DCqC,IA3DD;",
|
||||
"sources":["js/polyfills/Dom/Element.outerHTML.js"],
|
||||
"names":["document","createElementNS","view","outerHTML_setter","html","parent","node","parentNode","DOMException","code","NOT_FOUND_ERR","container","innerHTML","child","firstChild","insertBefore","removeChild","outerHTML_getter","xmlVersion","xml_serializer","serializeToString","appendChild","cloneNode","replace","elem_proto","prototype","HTMLElement","Element","XMLSerializer","Object","defineProperty","outerHTML_prop_desc","get","set","enumerable","configurable","ex","number","__defineGetter__","__defineSetter__","self"]
|
||||
}
|
1
js/polyfills/Dom/outerHTML.min.js
vendored
Normal file
1
js/polyfills/Dom/outerHTML.min.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
//# sourceMappingURL=outerHTML.min.js.map
|
3
js/polyfills/EcmaScript/Array.from.js
Normal file
3
js/polyfills/EcmaScript/Array.from.js
Normal file
@ -0,0 +1,3 @@
|
||||
Array.from=function(){function h(c){return"function"===typeof c||"[object Function]"===l.call(c)}var l=Object.prototype.toString,m=Math.pow(2,53)-1;return function(c){var k=Object(c);if(null==c)throw new TypeError("Array.from requires an array-like object - not null or undefined");var d=1<arguments.length?arguments[1]:void 0,f;if("undefined"!==typeof d){if(!h(d))throw new TypeError("Array.from: when provided, the second argument must be a function");2<arguments.length&&(f=arguments[2])}for(var a=
|
||||
Number(k.length),a=Math.min(Math.max(isNaN(a)?0:a&&isFinite(a)?(0<a?1:-1)*Math.floor(Math.abs(a)):a,0),m),g=h(this)?Object(new this(a)):Array(a),b=0,e;b<a;)e=k[b],g[b]=d?"undefined"===typeof f?d(e,b):d.call(f,e,b):e,b+=1;g.length=a;return g}}();
|
||||
//# sourceMappingURL=Array.from.js.map
|
8
js/polyfills/EcmaScript/Array.from.js.map
Normal file
8
js/polyfills/EcmaScript/Array.from.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/polyfills/EcmaScript/Array.from.js",
|
||||
"lineCount":2,
|
||||
"mappings":"AAEAA,KAAAC,KAAA,CAAc,QAAS,EAAG,CAEPC,QAAA,EAAS,CAACC,CAAD,CAAK,CAChC,MAAqB,UAArB,GAAO,MAAOA,EAAd,EAAsD,mBAAtD,GAAmCC,CAAAC,KAAA,CAAWF,CAAX,CADH,CAD/B,IAAIC,EAAQE,MAAAC,UAAAC,SAAZ,CAUIC,EAAiBC,IAAAC,IAAA,CAAS,CAAT,CAAY,EAAZ,CAAjBF,CAAmC,CAOvC,OAAOR,SAAa,CAACW,CAAD,CAAiC,CAKtD,IAAIC,EAAQP,MAAA,CAAOM,CAAP,CAGZ,IAAiB,IAAjB,EAAIA,CAAJ,CACE,KAAM,KAAIE,SAAJ,CAAc,kEAAd,CAAN,CAIF,IAAIC,EAA2B,CAAnB,CAAAC,SAAAC,OAAA,CAAuBD,SAAA,CAAU,CAAV,CAAvB,CAAsC,IAAKE,EAAvD,CACIC,CACJ,IAAqB,WAArB,GAAI,MAAOJ,EAAX,CAAkC,CAGhC,GAAK,CAAAb,CAAA,CAAWa,CAAX,CAAL,CACD,KAAM,KAAID,SAAJ,CAAc,mEAAd,CAAN,CAIwB,CAAvB,CAAIE,SAAAC,OAAJ,GACDE,CADC,CACGH,SAAA,CAAU,CAAV,CADH,CARgC,CA0BlC,IArDA,IAAII;AAASC,MAAA,CA0CMR,CAAAI,OA1CN,CAAb,CA0CIK,EAlCGZ,IAAAa,IAAA,CAASb,IAAAc,IAAA,CAPZC,KAAA,CAAML,CAAN,CAAJE,CAA4B,CAA5BA,CACIF,CAAJ,EAAqBM,QAAA,CAASN,CAAT,CAArB,EACiB,CAAT,CAAAA,CAAA,CAAa,CAAb,CAAkB,EAD1B,EAC+BV,IAAAiB,MAAA,CAAWjB,IAAAkB,IAAA,CAASR,CAAT,CAAX,CAD/B,CAAgDA,CAMhC,CAAc,CAAd,CAAT,CAA2BX,CAA3B,CARP,CA+CIoB,EAAI3B,CAAA,CAjCA4B,IAiCA,CAAA,CAAgBxB,MAAA,CAAO,IAjCvBwB,IAiCuB,CAAMR,CAAN,CAAP,CAAhB,CAAyCtB,KAAJ,CAAUsB,CAAV,CA/C7C,CAkDIS,EAAI,CAlDR,CAoDIC,CACJ,CAAOD,CAAP,CAAWT,CAAX,CAAA,CACEU,CAMA,CANSnB,CAAA,CAAMkB,CAAN,CAMT,CAJDF,CAAA,CAAEE,CAAF,CAIC,CALIhB,CAAJ,CACmB,WAAb,GAAA,MAAOI,EAAP,CAA2BJ,CAAA,CAAMiB,CAAN,CAAcD,CAAd,CAA3B,CAA8ChB,CAAAV,KAAA,CAAWc,CAAX,CAAca,CAAd,CAAsBD,CAAtB,CADpD,CAGMC,CAEN,CAAAD,CAAA,EAAK,CAGPF,EAAAZ,OAAA,CAAWK,CAEX,OAAOO,EArD+C,CAlB7B,CAAZ;",
|
||||
"sources":["src/polyfills/Array.from.js"],
|
||||
"names":["Array","from","isCallable","fn","toStr","call","Object","prototype","toString","maxSafeInteger","Math","pow","arrayLike","items","TypeError","mapFn","arguments","length","undefined","T","number","Number","len","min","max","isNaN","isFinite","floor","abs","A","C","k","kValue"]
|
||||
}
|
2
js/polyfills/EcmaScript/Array.isArray.js
Normal file
2
js/polyfills/EcmaScript/Array.isArray.js
Normal file
@ -0,0 +1,2 @@
|
||||
Array.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)};
|
||||
//# sourceMappingURL=Array.isArray.js.map
|
8
js/polyfills/EcmaScript/Array.isArray.js.map
Normal file
8
js/polyfills/EcmaScript/Array.isArray.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/polyfills/EcmaScript/Array.isArray.js",
|
||||
"lineCount":1,
|
||||
"mappings":"AAAAA,KAAAC,QAAA,CAAgBC,QAAQ,CAACC,CAAD,CAAM,CAC7B,MAA+C,gBAA/C,GAAOC,MAAAC,UAAAC,SAAAC,KAAA,CAA+BJ,CAA/B,CADsB;",
|
||||
"sources":["src/polyfills/Array.isArray.js"],
|
||||
"names":["Array","isArray","Array.isArray","arg","Object","prototype","toString","call"]
|
||||
}
|
3
js/polyfills/EcmaScript/Array.of.js
Normal file
3
js/polyfills/EcmaScript/Array.of.js
Normal file
@ -0,0 +1,3 @@
|
||||
Array.of = function() {
|
||||
return Array.prototype.slice.call(arguments);
|
||||
};
|
2
js/polyfills/EcmaScript/Array.prototype.every.js
Normal file
2
js/polyfills/EcmaScript/Array.prototype.every.js
Normal file
@ -0,0 +1,2 @@
|
||||
Array.prototype.every=function(c,f){var d,a;if(!this)throw new TypeError("this is null or not defined");var b=Object(this),g=b.length>>>0;if("function"!==typeof c)throw new TypeError;1<arguments.length&&(d=f);for(a=0;a<g;){var e;if(a in b&&(e=b[a],!c.call(d,e,a,b)))return!1;a++}return!0};
|
||||
//# sourceMappingURL=Array.prototype.every.js.map
|
8
js/polyfills/EcmaScript/Array.prototype.every.js.map
Normal file
8
js/polyfills/EcmaScript/Array.prototype.every.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/polyfills/EcmaScript/Array.prototype.every.js",
|
||||
"lineCount":1,
|
||||
"mappings":"AAAAA,KAAAC,UAAAC,MAAA,CAAwBC,QAAQ,CAACC,CAAD,CAAaC,CAAb,CAAsB,CAAA,IAE9CC,CAF8C,CAE3CC,CAEP,IAAI,CAAA,IAAJ,CACE,KAAM,KAAIC,SAAJ,CAAc,6BAAd,CAAN,CAKF,IAAIC,EAAIC,MAAA,CAAO,IAAP,CAAR,CAKIC,EAAMF,CAAAG,OAAND,GAAmB,CAGvB,IAA0B,UAA1B,GAAI,MAAOP,EAAX,CACE,KAAM,KAAII,SAAV,CAIqB,CAAvB,CAAIK,SAAAD,OAAJ,GACEN,CADF,CACMD,CADN,CAQA,KAHAE,CAGA,CAHI,CAGJ,CAAOA,CAAP,CAAWI,CAAX,CAAA,CAAgB,CAEd,IAAIG,CAQJ,IAAIP,CAAJ,GAASE,EAAT,GAIEK,CAKiBC,CALRN,CAAA,CAAEF,CAAF,CAKQQ,CAAAA,CAAAX,CAAAY,KAAAD,CAAgBT,CAAhBS,CAAmBD,CAAnBC,CAA2BR,CAA3BQ,CAA8BN,CAA9BM,CATnB,EAaI,MAAO,CAAA,CAGXR,EAAA,EA1Bc,CA4BhB,MAAO,CAAA,CA3D2C;",
|
||||
"sources":["src/polyfills/Array.prototype.every.js"],
|
||||
"names":["Array","prototype","every","Array.prototype.every","callbackfn","thisArg","T","k","TypeError","O","Object","len","length","arguments","kValue","testResult","call"]
|
||||
}
|
2
js/polyfills/EcmaScript/Array.prototype.filter.js
Normal file
2
js/polyfills/EcmaScript/Array.prototype.filter.js
Normal file
@ -0,0 +1,2 @@
|
||||
Array.prototype.filter=function(c){if(!this||!this)throw new TypeError;var b=Object(this),f=b.length>>>0;if("function"!==typeof c)throw new TypeError;for(var d=[],g=2<=arguments.length?arguments[1]:void 0,a=0;a<f;a++)if(a in b){var e=b[a];c.call(g,e,a,b)&&d.push(e)}return d};
|
||||
//# sourceMappingURL=Array.prototype.filter.js.map
|
8
js/polyfills/EcmaScript/Array.prototype.filter.js.map
Normal file
8
js/polyfills/EcmaScript/Array.prototype.filter.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/polyfills/EcmaScript/Array.prototype.filter.js",
|
||||
"lineCount":1,
|
||||
"mappings":"AAAAA,KAAAC,UAAAC,OAAA,CAAyBC,QAAQ,CAACC,CAAD,CAAmB,CAGnD,GAAI,CAAA,IAAJ,EAAuB,CAAA,IAAvB,CACC,KAAM,KAAIC,SAAV,CAGD,IAAIC,EAAIC,MAAA,CAAO,IAAP,CAAR,CACIC,EAAMF,CAAAG,OAAND,GAAmB,CACvB,IAAmB,UAAnB,GAAI,MAAOJ,EAAX,CACC,KAAM,KAAIC,SAAV,CAKD,IAFA,IAAIK,EAAM,EAAV,CACIC,EAA8B,CAApB,EAAAC,SAAAH,OAAA,CAAwBG,SAAA,CAAU,CAAV,CAAxB,CAAuC,IAAK,EAD1D,CAESC,EAAI,CAAb,CAAgBA,CAAhB,CAAoBL,CAApB,CAAyBK,CAAA,EAAzB,CACC,GAAIA,CAAJ,GAASP,EAAT,CAAY,CACX,IAAIQ,EAAMR,CAAA,CAAEO,CAAF,CAONT,EAAAW,KAAA,CAASJ,CAAT,CAAkBG,CAAlB,CAAuBD,CAAvB,CAA0BP,CAA1B,CAAJ,EACCI,CAAAM,KAAA,CAASF,CAAT,CATU,CAcb,MAAOJ,EA9B4C;",
|
||||
"sources":["src/polyfills/Array.prototype.filter.js"],
|
||||
"names":["Array","prototype","filter","Array.prototype.filter","fun","TypeError","t","Object","len","length","res","thisArg","arguments","i","val","call","push"]
|
||||
}
|
2
js/polyfills/EcmaScript/Array.prototype.forEach.js
Normal file
2
js/polyfills/EcmaScript/Array.prototype.forEach.js
Normal file
@ -0,0 +1,2 @@
|
||||
Array.prototype.forEach=function(c,f){var d,a;if(!this)throw new TypeError(" this is null or not defined");var b=Object(this),g=b.length>>>0;if("function"!==typeof c)throw new TypeError(c+" is not a function");1<arguments.length&&(d=f);for(a=0;a<g;){var e;a in b&&(e=b[a],c.call(d,e,a,b));a++}};
|
||||
//# sourceMappingURL=Array.prototype.forEach.js.map
|
8
js/polyfills/EcmaScript/Array.prototype.forEach.js.map
Normal file
8
js/polyfills/EcmaScript/Array.prototype.forEach.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/polyfills/EcmaScript/Array.prototype.forEach.js",
|
||||
"lineCount":1,
|
||||
"mappings":"AAAAA,KAAAC,UAAAC,QAAA,CAA0BC,QAAQ,CAACC,CAAD,CAAWC,CAAX,CAAoB,CAAA,IAEjDC,CAFiD,CAE9CC,CAEP,IAAI,CAAA,IAAJ,CACC,KAAM,KAAIC,SAAJ,CAAc,8BAAd,CAAN,CAKD,IAAIC,EAAIC,MAAA,CAAO,IAAP,CAAR,CAKIC,EAAMF,CAAAG,OAAND,GAAmB,CAIvB,IAAwB,UAAxB,GAAI,MAAOP,EAAX,CACC,KAAM,KAAII,SAAJ,CAAcJ,CAAd,CAAyB,oBAAzB,CAAN,CAKsB,CAAvB,CAAIS,SAAAD,OAAJ,GACCN,CADD,CACKD,CADL,CAQA,KAHAE,CAGA,CAHI,CAGJ,CAAOA,CAAP,CAAWI,CAAX,CAAA,CAAgB,CAEf,IAAIG,CAQAP,EAAJ,GAASE,EAAT,GAICK,CAIA,CAJSL,CAAA,CAAEF,CAAF,CAIT,CAAAH,CAAAW,KAAA,CAAcT,CAAd,CAAiBQ,CAAjB,CAAyBP,CAAzB,CAA4BE,CAA5B,CARD,CAWAF,EAAA,EArBe,CAjCqC;",
|
||||
"sources":["src/polyfills/Array.prototype.forEach.js"],
|
||||
"names":["Array","prototype","forEach","Array.prototype.forEach","callback","thisArg","T","k","TypeError","O","Object","len","length","arguments","kValue","call"]
|
||||
}
|
2
js/polyfills/EcmaScript/Array.prototype.includes.js
Normal file
2
js/polyfills/EcmaScript/Array.prototype.includes.js
Normal file
@ -0,0 +1,2 @@
|
||||
Array.prototype.includes=function(c,a){if(!this)throw new TypeError("Array.prototype.includes called on null or undefined");var e=Object(this),d=parseInt(e.length,10)||0;if(!d)return!1;a=parseInt(a,10)||0;0<=a||(a=d+a,0>a&&(a=0));for(var b;a<d;){b=e[a];if(c===b||c!==c&&b!==b)return!0;a++}return!1};
|
||||
//# sourceMappingURL=Array.prototype.includes.js.map
|
8
js/polyfills/EcmaScript/Array.prototype.includes.js.map
Normal file
8
js/polyfills/EcmaScript/Array.prototype.includes.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/polyfills/EcmaScript/Array.prototype.includes.js",
|
||||
"lineCount":1,
|
||||
"mappings":"AAAAA,KAAAC,UAAAC,SAAA,CAA2BC,QAAQ,CAACC,CAAD,CAAA,CAAA,CAAgC,CAElE,GAAI,CAAA,IAAJ,CACC,KAAM,KAAIC,SAAJ,CAAc,sDAAd,CAAN,CAGD,IAAIC,EAAIC,MAAA,CAAO,IAAP,CAAR,CACIC,EAAMC,QAAA,CAASH,CAAAI,OAAT,CAAmB,EAAnB,CAANF,EAAgC,CACpC,IAAIA,CAAAA,CAAJ,CACC,MAAO,CAAA,CAEJG,EAAAA,CAAIF,QAAA,CAAS,CAAT,CAAuB,EAAvB,CAAJE,EAAkC,CAE7B,EAAT,EAAIA,CAAJ,GAGCC,CACA,CADIJ,CACJ,CADUG,CACV,CAAQ,CAAR,CAAIC,CAAJ,GAAYA,CAAZ,CAAgB,CAAhB,CAJD,CAOA,KADA,IAAIC,CACJ,CAAOD,CAAP,CAAWJ,CAAX,CAAA,CAAgB,CACfK,CAAA,CAAiBP,CAAA,CAAEM,CAAF,CACjB,IAAIR,CAAJ,GAAsBS,CAAtB,EACET,CADF,GACoBA,CADpB,EACqCS,CADrC,GACwDA,CADxD,CAEC,MAAO,CAAA,CAERD,EAAA,EANe,CAQhB,MAAO,CAAA,CA5B2D;",
|
||||
"sources":["src/polyfills/Array.prototype.includes.js"],
|
||||
"names":["Array","prototype","includes","Array.prototype.includes","searchElement","TypeError","O","Object","len","parseInt","length","n","k","currentElement"]
|
||||
}
|
2
js/polyfills/EcmaScript/Array.prototype.map.js
Normal file
2
js/polyfills/EcmaScript/Array.prototype.map.js
Normal file
@ -0,0 +1,2 @@
|
||||
Array.prototype.map=function(d,h){var f,e,a;if(!this)throw new TypeError(" this is null or not defined");var b=Object(this),g=b.length>>>0;if("function"!==typeof d)throw new TypeError(d+" is not a function");1<arguments.length&&(f=h);e=Array(g);for(a=0;a<g;){var c;a in b&&(c=b[a],c=d.call(f,c,a,b),e[a]=c);a++}return e};
|
||||
//# sourceMappingURL=Array.prototype.map.js.map
|
8
js/polyfills/EcmaScript/Array.prototype.map.js.map
Normal file
8
js/polyfills/EcmaScript/Array.prototype.map.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/polyfills/EcmaScript/Array.prototype.map.js",
|
||||
"lineCount":1,
|
||||
"mappings":"AAAAA,KAAAC,UAAAC,IAAA,CAAsBC,QAAQ,CAACC,CAAD,CAAWC,CAAX,CAAoB,CAAA,IAE7CC,CAF6C,CAE1CC,CAF0C,CAEvCC,CAEV,IAAI,CAAA,IAAJ,CACC,KAAM,KAAIC,SAAJ,CAAc,8BAAd,CAAN,CAKD,IAAIC,EAAIC,MAAA,CAAO,IAAP,CAAR,CAKIC,EAAMF,CAAAG,OAAND,GAAmB,CAIvB,IAAwB,UAAxB,GAAI,MAAOR,EAAX,CACC,KAAM,KAAIK,SAAJ,CAAcL,CAAd,CAAyB,oBAAzB,CAAN,CAIsB,CAAvB,CAAIU,SAAAD,OAAJ,GACCP,CADD,CACKD,CADL,CAOAE,EAAA,CAAQP,KAAJ,CAAUY,CAAV,CAMJ,KAHAJ,CAGA,CAHI,CAGJ,CAAOA,CAAP,CAAWI,CAAX,CAAA,CAAgB,CAAA,IAEXG,CAQAP,EAAJ,GAASE,EAAT,GAICK,CAwBA,CAxBSL,CAAA,CAAEF,CAAF,CAwBT,CAnBAQ,CAmBA,CAnBcZ,CAAAa,KAAA,CAAcX,CAAd,CAAiBS,CAAjB,CAAyBP,CAAzB,CAA4BE,CAA5B,CAmBd,CAAAH,CAAA,CAAEC,CAAF,CAAA,CAAOQ,CA5BR,CA+BAR,EAAA,EAzCe,CA6ChB,MAAOD,EAlF0C;",
|
||||
"sources":["src/polyfills/Array.prototype.map.js"],
|
||||
"names":["Array","prototype","map","Array.prototype.map","callback","thisArg","T","A","k","TypeError","O","Object","len","length","arguments","kValue","mappedValue","call"]
|
||||
}
|
2
js/polyfills/EcmaScript/Array.prototype.reduce.js
Normal file
2
js/polyfills/EcmaScript/Array.prototype.reduce.js
Normal file
@ -0,0 +1,2 @@
|
||||
Array.prototype.reduce=function(d){if(!this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!==typeof d)throw new TypeError(d+" is not a function");var b=Object(this),e=b.length>>>0,a=0,c;if(2==arguments.length)c=arguments[1];else{for(;a<e&&!(a in b);)a++;if(a>=e)throw new TypeError("Reduce of empty array with no initial value");c=b[a++]}for(;a<e;a++)a in b&&(c=d(c,b[a],a,b));return c};
|
||||
//# sourceMappingURL=Array.prototype.reduce.js.map
|
8
js/polyfills/EcmaScript/Array.prototype.reduce.js.map
Normal file
8
js/polyfills/EcmaScript/Array.prototype.reduce.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/polyfills/EcmaScript/Array.prototype.reduce.js",
|
||||
"lineCount":1,
|
||||
"mappings":"AAAAA,KAAAC,UAAAC,OAAA,CAAyBC,QAAQ,CAACC,CAAD,CAA8B,CAE9D,GAAI,CAAA,IAAJ,CACC,KAAM,KAAIC,SAAJ,CAAc,oDAAd,CAAN,CAED,GAAwB,UAAxB,GAAI,MAAOD,EAAX,CACC,KAAM,KAAIC,SAAJ,CAAcD,CAAd,CAAyB,oBAAzB,CAAN,CAN6D,IAQ1DE,EAAIC,MAAA,CAAO,IAAP,CARsD,CAQxCC,EAAMF,CAAAG,OAAND,GAAmB,CARqB,CAQlBE,EAAI,CARc,CAQXC,CACnD,IAAwB,CAAxB,EAAIC,SAAAH,OAAJ,CACCE,CAAA,CAAQC,SAAA,CAAU,CAAV,CADT,KAEO,CACN,IAAA,CAAOF,CAAP,CAAWF,CAAX,EAAoB,EAAAE,CAAA,GAAKJ,EAAL,CAApB,CAAA,CACCI,CAAA,EAED,IAAIA,CAAJ,EAASF,CAAT,CACC,KAAM,KAAIH,SAAJ,CAAc,6CAAd,CAAN,CAEDM,CAAA,CAAQL,CAAA,CAAEI,CAAA,EAAF,CAPF,CASP,IAAA,CAAOA,CAAP,CAAWF,CAAX,CAAgBE,CAAA,EAAhB,CACKA,CAAJ,GAASJ,EAAT,GACCK,CADD,CACSP,CAAA,CAASO,CAAT,CAAgBL,CAAA,CAAEI,CAAF,CAAhB,CAAsBA,CAAtB,CAAyBJ,CAAzB,CADT,CAID,OAAOK,EAzBuD;",
|
||||
"sources":["src/polyfills/Array.prototype.reduce.js"],
|
||||
"names":["Array","prototype","reduce","Array.prototype.reduce","callback","TypeError","t","Object","len","length","k","value","arguments"]
|
||||
}
|
2
js/polyfills/EcmaScript/String.prototype.includes.js
Normal file
2
js/polyfills/EcmaScript/String.prototype.includes.js
Normal file
@ -0,0 +1,2 @@
|
||||
String.prototype.includes=function(b,a){"number"!==typeof a&&(a=0);return a+b.length>this.length?!1:-1!==this.indexOf(b,a)};
|
||||
//# sourceMappingURL=String.prototype.includes.js.map
|
8
js/polyfills/EcmaScript/String.prototype.includes.js.map
Normal file
8
js/polyfills/EcmaScript/String.prototype.includes.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/polyfills/EcmaScript/String.prototype.includes.js",
|
||||
"lineCount":1,
|
||||
"mappings":"AAAAA,MAAAC,UAAAC,SAAA,CAA4BC,QAAQ,CAACC,CAAD,CAASC,CAAT,CAAgB,CAE7B,QAArB,GAAI,MAAOA,EAAX,GACDA,CADC,CACO,CADP,CAIA,OAAIA,EAAJ,CAAYD,CAAAE,OAAZ,CAA4B,IAAAA,OAA5B,CACM,CAAA,CADN,CAGuC,EAHvC,GAGM,IAAAC,QAAA,CAAaH,CAAb,CAAqBC,CAArB,CAT4C;",
|
||||
"sources":["src/polyfills/String.prototype.includes.js"],
|
||||
"names":["String","prototype","includes","String.prototype.includes","search","start","length","indexOf"]
|
||||
}
|
2
js/polyfills/EcmaScript/String.prototype.repeat.js
Normal file
2
js/polyfills/EcmaScript/String.prototype.repeat.js
Normal file
@ -0,0 +1,2 @@
|
||||
String.prototype.repeat=function(a){if(!this)throw new TypeError("can't convert "+this+" to object");var b=""+this;a=+a;a!=a&&(a=0);if(0>a)throw new RangeError("repeat count must be non-negative");if(Infinity==a)throw new RangeError("repeat count must be less than infinity");a=Math.floor(a);if(!b.length||!a)return"";if(268435456<=b.length*a)throw new RangeError("repeat count must not overflow maximum string size");for(var c="";;){1==(a&1)&&(c+=b);a>>>=1;if(!a)break;b+=b}return c};
|
||||
//# sourceMappingURL=String.prototype.repeat.js.map
|
8
js/polyfills/EcmaScript/String.prototype.repeat.js.map
Normal file
8
js/polyfills/EcmaScript/String.prototype.repeat.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/polyfills/EcmaScript/String.prototype.repeat.js",
|
||||
"lineCount":1,
|
||||
"mappings":"AAAAA,MAAAC,UAAAC,OAAA,CAA0BC,QAAQ,CAACC,CAAD,CAAQ,CAEzC,GAAI,CAAA,IAAJ,CACC,KAAM,KAAIC,SAAJ,CAAc,gBAAd,CAAkC,IAAlC,CAAyC,YAAzC,CAAN,CAED,IAAIC,EAAM,EAANA,CAAW,IACfF,EAAA,CAAQ,CAACA,CACLA,EAAJ,EAAaA,CAAb,GACCA,CADD,CACS,CADT,CAGA,IAAY,CAAZ,CAAIA,CAAJ,CACC,KAAM,KAAIG,UAAJ,CAAe,mCAAf,CAAN,CAED,GAAaC,QAAb,EAAIJ,CAAJ,CACC,KAAM,KAAIG,UAAJ,CAAe,yCAAf,CAAN,CAEDH,CAAA,CAAQK,IAAAC,MAAA,CAAWN,CAAX,CACR,IAAIO,CAAAL,CAAAK,OAAJ,EAAuBP,CAAAA,CAAvB,CACC,MAAO,EAKR,IAA0B,SAA1B,EAAIE,CAAAK,OAAJ,CAAiBP,CAAjB,CACC,KAAM,KAAIG,UAAJ,CAAe,oDAAf,CAAN,CAGD,IADA,IAAIK,EAAM,EACV,CAAA,CAAA,CAAS,CACW,CAAnB,GAAKR,CAAL,CAAa,CAAb,IACCQ,CADD,EACQN,CADR,CAGAF,EAAA,IAAW,CACX,IAAIA,CAAAA,CAAJ,CACC,KAEDE,EAAA,EAAOA,CARC,CAYT,MAAOM,EAvCkC;",
|
||||
"sources":["src/polyfills/String.prototype.repeat.js"],
|
||||
"names":["String","prototype","repeat","String.prototype.repeat","count","TypeError","str","RangeError","Infinity","Math","floor","length","rpt"]
|
||||
}
|
2
js/polyfills/EcmaScript/String.prototype.trim.js
Normal file
2
js/polyfills/EcmaScript/String.prototype.trim.js
Normal file
@ -0,0 +1,2 @@
|
||||
String.prototype.trim=function(){return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};
|
||||
//# sourceMappingURL=String.prototype.trim.js.map
|
8
js/polyfills/EcmaScript/String.prototype.trim.js.map
Normal file
8
js/polyfills/EcmaScript/String.prototype.trim.js.map
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"version":3,
|
||||
"file":"js/polyfills/EcmaScript/String.prototype.trim.js",
|
||||
"lineCount":1,
|
||||
"mappings":"AAAAA,MAAAC,UAAAC,KAAA,CAAwBC,QAAS,EAAG,CACnC,MAAO,KAAAC,QAAA,CAAa,oCAAb,CAAmD,EAAnD,CAD4B;",
|
||||
"sources":["src/polyfills/String.prototype.trim.js"],
|
||||
"names":["String","prototype","trim","String.prototype.trim","replace"]
|
||||
}
|
4
js/polyfills/html5shiv.min.js
vendored
Normal file
4
js/polyfills/html5shiv.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
!function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x<style>"+b+"</style>",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="<xyz></xyz>",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document);
|
64
js/polyfills/ie-array-slice-shim.js
Normal file
64
js/polyfills/ie-array-slice-shim.js
Normal file
@ -0,0 +1,64 @@
|
||||
/**
|
||||
* Shim for "fixing" IE's lack of support (IE < 9) for applying slice
|
||||
* on host objects like NamedNodeMap, NodeList, and HTMLCollection
|
||||
* (technically, since host objects have been implementation-dependent,
|
||||
* at least before ES6, IE hasn't needed to work this way).
|
||||
* Also works on strings, fixes IE < 9 to allow an explicit undefined
|
||||
* for the 2nd argument (as in Firefox), and prevents errors when
|
||||
* called on other DOM objects.
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
var _slice = Array.prototype.slice;
|
||||
|
||||
try {
|
||||
// Can't be used with DOM elements in IE < 9
|
||||
_slice.call(document.documentElement);
|
||||
} catch (e) { // Fails in IE < 9
|
||||
// This will work for genuine arrays, array-like objects,
|
||||
// NamedNodeMap (attributes, entities, notations),
|
||||
// NodeList (e.g., getElementsByTagName), HTMLCollection (e.g., childNodes),
|
||||
// and will not fail on other DOM objects (as do DOM elements in IE < 9)
|
||||
Array.prototype.slice = function(begin, end) {
|
||||
// IE < 9 gets unhappy with an undefined end argument
|
||||
end = (typeof end !== 'undefined') ? end : this.length;
|
||||
|
||||
// For native Array objects, we use the native slice function
|
||||
if (Object.prototype.toString.call(this) === '[object Array]'){
|
||||
return _slice.call(this, begin, end);
|
||||
}
|
||||
|
||||
// For array like object we handle it ourselves.
|
||||
var i, cloned = [],
|
||||
size, len = this.length;
|
||||
|
||||
// Handle negative value for "begin"
|
||||
var start = begin || 0;
|
||||
start = (start >= 0) ? start : Math.max(0, len + start);
|
||||
|
||||
// Handle negative value for "end"
|
||||
var upTo = (typeof end == 'number') ? Math.min(end, len) : len;
|
||||
if (end < 0) {
|
||||
upTo = len + end;
|
||||
}
|
||||
|
||||
// Actual expected size of the slice
|
||||
size = upTo - start;
|
||||
|
||||
if (size > 0) {
|
||||
cloned = new Array(size);
|
||||
if (this.charAt) {
|
||||
for (i = 0; i < size; i++) {
|
||||
cloned[i] = this.charAt(start + i);
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < size; i++) {
|
||||
cloned[i] = this[start + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cloned;
|
||||
};
|
||||
}
|
||||
}());
|
72
package.json
Normal file
72
package.json
Normal file
@ -0,0 +1,72 @@
|
||||
{
|
||||
"name": "html5-forms-cheatsheet",
|
||||
"version": "1.0.0",
|
||||
"description": "Examples of best practices for HTML forms",
|
||||
"main": "index.html",
|
||||
"devDependencies": {
|
||||
"autoprefixer": "^6.4.1",
|
||||
"ava": "^0.16.0",
|
||||
"cssnano": "^3.7.5",
|
||||
"glob": "^7.1.0",
|
||||
"google-closure-compiler": "^20160911.0.0",
|
||||
"happiness": "^7.1.2",
|
||||
"postcss": "^5.2.2",
|
||||
"postcss-cli": "^2.6.0",
|
||||
"postcss-css-variables": "^0.6.0",
|
||||
"rollup": "^0.35.11",
|
||||
"rollup-plugin-buble": "^0.13.0",
|
||||
"rollup-plugin-cleanup": "^0.1.4",
|
||||
"rollup-plugin-commonjs": "^4.1.0",
|
||||
"rollup-plugin-filesize": "^0.5.5",
|
||||
"rollup-plugin-node-resolve": "^2.0.0",
|
||||
"rollup-plugin-sizes": "^0.2.3",
|
||||
"rollup-plugin-strip": "^1.1.1",
|
||||
"rollup-plugin-uglify": "^1.0.1",
|
||||
"rollup-watch": "^2.5.0",
|
||||
"xo": "^0.16.0"
|
||||
},
|
||||
"dependencies": {},
|
||||
"scripts": {
|
||||
"build": "NODE_ENV=production rollup -c",
|
||||
"build:css": "postcss -c postcss.json && cat css/normalize.min.css > css/bundle.min.css && cat css/dlH.min.css >> css/bundle.min.css && cat css/style.min.css >> css/bundle.min.css",
|
||||
"build:dev": "rollup -c",
|
||||
"lint": "xo src/*.js rollup.config.js",
|
||||
"min-all": "node ./tools/min-all.js",
|
||||
"test": "ava",
|
||||
"watch:js": "rollup -c --watch",
|
||||
"watch:css": "postcss -w -c postcss.json"
|
||||
},
|
||||
"keywords": [
|
||||
"html5",
|
||||
"html",
|
||||
"forms"
|
||||
],
|
||||
"author": "Timothy J. Warren <tim@timshomepage.net>",
|
||||
"license": "MIT",
|
||||
"xo": {
|
||||
"esnext": true,
|
||||
"envs": [
|
||||
"browser"
|
||||
],
|
||||
"ignore": [
|
||||
"src/polyfills/*.js",
|
||||
"src/old/*.js",
|
||||
"src/DlHighlight/*.js",
|
||||
"src/load-scripts.js"
|
||||
],
|
||||
"rules": {
|
||||
"camelcase": 0,
|
||||
"operator-linebreak": ["error", "before"]
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": "src/loadScripts.js",
|
||||
"esnext": false
|
||||
},
|
||||
{
|
||||
"files": "tools/min.js",
|
||||
"camelcase": "ignore"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
14
postcss.json
Normal file
14
postcss.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"use": ["autoprefixer", "postcss-css-variables", "cssnano"],
|
||||
"input": "css/src/style.css",
|
||||
"output": "css/style.min.css",
|
||||
"autoprefixer": {
|
||||
"browsers": "> 1%"
|
||||
},
|
||||
"cssnano": {
|
||||
"autoprefixer": false
|
||||
},
|
||||
"postcss-css-variables": {
|
||||
"preserve": true
|
||||
}
|
||||
}
|
46
rollup.config.js
Normal file
46
rollup.config.js
Normal file
@ -0,0 +1,46 @@
|
||||
// Rollup plugins
|
||||
import buble from 'rollup-plugin-buble';
|
||||
import cleanup from 'rollup-plugin-cleanup';
|
||||
import commonjs from 'rollup-plugin-commonjs';
|
||||
import filesize from 'rollup-plugin-filesize';
|
||||
import resolve from 'rollup-plugin-node-resolve';
|
||||
import sizes from 'rollup-plugin-sizes';
|
||||
import strip from 'rollup-plugin-strip';
|
||||
import uglify from 'rollup-plugin-uglify';
|
||||
|
||||
export default {
|
||||
entry: 'src/index.js',
|
||||
dest: 'js/index.min.js',
|
||||
format: 'iife',
|
||||
sourceMap: true,
|
||||
useStrict: true,
|
||||
plugins: [
|
||||
resolve({
|
||||
jsnext: true,
|
||||
main: true,
|
||||
browser: true
|
||||
}),
|
||||
commonjs({
|
||||
include: 'node_modules/**',
|
||||
exclude: []
|
||||
}),
|
||||
buble({
|
||||
exclude: 'node_modules/**'
|
||||
}),
|
||||
/*strip({
|
||||
debugger: false,
|
||||
functions: ['console.*', 'assert.*', 'debug', 'alert']
|
||||
}),*/
|
||||
(process.env.NODE_ENV === 'production')
|
||||
? uglify({
|
||||
negate_iife: false,
|
||||
support_ie8: true
|
||||
})
|
||||
: cleanup({
|
||||
maxEmptyLines: 0,
|
||||
comments: 'none'
|
||||
}),
|
||||
filesize(),
|
||||
sizes()
|
||||
]
|
||||
};
|
554
src/DlHighlight/highlight-xml-html.js
Normal file
554
src/DlHighlight/highlight-xml-html.js
Normal file
@ -0,0 +1,554 @@
|
||||
/**************\
|
||||
* ____ _____
|
||||
* DlHighlight -- a JavaScript-based syntax highlighting engine. \ /_ / /
|
||||
* \ / / /
|
||||
* Author: Mihai Bazon, http://mihai.bazon.net/blog \/ /_ /
|
||||
* Copyright: (c) Dynarch.com 2007. All rights reserved. \ / /
|
||||
* http://www.dynarch.com/ / /
|
||||
* \/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
\******************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
*
|
||||
* This thing only cares to colorize a piece of text. It has nothing to do
|
||||
* with the DOM, with reading existing text from the DOM and to insert the
|
||||
* formatted code back. This facility is present in helpers.js.
|
||||
*
|
||||
* Assuming the unformatted code is in the "code" variable, use DlHighlight
|
||||
* this way:
|
||||
*
|
||||
* var hl = new DlHighlight({ lang : "js",
|
||||
* lineNumbers : true });
|
||||
*
|
||||
* formatted = hl.doItNow(code);
|
||||
*
|
||||
* Now you have in "formatted" the colored version.
|
||||
*
|
||||
* Supported parameters are:
|
||||
*
|
||||
* - "lang" (required) to declare the language
|
||||
* - "lineNumbers" (optional) if you want line numbers
|
||||
* - "showWhitespace" (optional) if you want to display whitespace
|
||||
* in strings as underscores
|
||||
* - "noTrim" (optional) pass *true* if you want not to ignore empty
|
||||
* newlines at the end of the code
|
||||
*
|
||||
*/
|
||||
|
||||
var DlHighlight = (function(){
|
||||
|
||||
var H = function(args) {
|
||||
var self = this;
|
||||
this.args = {};
|
||||
function D(name, val) {
|
||||
if (name in args)
|
||||
val = args[name];
|
||||
self.args[name] = val;
|
||||
}
|
||||
D("replaceTabs", null);
|
||||
D("lineNumbers", false);
|
||||
D("noTrim", false);
|
||||
D("showWhitespace", false);
|
||||
var lang = this.lang = H.LANG[args.lang];
|
||||
this.tokenParsers = lang.tokens.slice(0).reverse();
|
||||
if (this.args.replaceTabs != null) {
|
||||
var tab = " ";
|
||||
while (--this.args.replaceTabs > 0)
|
||||
tab += " ";
|
||||
this.args.replaceTabs = tab;
|
||||
}
|
||||
};
|
||||
|
||||
H.is_ie = /MSIE/.test(navigator.userAgent) && !/Gecko|KHTML|Opera/.test(navigator.userAgent);
|
||||
|
||||
// definitions useful for most languages out there
|
||||
H.BASE = {
|
||||
|
||||
COMMENT_CPP : function(txt) {
|
||||
if (txt.charAt(0) == "/" && txt.charAt(1) == "/") {
|
||||
var nl = txt.indexOf("\n");
|
||||
if (nl == -1)
|
||||
nl = txt.length;
|
||||
var c = this.lang.onComment.call(this, this._he(txt.substring(2, nl)));
|
||||
return {
|
||||
content : { escaped: c },
|
||||
style : "comment comment-line",
|
||||
type : "comment",
|
||||
index : nl,
|
||||
before : "//"
|
||||
};
|
||||
}
|
||||
},
|
||||
|
||||
COMMENT_C : function(txt) {
|
||||
if (txt.charAt(0) == "/" && txt.charAt(1) == "*") {
|
||||
var nl = txt.indexOf("*/"), c, index = nl;
|
||||
if (nl == -1)
|
||||
nl = index = txt.length;
|
||||
else
|
||||
index += 2;
|
||||
c = this.lang.onComment.call(this, this._he(txt.substring(2, nl)));
|
||||
c = c.replace(/^\s*[*\\|]+/mg, function(s) {
|
||||
return "<span class='before'>" + s + "</span>";
|
||||
});
|
||||
return {
|
||||
content : { escaped: c },
|
||||
before : "/*",
|
||||
after : "*/",
|
||||
index : index,
|
||||
style : "comment comment-multiline",
|
||||
type : "comment"
|
||||
};
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
STRING : {
|
||||
regexp : /^(\x22(\\.|[^\x22\\])*\x22|\x27(\\.|[^\x27\\])*\x27)/g,
|
||||
content : function(m) {
|
||||
m = m[1];
|
||||
m = m.substr(1, m.length - 2);
|
||||
if (this.args.showWhitespace)
|
||||
m = m.replace(/\x20/g, "_");
|
||||
return m;
|
||||
},
|
||||
before : function(m) { return m[1].charAt(0); },
|
||||
after : function(m) { return m[1].charAt(0); },
|
||||
type : "string",
|
||||
style : "string"
|
||||
},
|
||||
|
||||
PAREN : {
|
||||
regexp : /^[\](){}\[]/g,
|
||||
content : 0,
|
||||
type : "paren",
|
||||
style : "paren"
|
||||
},
|
||||
|
||||
OPERATOR : function(txt) {
|
||||
var m = /^[<>!+=%&*\x2f|?:-]+/.exec(txt);
|
||||
if (m && m[0] != "!/") return {
|
||||
content : m[0],
|
||||
index : m.lastIndex,
|
||||
type : "operator",
|
||||
style : "operator"
|
||||
};
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
H.prototype = {
|
||||
|
||||
formatToken : function(tok) {
|
||||
var cls = tok.style, html = buffer();
|
||||
if (cls instanceof Array)
|
||||
cls = cls.join(" ");
|
||||
html("<span class='", cls, "'>");
|
||||
if (tok.before)
|
||||
html("<span class='before'>", this._he(tok.before), "</span>");
|
||||
html(this._he(tok.content));
|
||||
if (tok.after)
|
||||
html("<span class='after'>", this._he(tok.after), "</span>");
|
||||
html("</span>");
|
||||
return html.get();
|
||||
},
|
||||
|
||||
formatUnknown : function(txt) {
|
||||
return this._he(txt);
|
||||
},
|
||||
|
||||
getLastToken : function(pos) {
|
||||
return this.tokens[this.tokens.length - (pos || 0) - 1];
|
||||
},
|
||||
|
||||
lastTokenType : function(re) {
|
||||
var t = this.getLastToken();
|
||||
if (t)
|
||||
return re.test(t.type);
|
||||
return false;
|
||||
},
|
||||
|
||||
parseToken : function(test, code) {
|
||||
var m, tok;
|
||||
if (test.regexp) {
|
||||
test.regexp.lastIndex = 0;
|
||||
m = test.regexp.exec(code);
|
||||
if (m) {
|
||||
tok = { type : test.type,
|
||||
style : test.style,
|
||||
index : test.regexp.lastIndex
|
||||
};
|
||||
reAdd(this, "before", m, test, tok);
|
||||
reAdd(this, "after", m, test, tok);
|
||||
reAdd(this, "content", m, test, tok);
|
||||
}
|
||||
} else {
|
||||
tok = test.call(this, code);
|
||||
}
|
||||
return tok;
|
||||
},
|
||||
|
||||
doItNow : function(code) {
|
||||
this.lang.start.call(this, code);
|
||||
if (!this.args.noTrim)
|
||||
code = code.replace(/\s+$/, "");
|
||||
var formatted = [], T = this.tokenParsers, m, unknown, tok, i, f = 0, tokens;
|
||||
unknown = "";
|
||||
tokens = this.tokens = [];
|
||||
while (code.length > 0) {
|
||||
// jumping whitespace one character at a time
|
||||
// might eat a lot of time, let's skip it
|
||||
// quickly
|
||||
m = /^\s+/.exec(code);
|
||||
if (m) {
|
||||
unknown += m[0];
|
||||
code = code.substr(m[0].length);
|
||||
}
|
||||
for (i = T.length; --i >= 0;) {
|
||||
tok = this.parseToken(T[i], code);
|
||||
if (tok)
|
||||
break;
|
||||
}
|
||||
if (tok) {
|
||||
if (unknown)
|
||||
formatted[f++] = unknown;
|
||||
unknown = "";
|
||||
if (!(tok instanceof Array))
|
||||
tok = [ tok ];
|
||||
var index = 0;
|
||||
tokens.push.apply(tokens, tok);
|
||||
for (var j = 0; j < tok.length; ++j) {
|
||||
var t = tok[j];
|
||||
formatted[f++] = t;
|
||||
index += getNextIndex(t);
|
||||
}
|
||||
code = code.substr(index);
|
||||
} else {
|
||||
unknown += code.charAt(0);
|
||||
code = code.substr(1);
|
||||
}
|
||||
}
|
||||
if (unknown)
|
||||
formatted[f++] = unknown;
|
||||
for (i = formatted.length; --i >= 0;) {
|
||||
f = formatted[i];
|
||||
if (typeof f == "string")
|
||||
formatted[i] = this.formatUnknown(f);
|
||||
else
|
||||
formatted[i] = this.formatToken(f);
|
||||
}
|
||||
var html = formatted.join("");
|
||||
i = this.args.lineNumbers;
|
||||
if (i) {
|
||||
if (typeof i != "number")
|
||||
i = 0;
|
||||
html = html.replace(/^/mg, function() {
|
||||
return "<span class='line-numbers'>" + (++i) + "</span>";
|
||||
});
|
||||
this.args.lineNumbers = i;
|
||||
}
|
||||
// html = html.replace(/\n/g, "<br />");
|
||||
this.lang.stop.call(this);
|
||||
return html;
|
||||
},
|
||||
|
||||
_he : function(str) {
|
||||
if (str.escaped)
|
||||
return str.escaped;
|
||||
str = str.replace(he_re, function(c) {
|
||||
return he_re_val[c];
|
||||
});
|
||||
if (this.args.replaceTabs)
|
||||
str = str.replace(/\t/g, this.args.replaceTabs);
|
||||
return str;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var he_re = /[&<>]/g, he_re_val = {
|
||||
"&" : "&",
|
||||
"<" : "<",
|
||||
">" : ">"
|
||||
};
|
||||
|
||||
H.LANG = function(id, tokens) {
|
||||
if (arguments.length > 0) {
|
||||
H.LANG[id] = this;
|
||||
this.tokens = tokens;
|
||||
}
|
||||
};
|
||||
|
||||
H.registerLang = function(type, tokens) {
|
||||
F.prototype = new H.LANG;
|
||||
F.prototype.constructor = F;
|
||||
function F() { H.LANG.call(this, type, tokens); };
|
||||
return new F();
|
||||
};
|
||||
|
||||
var P = H.LANG.prototype;
|
||||
P.start = P.stop = function(){};
|
||||
|
||||
P.onComment = function(c) {
|
||||
return makeUrls(c);
|
||||
};
|
||||
|
||||
function makeUrls(s) {
|
||||
return s.replace(/\b((https?|ftp):\x2f\x2f[^\s\x22]+)/g, function(url) {
|
||||
return "<a href='" + url + "'>" + url + "</a>";
|
||||
});
|
||||
};
|
||||
|
||||
function reAdd(self, c, m, test, tok) {
|
||||
if (test[c] != null) {
|
||||
if (typeof test[c] == "number") {
|
||||
tok[c] = m[test[c]];
|
||||
} else if (typeof test[c] == "function") {
|
||||
tok[c] = test[c].call(self, m);
|
||||
} else {
|
||||
tok[c] = test[c];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getNextIndex(tok) {
|
||||
var index = tok.index || 0;
|
||||
if (!index) {
|
||||
// console.log("No index in %s", tok.style);
|
||||
if (tok.before)
|
||||
index += tok.before.length;
|
||||
if (tok.content)
|
||||
index += tok.content.length;
|
||||
if (tok.after)
|
||||
index += tok.after.length;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
var buffer = H.is_ie
|
||||
? function() {
|
||||
var a = [], idx = 0, f = function() {
|
||||
for (var i = 0; i < arguments.length; ++i)
|
||||
a[idx++] = arguments[i];
|
||||
};
|
||||
f.get = function() { return a.join(""); };
|
||||
return f;
|
||||
} : function() {
|
||||
var str = "", f = function() {
|
||||
str = str.concat.apply(str, arguments);
|
||||
};
|
||||
f.get = function() { return str; };
|
||||
return f;
|
||||
};
|
||||
|
||||
/**************\
|
||||
* ____ _____
|
||||
* DlHighlight -- a JavaScript-based syntax highlighting engine. \ /_ / /
|
||||
* \ / / /
|
||||
* Author: Mihai Bazon, http://mihai.bazon.net/blog \/ /_ /
|
||||
* Copyright: (c) Dynarch.com 2007. All rights reserved. \ / /
|
||||
* http://www.dynarch.com/ / /
|
||||
* \/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
\******************************************************************************/
|
||||
|
||||
var T = {
|
||||
|
||||
COMMENT: function(txt) {
|
||||
if (txt.indexOf("<!--") == 0) {
|
||||
var nl = txt.indexOf("--", 4);
|
||||
if (nl == -1)
|
||||
nl = txt.length;
|
||||
return {
|
||||
before : "<!--",
|
||||
after : "-->",
|
||||
content : txt.substring(4, nl),
|
||||
index : nl + 3,
|
||||
type : "comment",
|
||||
style : "comment"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
STRING: function(txt) {
|
||||
if (this.inXmlTag)
|
||||
return this.parseToken(H.BASE.STRING, txt);
|
||||
},
|
||||
|
||||
ATTRIBUTE: function(txt) {
|
||||
var r = null;
|
||||
if (this.inXmlTag) {
|
||||
var m = /^([a-z0-9_-]+)(\s*)=/i.exec(txt);
|
||||
if (m) {
|
||||
return [ { content : m[1],
|
||||
style : "builtin xml-attribute" },
|
||||
{ content : m[2] }, // whitespace
|
||||
{ content : "=",
|
||||
style : "operator" }
|
||||
];
|
||||
}
|
||||
}
|
||||
return r;
|
||||
},
|
||||
|
||||
ENTITY: {
|
||||
regexp : /^&(\w+);/g,
|
||||
before : "&",
|
||||
after : ";",
|
||||
content : 1,
|
||||
type : "builtin",
|
||||
style : "builtin xml-entity"
|
||||
},
|
||||
|
||||
START_TAG: function(txt) {
|
||||
var m = /^<([a-z0-9_-]+)/i.exec(txt);
|
||||
if (m) {
|
||||
this.inXmlTag = m[1];
|
||||
return [ { content : "<",
|
||||
style : "paren xml-tagangle" },
|
||||
{ content : m[1],
|
||||
style : "keyword xml-tag xml-tag-open" } ];
|
||||
}
|
||||
},
|
||||
|
||||
END_TAG: function(txt) {
|
||||
var m = /^<\x2f([a-z0-9_-]+)(\s*>)/i.exec(txt);
|
||||
if (m) {
|
||||
return [ { content : "</",
|
||||
style : "paren xml-tagangle" },
|
||||
{ content : m[1],
|
||||
style : "keyword xml-tag xml-tag-close" },
|
||||
{ content : m[2],
|
||||
style : "paren xml-tagangle" } ];
|
||||
}
|
||||
},
|
||||
|
||||
END_ANGLE: function(txt) {
|
||||
var m = /^\x2f?>/.exec(txt);
|
||||
if (m) {
|
||||
this.inXmlTag = false;
|
||||
return {
|
||||
content : m[0],
|
||||
style : "paren xml-tagangle"
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var lang = H.registerLang(
|
||||
"xml", [ T.COMMENT,
|
||||
T.STRING,
|
||||
T.ATTRIBUTE,
|
||||
T.ENTITY,
|
||||
T.START_TAG,
|
||||
T.END_TAG,
|
||||
T.END_ANGLE ]);
|
||||
|
||||
lang.T = T;
|
||||
|
||||
lang.start = function() {
|
||||
this.inXmlTag = false;
|
||||
};
|
||||
|
||||
/**************\
|
||||
* ____ _____
|
||||
* DlHighlight -- a JavaScript-based syntax highlighting engine. \ /_ / /
|
||||
* \ / / /
|
||||
* Author: Mihai Bazon, http://mihai.bazon.net/blog \/ /_ /
|
||||
* Copyright: (c) Dynarch.com 2007. All rights reserved. \ / /
|
||||
* http://www.dynarch.com/ / /
|
||||
* \/
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation; either version 2 of the License, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., 51
|
||||
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
\******************************************************************************/
|
||||
|
||||
// Inherits most parsers from XML, but modifies END_ANGLE to highlight SCRIPT tags
|
||||
|
||||
var re_get_script = /([^\0]*?)<\x2fscript>/gi;
|
||||
|
||||
var xml = H.LANG.xml;
|
||||
|
||||
function END_ANGLE(txt) {
|
||||
var m = /^\x2f?>/.exec(txt);
|
||||
if (m) {
|
||||
var tag = this.inXmlTag;
|
||||
this.inXmlTag = false;
|
||||
var tok = [{ content : m[0],
|
||||
style : "paren xml-tagangle" }];
|
||||
if (/^script$/i.test(tag) && !/><\x2fscript>/i.test(txt)) {
|
||||
re_get_script.lastIndex = 1;
|
||||
var m = re_get_script.exec(txt);
|
||||
if (m && m[1] && m.index == 1) {
|
||||
var code = m[1];
|
||||
var index = re_get_script.lastIndex - 10;
|
||||
var js = new H({ lang: "js",
|
||||
noTrim: true }).doItNow(code);
|
||||
var jstok = {
|
||||
content : { escaped: js },
|
||||
style : "xml-inline-script",
|
||||
index : index
|
||||
};
|
||||
tok.push(jstok);
|
||||
}
|
||||
}
|
||||
return tok;
|
||||
}
|
||||
}
|
||||
|
||||
H.registerLang("html", [ xml.T.COMMENT,
|
||||
xml.T.STRING,
|
||||
xml.T.ATTRIBUTE,
|
||||
xml.T.ENTITY,
|
||||
xml.T.START_TAG,
|
||||
xml.T.END_TAG,
|
||||
END_ANGLE
|
||||
]);
|
||||
|
||||
return H;
|
||||
|
||||
})();
|
||||
|
||||
export default DlHighlight;
|
65
src/doc.js
Normal file
65
src/doc.js
Normal file
@ -0,0 +1,65 @@
|
||||
/**
|
||||
* Simple DOM helper methods
|
||||
*/
|
||||
class Doc {
|
||||
/**
|
||||
* Get the list of script elements currently loaded
|
||||
*
|
||||
* @return {Element[]}
|
||||
*/
|
||||
static scripts() {
|
||||
return Array.from(document.scripts);
|
||||
}
|
||||
/**
|
||||
* Search for an HTML element by css selector
|
||||
*
|
||||
* @param {string} sel - The css selector
|
||||
* @param {Element} [context] - An optional parent element to search from
|
||||
* @return {Element}
|
||||
*/
|
||||
static qs(sel, context = document.documentElement) {
|
||||
if (document.OLD_IE) {
|
||||
return document.documentElement.querySelector.call(context, sel);
|
||||
}
|
||||
|
||||
return context.querySelector(sel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of HTML elements by css selector
|
||||
*
|
||||
* @param {string} sel - The css selector
|
||||
* @param {Element} [context] - An optional parent element to search from
|
||||
* @return {Element[]}
|
||||
*/
|
||||
static qsa(sel, context = document.documentElement) {
|
||||
if (document.OLD_IE) {
|
||||
return Array.from(document.documentElement.querySelectorAll.call(context, sel));
|
||||
}
|
||||
|
||||
return Array.from(context.querySelectorAll(sel));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an HTML element by its id attribute
|
||||
*
|
||||
* @param {string} id
|
||||
* @return {Element}
|
||||
*/
|
||||
static getById(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an array of HTML elements by their tag (element) name
|
||||
*
|
||||
* @param {string} tagName
|
||||
* @param {Element} [context] - An optional parent element to search from
|
||||
* @return {Element[]}
|
||||
*/
|
||||
static getByTag(tagName, context = document.documentElement) {
|
||||
return Array.from(context.getElementsByTagName(tagName));
|
||||
}
|
||||
}
|
||||
|
||||
export default Doc;
|
78
src/form-elements-each.js
Normal file
78
src/form-elements-each.js
Normal file
@ -0,0 +1,78 @@
|
||||
import Doc from './doc';
|
||||
import Format from './format';
|
||||
import {highlightHtml, replaceMultiple} from './functions';
|
||||
|
||||
const $newLinePattern = /\{n}/g;
|
||||
const $spacePattern = /\{s}/g;
|
||||
const $tabPattern = /\{t}/g;
|
||||
|
||||
/**
|
||||
* Callback for form element iteration
|
||||
*
|
||||
* Formats each form element section
|
||||
*
|
||||
* @param {Element} parent
|
||||
*/
|
||||
const each = parent => {
|
||||
// Get the elements required to display
|
||||
const labelElements = Doc.getByTag('label', parent);
|
||||
const formElements = [].concat(
|
||||
Doc.getByTag('input', parent),
|
||||
Doc.getByTag('button', parent),
|
||||
Doc.getByTag('textarea', parent),
|
||||
Doc.getByTag('select', parent),
|
||||
Doc.getByTag('datalist', parent),
|
||||
Doc.getByTag('keygen', parent),
|
||||
Doc.getByTag('meter', parent),
|
||||
Doc.getByTag('output', parent),
|
||||
Doc.getByTag('progress', parent)
|
||||
);
|
||||
|
||||
// If the required elements do not exist, bail out early
|
||||
if (!(Array.isArray(formElements)) && labelElements != null) {
|
||||
console.error('Missing required elements. {}', parent);
|
||||
return;
|
||||
}
|
||||
|
||||
let labelHTML = '';
|
||||
let formElementHTML = '';
|
||||
|
||||
if (Format.isLabelWrapped(labelElements)) {
|
||||
// If there are labels wrapping the form elements, treat them
|
||||
// a little differently.
|
||||
// Since the elements are wrapped in labels, the label elements are what we want
|
||||
// to work with.
|
||||
labelElements.forEach(element => {
|
||||
formElementHTML += Format.formatLabelWrappedElement(element);
|
||||
});
|
||||
} else {
|
||||
labelHTML = Format.formatHtml(labelElements[0], 0);
|
||||
|
||||
formElements.forEach(formElement => {
|
||||
formElementHTML += '{n}{n}' + Format.formatHtml(formElement, 0);
|
||||
});
|
||||
}
|
||||
|
||||
// Join the label markup with the form element markup
|
||||
const formCode = labelHTML + formElementHTML.trim();
|
||||
|
||||
// Now replace the placeholders with proper whitespace equivalent markup
|
||||
// Setup up the highlighter
|
||||
let highLighted = highlightHtml(formCode);
|
||||
highLighted = replaceMultiple(highLighted, [
|
||||
[$newLinePattern, '<br />'],
|
||||
[$spacePattern, ' '],
|
||||
[$tabPattern, ' ']
|
||||
]);
|
||||
highLighted = `<pre>${highLighted}</pre>`;
|
||||
|
||||
// Piece together the HTML for the prettier HTML examples
|
||||
const codeElement = document.createElement('code');
|
||||
codeElement.className = 'DlHighlight html';
|
||||
codeElement.innerHTML = highLighted;
|
||||
|
||||
// Append the prettified HTML to the parent element
|
||||
parent.appendChild(codeElement);
|
||||
};
|
||||
|
||||
export default each;
|
184
src/format.js
Normal file
184
src/format.js
Normal file
@ -0,0 +1,184 @@
|
||||
// Make sure regex patterns are only parsed once
|
||||
const $whiteSpacePattern = /^\s+$/ig;
|
||||
const $inputTagPattern = /<(input)(.*?)>/ig;
|
||||
const $optionClosingTagPattern = />(?:\s+)?<\/option>/ig;
|
||||
const $htmlAttributeSpacingPattern = /(\s+)([^in\s][a-z_\-]+=(?:"(?:.*?)"|[^"'`=<>\s]+))/ig;
|
||||
const $labelWrapPattern = /<label.*?>(?:.*?)?(?:\s+)?(<.*?>)(?:.*?)?(?:\s+)?<\/label>/ig;
|
||||
|
||||
const ELEMENT_NODE = 1;
|
||||
const TEXT_NODE = 3;
|
||||
|
||||
class Format {
|
||||
/**
|
||||
* Format the display of an input element, and align the attributes
|
||||
* on separate lines
|
||||
*
|
||||
* @param {HTMLInputElement} formElement
|
||||
* @return {string}
|
||||
*/
|
||||
static input(formElement) {
|
||||
// Let's do some ugly DOM manipulation to make the output of the
|
||||
// highlighted have lined up attributes.
|
||||
// For the spacing, we replace normal whitespace characters with
|
||||
// {x} placeholders so the highlighter doesn't mangle them
|
||||
const formElementSpaces = '{s}'.repeat(formElement.tagName.length + 2);
|
||||
const formElementReplace = '{n}' + formElementSpaces;
|
||||
return formElement.outerHTML
|
||||
.trim()
|
||||
.replace($inputTagPattern, `<$1$2 />`)
|
||||
.replace($htmlAttributeSpacingPattern, formElementReplace + '$2');
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the display of an option element
|
||||
*
|
||||
* @param {HTMLOptionElement} formElement
|
||||
* @return {string}
|
||||
*/
|
||||
static option(formElement) {
|
||||
let raw = Format.generic(formElement);
|
||||
|
||||
if (Format.hasHtmlChildren(formElement) && formElement.childNodes.length > 0) {
|
||||
return raw;
|
||||
}
|
||||
|
||||
raw = raw.replace($whiteSpacePattern, '');
|
||||
return raw.replace($optionClosingTagPattern, ' />');
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the display of elements without specific formatting methods
|
||||
*
|
||||
* @param {HTMLElement} formElement
|
||||
* @return {string}
|
||||
*/
|
||||
static generic(formElement) {
|
||||
return formElement.outerHTML.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the current element
|
||||
*
|
||||
* @param {HTMLElement} formElement
|
||||
* @param {number} i
|
||||
* @return string
|
||||
*/
|
||||
static formatElement(formElement, i) {
|
||||
const elementPrefix = (i > 0)
|
||||
? '{n}' + '{t}'.repeat(i)
|
||||
: '';
|
||||
|
||||
const formattingMethods = ['input', 'option'];
|
||||
|
||||
// Attempt to indent text nodes
|
||||
if (formElement.nodeType === TEXT_NODE) {
|
||||
//alert('Attempting to format a text node');
|
||||
return elementPrefix + formElement.nodeValue;
|
||||
} else if (formElement.nodeType === ELEMENT_NODE) {
|
||||
const tagName = formElement.nodeName.toLowerCase();
|
||||
const formattingMethod = (formattingMethods.includes(tagName))
|
||||
? Format[tagName]
|
||||
: Format.generic;
|
||||
|
||||
return elementPrefix + formattingMethod(formElement);
|
||||
} else if (formElement.nodeValue) {
|
||||
alert('What am I?');
|
||||
return formElement.nodeValue;
|
||||
}
|
||||
|
||||
console.error('Empty form element :(');
|
||||
console.error(formElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a label-wrapped element
|
||||
*
|
||||
* @param {HTMLElement} formElement
|
||||
* @returns {string}
|
||||
*/
|
||||
static formatLabelWrappedElement(formElement) {
|
||||
return formElement.outerHTML + '{n}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether an element has an other elements as children
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @return {boolean}
|
||||
*/
|
||||
static hasHtmlChildren(element) {
|
||||
const numChildren = element.childNodes.length;
|
||||
for (let x = 0; x < numChildren; x++) {
|
||||
const node = element.childNodes.item(x);
|
||||
|
||||
// Only count as a child if the node is an element
|
||||
if (node.nodeType === ELEMENT_NODE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively format the form elements for better alignment
|
||||
*
|
||||
* @param {HTMLElement} formElement
|
||||
* @param {number} level
|
||||
* @return {string}
|
||||
*/
|
||||
static formatHtml(formElement, level = 0) {
|
||||
const hasChildren = Format.hasHtmlChildren(formElement);
|
||||
const isLabelWrapped = Format.isLabelWrapped(formElement);
|
||||
|
||||
let formattedHTML = (isLabelWrapped)
|
||||
? Format.formatLabelWrappedElement(formElement)
|
||||
: Format.formatElement(formElement, level);
|
||||
|
||||
// If there are no children, just return the formatted element
|
||||
if (!hasChildren) {
|
||||
return formattedHTML;
|
||||
}
|
||||
|
||||
let children = Array.from(formElement.childNodes);
|
||||
const rawChildren = formElement.innerHTML;
|
||||
|
||||
// Discard text nodes if they only contain whitespace
|
||||
children = children.filter(node => (!(node.nodeType === TEXT_NODE || $whiteSpacePattern.test(node.nodeValue))));
|
||||
|
||||
level++;
|
||||
let newChildrenHTML = children.reduce((prevHTML, node) => {
|
||||
return prevHTML + Format.formatHtml(node, level);
|
||||
}, '');
|
||||
|
||||
|
||||
// Format those closing tags
|
||||
if (level > 0 && hasChildren) {
|
||||
newChildrenHTML += '{n}' + '{t}'.repeat(level - 1);
|
||||
}
|
||||
|
||||
formattedHTML = formattedHTML.replace(rawChildren, newChildrenHTML);
|
||||
|
||||
return formattedHTML;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether an element
|
||||
*
|
||||
* @param {Element|Element[]} labelElements
|
||||
* @returns {boolean}
|
||||
*/
|
||||
static isLabelWrapped(labelElements) {
|
||||
if (labelElements.length === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const labelElement = (Array.isArray(labelElements))
|
||||
? labelElements[0]
|
||||
: labelElements;
|
||||
|
||||
return $labelWrapPattern.test(labelElement.outerHTML);
|
||||
}
|
||||
}
|
||||
|
||||
export default Format;
|
89
src/functions.js
Normal file
89
src/functions.js
Normal file
@ -0,0 +1,89 @@
|
||||
/**
|
||||
* Helper functions
|
||||
*/
|
||||
|
||||
import DlHighlight from './DlHighlight/highlight-xml-html';
|
||||
|
||||
/**
|
||||
* Returns the final segment of a string split by the specified
|
||||
* separator character(s)
|
||||
*
|
||||
* @param {string} str
|
||||
* @param {string} separator
|
||||
* @returns {string}
|
||||
*/
|
||||
export function basename(str, separator="/") {
|
||||
return str.substr(str.lastIndexOf(separator) + 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Do multiple string replacements with a mapping array
|
||||
*
|
||||
* @param {string} str - The string to modify
|
||||
* @param {string[][]} replacements - map [search, replacement]
|
||||
* @return {string}
|
||||
*/
|
||||
export function replaceMultiple(str, replacements) {
|
||||
let output = str;
|
||||
|
||||
replacements.forEach(pair => {
|
||||
output = output.replace(pair[0], pair[1]);
|
||||
});
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Highlight HTML code
|
||||
*
|
||||
* @param {string} html
|
||||
* @return {string}
|
||||
*/
|
||||
export function highlightHtml(html) {
|
||||
return (new DlHighlight({lang: 'html'})).doItNow(html);
|
||||
}
|
||||
|
||||
/**
|
||||
* Function : dump()
|
||||
* Arguments: The data - array,hash(associative array),object
|
||||
* The level - OPTIONAL
|
||||
* Returns : The textual representation of the array.
|
||||
* This function was inspired by the print_r function of PHP.
|
||||
* This will accept some data as the argument and return a
|
||||
* text that will be a more readable version of the
|
||||
* array/hash/object that is given.
|
||||
* Docs: http://www.openjs.com/scripts/others/dump_function_php_print_r.php
|
||||
*/
|
||||
export function dump(arr, level = 0) {
|
||||
let dumped_text = "";
|
||||
|
||||
//The padding given at the beginning of the line.
|
||||
let level_padding = "";
|
||||
for(let j=0;j<level+1;j++) level_padding += " ";
|
||||
|
||||
if(typeof(arr) == 'object') { //Array/Hashes/Objects
|
||||
for(let item in arr) {
|
||||
const value = arr[item];
|
||||
|
||||
if(typeof(value) == 'object') { //If it is an array,
|
||||
dumped_text += level_padding + "'" + item + "' ...\n";
|
||||
dumped_text += dump(value,level+1);
|
||||
} else {
|
||||
dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n";
|
||||
}
|
||||
}
|
||||
} else { //Stings/Chars/Numbers etc.
|
||||
dumped_text = "===>"+arr+"<===("+typeof(arr)+")";
|
||||
}
|
||||
return dumped_text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default export map
|
||||
*/
|
||||
export default {
|
||||
basename: basename,
|
||||
dump: dump,
|
||||
highlightHtml: highlightHtml,
|
||||
replaceMultiple: replaceMultiple
|
||||
};
|
43
src/index.js
Normal file
43
src/index.js
Normal file
@ -0,0 +1,43 @@
|
||||
import {basename} from './functions';
|
||||
import each from './form-elements-each';
|
||||
import Doc from './doc';
|
||||
|
||||
// Just kill form submission
|
||||
Doc.getByTag('form')[0].onsubmit = function (e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
console.log(`Form 'submit' event fired.`);
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
// What polyfills did we have to load?
|
||||
const $polyfillPattern = /\/polyfills\//;
|
||||
const scriptList = Doc.scripts().filter(file => {
|
||||
return $polyfillPattern.test(file.getAttribute('src'))
|
||||
});
|
||||
if (scriptList.length > 0) {
|
||||
const polyfillList = [];
|
||||
scriptList.forEach(file => {
|
||||
const src = file.getAttribute('src');
|
||||
const name = basename(src).replace('.js', '')
|
||||
.replace('.min', '');
|
||||
|
||||
const el = `<li>${name}</li>`;
|
||||
|
||||
if (!polyfillList.includes(el)) {
|
||||
polyfillList.push(el);
|
||||
}
|
||||
});
|
||||
|
||||
const tag = Doc.getById('polyfills-loaded');
|
||||
tag.innerHTML = '<h3>Polyfills loaded by this browser:</h3>';
|
||||
tag.innerHTML += `<ul>${polyfillList.join("\n")}</ul>`;
|
||||
}
|
||||
|
||||
// Get each form field's html and syntax highlight it
|
||||
Doc.qsa('.form-field').forEach(each);
|
||||
|
||||
|
||||
|
40
src/load-scripts.js
Normal file
40
src/load-scripts.js
Normal file
@ -0,0 +1,40 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
function loadBodyScript(src) {
|
||||
var tag = document.createElement('script');
|
||||
tag.src = src;
|
||||
tag.async = false;
|
||||
document.body.appendChild(tag);
|
||||
}
|
||||
|
||||
// Polyfill feature checks
|
||||
// [<feature check>, <polyfill path>]
|
||||
var ESPath = 'js/polyfills/EcmaScript/';
|
||||
var polyfills = [
|
||||
[!document.body.outerHTML, 'js/polyfills/Dom/Element.outerHTML.min.js'],
|
||||
[!Array.from, ESPath + 'Array.from.js'],
|
||||
[!Array.isArray, ESPath + 'Array.isArray.js'],
|
||||
[!Array.from, ESPath + 'Array.from.js'],
|
||||
[!Array.prototype.filter, ESPath + 'Array.prototype.filter.js'],
|
||||
[!Array.prototype.forEach, ESPath + 'Array.prototype.forEach.js'],
|
||||
[!Array.prototype.includes, ESPath + 'Array.prototype.includes.js'],
|
||||
//[!Array.prototype.map, ESPath + 'Array.prototype.map.js'],
|
||||
[!Array.prototype.reduce, ESPath + 'Array.prototype.reduce.js'],
|
||||
[!String.prototype.repeat, ESPath + 'String.prototype.repeat.js'],
|
||||
[!String.prototype.trim, ESPath + 'String.prototype.trim.js']
|
||||
];
|
||||
|
||||
var polyfillCount = polyfills.length;
|
||||
var i = 0;
|
||||
|
||||
// Load polyfills based on feature checks
|
||||
for (; i < polyfillCount; i++) {
|
||||
if (polyfills[i][0]) {
|
||||
loadBodyScript(polyfills[i][1]);
|
||||
}
|
||||
}
|
||||
|
||||
// Load the actual code
|
||||
loadBodyScript('js/index.min.js');
|
||||
})();
|
88
src/old/doc.js
Normal file
88
src/old/doc.js
Normal file
@ -0,0 +1,88 @@
|
||||
(this || window).doc = (function() {
|
||||
"use strict";
|
||||
|
||||
var docProto = {
|
||||
/**
|
||||
* Create a proper JavaScript array from an array-like object
|
||||
*
|
||||
* @param {object} arrayLike
|
||||
* @return {array}
|
||||
*/
|
||||
toArray: function(arrayLike) {
|
||||
return [].slice.call(arrayLike);
|
||||
},
|
||||
/**
|
||||
* Search for an HTML element by css selector
|
||||
*
|
||||
* @param {string} sel - The css selector
|
||||
* @param {Element} [context] - An optional parent element to search from
|
||||
* @return {Element}
|
||||
*/
|
||||
qs: function(sel, context) {
|
||||
context = context || document;
|
||||
return context.querySelector(sel);
|
||||
},
|
||||
/**
|
||||
* Get an array of HTML elements by css selector
|
||||
*
|
||||
* @param {string} sel - The css selector
|
||||
* @param {Element} [context] - An optional parent element to search from
|
||||
* @return {Element[]}
|
||||
*/
|
||||
qsa: function(sel, context) {
|
||||
context = context || document;
|
||||
return this.toArray(context.querySelectorAll(sel));
|
||||
},
|
||||
/**
|
||||
* Get an HTML element by its id attribute
|
||||
*
|
||||
* @param {string} id
|
||||
* @param {Element} [context] - An optional parent element to search from
|
||||
* @return {Element}
|
||||
*/
|
||||
getById: function(id, context) {
|
||||
context = context || document;
|
||||
return context.getElementById(id);
|
||||
},
|
||||
/**
|
||||
* Get an array of HTML elements by their tag (element) name
|
||||
*
|
||||
* @param {string} tagName
|
||||
* @param {Element} [context] - An optional parent element to search from
|
||||
* @return {Element[]}
|
||||
*/
|
||||
getByTag: function(tagName, context) {
|
||||
context = context || document;
|
||||
return this.toArray(context.getElementsByTagName(tagName));
|
||||
},
|
||||
/**
|
||||
* Get an array of HTML elements searching by a class
|
||||
*
|
||||
* @param {string} className
|
||||
* @param {Element} [context] - An optional parent element to search from
|
||||
* @return {Element[]}
|
||||
*/
|
||||
getByClass: function(className, context) {
|
||||
context = context || document;
|
||||
return this.toArray(context.getElementsByClassName(className));
|
||||
},
|
||||
/**
|
||||
* Do multiple string replacements with a mapping array
|
||||
*
|
||||
* @param {string} str - The string to modify
|
||||
* @param {string[][]} replacements - map [search, replacement]
|
||||
* @return {string}
|
||||
*/
|
||||
replaceMultiple: function(str, replacements) {
|
||||
var output = str;
|
||||
|
||||
replacements.forEach(function(pair) {
|
||||
output = output.replace(pair[0], pair[1]);
|
||||
});
|
||||
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
return Object.create(docProto);
|
||||
}());
|
202
src/old/init.js
Normal file
202
src/old/init.js
Normal file
@ -0,0 +1,202 @@
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
// Make sure regex patterns are only parsed once
|
||||
var $newLinePattern = /\{n}/g,
|
||||
$spacePattern = /\{s}/g,
|
||||
$tabPattern = /\{t}/g,
|
||||
$whiteSpacePattern = /^(?:\s+)?$/g,
|
||||
$inputTagPattern = /<input(.*?)>/g,
|
||||
$optionClosingTagPattern = />(?:\s+)?<\/option>/g,
|
||||
$htmlAttributeSpacingPattern = /(\s+)([^id][a-z_\-]+="(?:.*?)")/ig;
|
||||
|
||||
// Just kill form submission
|
||||
$.qs('form').onsubmit = function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
console.log("Form 'submit' event fired.");
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
var format = {
|
||||
/**
|
||||
* Format the display of an input element, and align the attributes
|
||||
* on separate lines
|
||||
*
|
||||
* @param {HTMLInputElement} formElement
|
||||
* @return {string}
|
||||
*/
|
||||
input: function (formElement) {
|
||||
// Let's do some ugly DOM manipulation to make the output of the
|
||||
// highlighted have lined up attributes.
|
||||
// For the spacing, we replace normal whitespace characters with
|
||||
// {x} placeholders so the highlighter doesn't mangle them
|
||||
var formElementSpaces = '{s}'.repeat(formElement.tagName.length + 2);
|
||||
var formElementReplace = '{n}' + formElementSpaces;
|
||||
var formElementHTML = formElement.outerHTML
|
||||
.trim()
|
||||
.replace($inputTagPattern, '<input$1 />')
|
||||
.replace($htmlAttributeSpacingPattern, formElementReplace + '$2');
|
||||
|
||||
return formElementHTML;
|
||||
},
|
||||
/**
|
||||
* Format the display of an option element
|
||||
*
|
||||
* @param {HTMLOptionElement} formElement
|
||||
* @return {string}
|
||||
*/
|
||||
option: function (formElement) {
|
||||
var raw = format.generic(formElement);
|
||||
|
||||
if (hasHtmlChildren(formElement) && formElement.childNodes.length > 0) {
|
||||
return raw;
|
||||
}
|
||||
|
||||
raw = raw.replace($whiteSpacePattern, '');
|
||||
return raw.replace($optionClosingTagPattern, ' />');
|
||||
},
|
||||
/**
|
||||
* Format the display of elements without specific formatting methods
|
||||
*
|
||||
* @param {HTMLElement} formElement
|
||||
* @return {string}
|
||||
*/
|
||||
generic: function (formElement) {
|
||||
return formElement.outerHTML.trim();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Format the current element
|
||||
*
|
||||
* @param {HTMLElement} formElement
|
||||
* @param {number} i
|
||||
* @return string
|
||||
*/
|
||||
function formatElement (formElement, i) {
|
||||
var elementPrefix = (i > 0)
|
||||
? '{n}' + '{t}'.repeat(i)
|
||||
: '';
|
||||
|
||||
if (formElement.nodeType === 3) {
|
||||
return elementPrefix + formElement.nodeValue;
|
||||
}
|
||||
|
||||
var tagName = formElement.tagName.toLowerCase();
|
||||
var formattingMethod = (Object.keys(format).indexOf(tagName) !== -1)
|
||||
? format[tagName]
|
||||
: format.generic;
|
||||
|
||||
return elementPrefix + formattingMethod(formElement);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether an element has an other elements as children
|
||||
*
|
||||
* @param {HTMLElement} element
|
||||
* @return {boolean}
|
||||
*/
|
||||
function hasHtmlChildren (element) {
|
||||
var x = 0;
|
||||
var node;
|
||||
var numChildren = element.childNodes.length;
|
||||
|
||||
if (numChildren === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (; x < numChildren; x++) {
|
||||
node = element.childNodes.item(x);
|
||||
|
||||
// Only count as a child if the node is an element
|
||||
if (node.nodeType === 1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursively format the form elements for better alignment
|
||||
*
|
||||
* @param {HTMLElement} formElement
|
||||
* @param {number} level
|
||||
* @return {string}
|
||||
*/
|
||||
function formatHtml(formElement, level) {
|
||||
level = level || 0;
|
||||
|
||||
var children = $.toArray(formElement.childNodes);
|
||||
var hasChildren = hasHtmlChildren(formElement);
|
||||
|
||||
var rawChildren = formElement.innerHTML;
|
||||
var formattedHTML = formatElement(formElement, level);
|
||||
|
||||
// If there are no children, just return the formatted element
|
||||
if (!hasChildren) {
|
||||
return formattedHTML;
|
||||
}
|
||||
|
||||
children = children.filter(function (node) {
|
||||
// Discard text nodes if they only contain whitespace
|
||||
if (node.nodeType === 3 && node.nodeValue.match($whiteSpacePattern)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Keep other nodes
|
||||
return true;
|
||||
});
|
||||
|
||||
level++;
|
||||
var newChildrenHTML = children.reduce(function (prevHTML, node) {
|
||||
return prevHTML + formatHtml(node, level);
|
||||
}, '');
|
||||
|
||||
// Format those closing tags
|
||||
if (level > 0 && hasChildren) {
|
||||
newChildrenHTML += '{n}' + '{t}'.repeat(level - 1);
|
||||
}
|
||||
|
||||
formattedHTML = formattedHTML.replace(rawChildren, newChildrenHTML);
|
||||
|
||||
return formattedHTML;
|
||||
}
|
||||
|
||||
// Get each form field's html and syntax highlight it
|
||||
$.getByClass('form-field').forEach(function(parent) {
|
||||
// Setup up the highligher
|
||||
var hl = new DlHighlight({lang: 'html'});
|
||||
|
||||
var labelHTML = formatHtml($.qs('label', parent), 0);
|
||||
var formElements = $.qsa('button, input, datalist, keygen, meter, output, progress, select, textarea', parent);
|
||||
|
||||
var formElementHTML = '';
|
||||
formElements.forEach(function (formElement) {
|
||||
formElementHTML += '{n}{n}' + formatHtml(formElement, 0);
|
||||
});
|
||||
|
||||
// Join the label markup with the form element markup
|
||||
var formCode = labelHTML + formElementHTML.trim();
|
||||
|
||||
// Now replace the placeholders with proper whitespace equvalent markup
|
||||
var highLighted = hl.doItNow(formCode);
|
||||
highLighted = $.replaceMultiple(highLighted, [
|
||||
[$newLinePattern, '<br />'],
|
||||
[$spacePattern, ' '],
|
||||
[$tabPattern, ' '.repeat(4)]
|
||||
]);
|
||||
|
||||
// Piece together the HTML for the prettier HTML examples
|
||||
var codeElement = document.createElement('code');
|
||||
codeElement.className = 'DlHighlight html';
|
||||
codeElement.innerHTML = highLighted;
|
||||
|
||||
// Append the prettified HTML to the parent element
|
||||
parent.appendChild(codeElement);
|
||||
});
|
||||
|
||||
}(doc));
|
76
src/polyfills/Array.from.js
Normal file
76
src/polyfills/Array.from.js
Normal file
@ -0,0 +1,76 @@
|
||||
// Production steps of ECMA-262, Edition 6, 22.1.2.1
|
||||
// Reference: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from
|
||||
Array.from = (function () {
|
||||
var toStr = Object.prototype.toString;
|
||||
var isCallable = function (fn) {
|
||||
return typeof fn === 'function' || toStr.call(fn) === '[object Function]';
|
||||
};
|
||||
var toInteger = function (value) {
|
||||
var number = Number(value);
|
||||
if (isNaN(number)) { return 0; }
|
||||
if (number === 0 || !isFinite(number)) { return number; }
|
||||
return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));
|
||||
};
|
||||
var maxSafeInteger = Math.pow(2, 53) - 1;
|
||||
var toLength = function (value) {
|
||||
var len = toInteger(value);
|
||||
return Math.min(Math.max(len, 0), maxSafeInteger);
|
||||
};
|
||||
|
||||
// The length property of the from method is 1.
|
||||
return function from(arrayLike/*, mapFn, thisArg */) {
|
||||
// 1. Let C be the this value.
|
||||
var C = this;
|
||||
|
||||
// 2. Let items be ToObject(arrayLike).
|
||||
var items = Object(arrayLike);
|
||||
|
||||
// 3. ReturnIfAbrupt(items).
|
||||
if (arrayLike == null) {
|
||||
throw new TypeError("Array.from requires an array-like object - not null or undefined");
|
||||
}
|
||||
|
||||
// 4. If mapfn is undefined, then let mapping be false.
|
||||
var mapFn = arguments.length > 1 ? arguments[1] : void undefined;
|
||||
var T;
|
||||
if (typeof mapFn !== 'undefined') {
|
||||
// 5. else
|
||||
// 5. a If IsCallable(mapfn) is false, throw a TypeError exception.
|
||||
if (!isCallable(mapFn)) {
|
||||
throw new TypeError('Array.from: when provided, the second argument must be a function');
|
||||
}
|
||||
|
||||
// 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
||||
if (arguments.length > 2) {
|
||||
T = arguments[2];
|
||||
}
|
||||
}
|
||||
|
||||
// 10. Let lenValue be Get(items, "length").
|
||||
// 11. Let len be ToLength(lenValue).
|
||||
var len = toLength(items.length);
|
||||
|
||||
// 13. If IsConstructor(C) is true, then
|
||||
// 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.
|
||||
// 14. a. Else, Let A be ArrayCreate(len).
|
||||
var A = isCallable(C) ? Object(new C(len)) : new Array(len);
|
||||
|
||||
// 16. Let k be 0.
|
||||
var k = 0;
|
||||
// 17. Repeat, while k < len… (also steps a - h)
|
||||
var kValue;
|
||||
while (k < len) {
|
||||
kValue = items[k];
|
||||
if (mapFn) {
|
||||
A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);
|
||||
} else {
|
||||
A[k] = kValue;
|
||||
}
|
||||
k += 1;
|
||||
}
|
||||
// 18. Let putStatus be Put(A, "length", len, true).
|
||||
A.length = len;
|
||||
// 20. Return A.
|
||||
return A;
|
||||
};
|
||||
}());
|
3
src/polyfills/Array.isArray.js
Normal file
3
src/polyfills/Array.isArray.js
Normal file
@ -0,0 +1,3 @@
|
||||
Array.isArray = function(arg) {
|
||||
return Object.prototype.toString.call(arg) === '[object Array]';
|
||||
};
|
61
src/polyfills/Array.prototype.every.js
Normal file
61
src/polyfills/Array.prototype.every.js
Normal file
@ -0,0 +1,61 @@
|
||||
Array.prototype.every = function(callbackfn, thisArg) {
|
||||
'use strict';
|
||||
var T, k;
|
||||
|
||||
if (this == null) {
|
||||
throw new TypeError('this is null or not defined');
|
||||
}
|
||||
|
||||
// 1. Let O be the result of calling ToObject passing the this
|
||||
// value as the argument.
|
||||
var O = Object(this);
|
||||
|
||||
// 2. Let lenValue be the result of calling the Get internal method
|
||||
// of O with the argument "length".
|
||||
// 3. Let len be ToUint32(lenValue).
|
||||
var len = O.length >>> 0;
|
||||
|
||||
// 4. If IsCallable(callbackfn) is false, throw a TypeError exception.
|
||||
if (typeof callbackfn !== 'function') {
|
||||
throw new TypeError();
|
||||
}
|
||||
|
||||
// 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
||||
if (arguments.length > 1) {
|
||||
T = thisArg;
|
||||
}
|
||||
|
||||
// 6. Let k be 0.
|
||||
k = 0;
|
||||
|
||||
// 7. Repeat, while k < len
|
||||
while (k < len) {
|
||||
|
||||
var kValue;
|
||||
|
||||
// a. Let Pk be ToString(k).
|
||||
// This is implicit for LHS operands of the in operator
|
||||
// b. Let kPresent be the result of calling the HasProperty internal
|
||||
// method of O with argument Pk.
|
||||
// This step can be combined with c
|
||||
// c. If kPresent is true, then
|
||||
if (k in O) {
|
||||
|
||||
// i. Let kValue be the result of calling the Get internal method
|
||||
// of O with argument Pk.
|
||||
kValue = O[k];
|
||||
|
||||
// ii. Let testResult be the result of calling the Call internal method
|
||||
// of callbackfn with T as the this value and argument list
|
||||
// containing kValue, k, and O.
|
||||
var testResult = callbackfn.call(T, kValue, k, O);
|
||||
|
||||
// iii. If ToBoolean(testResult) is false, return false.
|
||||
if (!testResult) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
k++;
|
||||
}
|
||||
return true;
|
||||
};
|
32
src/polyfills/Array.prototype.filter.js
Normal file
32
src/polyfills/Array.prototype.filter.js
Normal file
@ -0,0 +1,32 @@
|
||||
Array.prototype.filter = function(fun/*, thisArg*/) {
|
||||
'use strict';
|
||||
|
||||
if (this === void 0 || this === null) {
|
||||
throw new TypeError();
|
||||
}
|
||||
|
||||
var t = Object(this);
|
||||
var len = t.length >>> 0;
|
||||
if (typeof fun !== 'function') {
|
||||
throw new TypeError();
|
||||
}
|
||||
|
||||
var res = [];
|
||||
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (i in t) {
|
||||
var val = t[i];
|
||||
|
||||
// NOTE: Technically this should Object.defineProperty at
|
||||
// the next index, as push can be affected by
|
||||
// properties on Object.prototype and Array.prototype.
|
||||
// But that method's new, and collisions should be
|
||||
// rare, so use the more-compatible alternative.
|
||||
if (fun.call(thisArg, val, i, t)) {
|
||||
res.push(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
};
|
58
src/polyfills/Array.prototype.forEach.js
Normal file
58
src/polyfills/Array.prototype.forEach.js
Normal file
@ -0,0 +1,58 @@
|
||||
Array.prototype.forEach = function(callback, thisArg) {
|
||||
|
||||
var T, k;
|
||||
|
||||
if (this === null) {
|
||||
throw new TypeError(' this is null or not defined');
|
||||
}
|
||||
|
||||
// 1. Let O be the result of calling toObject() passing the
|
||||
// |this| value as the argument.
|
||||
var O = Object(this);
|
||||
|
||||
// 2. Let lenValue be the result of calling the Get() internal
|
||||
// method of O with the argument "length".
|
||||
// 3. Let len be toUint32(lenValue).
|
||||
var len = O.length >>> 0;
|
||||
|
||||
// 4. If isCallable(callback) is false, throw a TypeError exception.
|
||||
// See: http://es5.github.com/#x9.11
|
||||
if (typeof callback !== "function") {
|
||||
throw new TypeError(callback + ' is not a function');
|
||||
}
|
||||
|
||||
// 5. If thisArg was supplied, let T be thisArg; else let
|
||||
// T be undefined.
|
||||
if (arguments.length > 1) {
|
||||
T = thisArg;
|
||||
}
|
||||
|
||||
// 6. Let k be 0
|
||||
k = 0;
|
||||
|
||||
// 7. Repeat, while k < len
|
||||
while (k < len) {
|
||||
|
||||
var kValue;
|
||||
|
||||
// a. Let Pk be ToString(k).
|
||||
// This is implicit for LHS operands of the in operator
|
||||
// b. Let kPresent be the result of calling the HasProperty
|
||||
// internal method of O with argument Pk.
|
||||
// This step can be combined with c
|
||||
// c. If kPresent is true, then
|
||||
if (k in O) {
|
||||
|
||||
// i. Let kValue be the result of calling the Get internal
|
||||
// method of O with argument Pk.
|
||||
kValue = O[k];
|
||||
|
||||
// ii. Call the Call internal method of callback with T as
|
||||
// the this value and argument list containing kValue, k, and O.
|
||||
callback.call(T, kValue, k, O);
|
||||
}
|
||||
// d. Increase k by 1.
|
||||
k++;
|
||||
}
|
||||
// 8. return undefined
|
||||
};
|
30
src/polyfills/Array.prototype.includes.js
Normal file
30
src/polyfills/Array.prototype.includes.js
Normal file
@ -0,0 +1,30 @@
|
||||
Array.prototype.includes = function(searchElement /*, fromIndex*/) {
|
||||
'use strict';
|
||||
if (this == null) {
|
||||
throw new TypeError('Array.prototype.includes called on null or undefined');
|
||||
}
|
||||
|
||||
var O = Object(this);
|
||||
var len = parseInt(O.length, 10) || 0;
|
||||
if (len === 0) {
|
||||
return false;
|
||||
}
|
||||
var n = parseInt(arguments[1], 10) || 0;
|
||||
var k;
|
||||
if (n >= 0) {
|
||||
k = n;
|
||||
} else {
|
||||
k = len + n;
|
||||
if (k < 0) {k = 0;}
|
||||
}
|
||||
var currentElement;
|
||||
while (k < len) {
|
||||
currentElement = O[k];
|
||||
if (searchElement === currentElement ||
|
||||
(searchElement !== searchElement && currentElement !== currentElement)) { // NaN !== NaN
|
||||
return true;
|
||||
}
|
||||
k++;
|
||||
}
|
||||
return false;
|
||||
};
|
84
src/polyfills/Array.prototype.map.js
Normal file
84
src/polyfills/Array.prototype.map.js
Normal file
@ -0,0 +1,84 @@
|
||||
Array.prototype.map = function(callback, thisArg) {
|
||||
|
||||
var T, A, k;
|
||||
|
||||
if (this == null) {
|
||||
throw new TypeError(' this is null or not defined');
|
||||
}
|
||||
|
||||
// 1. Let O be the result of calling ToObject passing the |this|
|
||||
// value as the argument.
|
||||
var O = Object(this);
|
||||
|
||||
// 2. Let lenValue be the result of calling the Get internal
|
||||
// method of O with the argument "length".
|
||||
// 3. Let len be ToUint32(lenValue).
|
||||
var len = O.length >>> 0;
|
||||
|
||||
// 4. If IsCallable(callback) is false, throw a TypeError exception.
|
||||
// See: http://es5.github.com/#x9.11
|
||||
if (typeof callback !== 'function') {
|
||||
throw new TypeError(callback + ' is not a function');
|
||||
}
|
||||
|
||||
// 5. If thisArg was supplied, let T be thisArg; else let T be undefined.
|
||||
if (arguments.length > 1) {
|
||||
T = thisArg;
|
||||
}
|
||||
|
||||
// 6. Let A be a new array created as if by the expression new Array(len)
|
||||
// where Array is the standard built-in constructor with that name and
|
||||
// len is the value of len.
|
||||
A = new Array(len);
|
||||
|
||||
// 7. Let k be 0
|
||||
k = 0;
|
||||
|
||||
// 8. Repeat, while k < len
|
||||
while (k < len) {
|
||||
|
||||
var kValue, mappedValue;
|
||||
|
||||
// a. Let Pk be ToString(k).
|
||||
// This is implicit for LHS operands of the in operator
|
||||
// b. Let kPresent be the result of calling the HasProperty internal
|
||||
// method of O with argument Pk.
|
||||
// This step can be combined with c
|
||||
// c. If kPresent is true, then
|
||||
if (k in O) {
|
||||
|
||||
// i. Let kValue be the result of calling the Get internal
|
||||
// method of O with argument Pk.
|
||||
kValue = O[k];
|
||||
|
||||
// ii. Let mappedValue be the result of calling the Call internal
|
||||
// method of callback with T as the this value and argument
|
||||
// list containing kValue, k, and O.
|
||||
mappedValue = callback.call(T, kValue, k, O);
|
||||
|
||||
// iii. Call the DefineOwnProperty internal method of A with arguments
|
||||
// Pk, Property Descriptor
|
||||
// { Value: mappedValue,
|
||||
// Writable: true,
|
||||
// Enumerable: true,
|
||||
// Configurable: true },
|
||||
// and false.
|
||||
|
||||
// In browsers that support Object.defineProperty, use the following:
|
||||
// Object.defineProperty(A, k, {
|
||||
// value: mappedValue,
|
||||
// writable: true,
|
||||
// enumerable: true,
|
||||
// configurable: true
|
||||
// });
|
||||
|
||||
// For best browser support, use the following:
|
||||
A[k] = mappedValue;
|
||||
}
|
||||
// d. Increase k by 1.
|
||||
k++;
|
||||
}
|
||||
|
||||
// 9. return A
|
||||
return A;
|
||||
};
|
27
src/polyfills/Array.prototype.reduce.js
Normal file
27
src/polyfills/Array.prototype.reduce.js
Normal file
@ -0,0 +1,27 @@
|
||||
Array.prototype.reduce = function(callback /*, initialValue*/) {
|
||||
'use strict';
|
||||
if (this === null) {
|
||||
throw new TypeError('Array.prototype.reduce called on null or undefined');
|
||||
}
|
||||
if (typeof callback !== 'function') {
|
||||
throw new TypeError(callback + ' is not a function');
|
||||
}
|
||||
var t = Object(this), len = t.length >>> 0, k = 0, value;
|
||||
if (arguments.length == 2) {
|
||||
value = arguments[1];
|
||||
} else {
|
||||
while (k < len && !(k in t)) {
|
||||
k++;
|
||||
}
|
||||
if (k >= len) {
|
||||
throw new TypeError('Reduce of empty array with no initial value');
|
||||
}
|
||||
value = t[k++];
|
||||
}
|
||||
for (; k < len; k++) {
|
||||
if (k in t) {
|
||||
value = callback(value, t[k], k, t);
|
||||
}
|
||||
}
|
||||
return value;
|
||||
};
|
12
src/polyfills/String.prototype.includes.js
Normal file
12
src/polyfills/String.prototype.includes.js
Normal file
@ -0,0 +1,12 @@
|
||||
String.prototype.includes = function(search, start) {
|
||||
'use strict';
|
||||
if (typeof start !== 'number') {
|
||||
start = 0;
|
||||
}
|
||||
|
||||
if (start + search.length > this.length) {
|
||||
return false;
|
||||
} else {
|
||||
return this.indexOf(search, start) !== -1;
|
||||
}
|
||||
};
|
41
src/polyfills/String.prototype.repeat.js
Normal file
41
src/polyfills/String.prototype.repeat.js
Normal file
@ -0,0 +1,41 @@
|
||||
String.prototype.repeat = function(count) {
|
||||
'use strict';
|
||||
if (this == null) {
|
||||
throw new TypeError('can\'t convert ' + this + ' to object');
|
||||
}
|
||||
var str = '' + this;
|
||||
count = +count;
|
||||
if (count != count) {
|
||||
count = 0;
|
||||
}
|
||||
if (count < 0) {
|
||||
throw new RangeError('repeat count must be non-negative');
|
||||
}
|
||||
if (count == Infinity) {
|
||||
throw new RangeError('repeat count must be less than infinity');
|
||||
}
|
||||
count = Math.floor(count);
|
||||
if (str.length == 0 || count == 0) {
|
||||
return '';
|
||||
}
|
||||
// Ensuring count is a 31-bit integer allows us to heavily optimize the
|
||||
// main part. But anyway, most current (August 2014) browsers can't handle
|
||||
// strings 1 << 28 chars or longer, so:
|
||||
if (str.length * count >= 1 << 28) {
|
||||
throw new RangeError('repeat count must not overflow maximum string size');
|
||||
}
|
||||
var rpt = '';
|
||||
for (;;) {
|
||||
if ((count & 1) == 1) {
|
||||
rpt += str;
|
||||
}
|
||||
count >>>= 1;
|
||||
if (count == 0) {
|
||||
break;
|
||||
}
|
||||
str += str;
|
||||
}
|
||||
// Could we try:
|
||||
// return Array(count + 1).join(this);
|
||||
return rpt;
|
||||
}
|
3
src/polyfills/String.prototype.trim.js
Normal file
3
src/polyfills/String.prototype.trim.js
Normal file
@ -0,0 +1,3 @@
|
||||
String.prototype.trim = function () {
|
||||
return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
|
||||
};
|
15
tools/min-all.js
Normal file
15
tools/min-all.js
Normal file
@ -0,0 +1,15 @@
|
||||
const glob = require('glob');
|
||||
const minify = require('./min');
|
||||
|
||||
// Minify the polyfills
|
||||
const ESpolyfills = glob.sync('src/polyfills/*.js');
|
||||
ESpolyfills.forEach(inFile => {
|
||||
const outFile = inFile.replace('src/polyfills/', 'js/polyfills/EcmaScript/');
|
||||
minify(inFile, outFile);
|
||||
});
|
||||
|
||||
// Minify outerHTML polyfill
|
||||
minify('js/polyfills/Dom/Element.outerHTML.js', 'js/polyfills/Dom/Element.outerHTML.min.js');
|
||||
|
||||
// Minify the javascript loader script
|
||||
minify('src/load-scripts.js', 'js/load-scripts.js');
|
3
tools/min-loader.js
Normal file
3
tools/min-loader.js
Normal file
@ -0,0 +1,3 @@
|
||||
const minify = require('./min');
|
||||
// Minify the javascript loader script
|
||||
minify('src/load-scripts.js', 'js/load-scripts.js');
|
41
tools/min.js
Normal file
41
tools/min.js
Normal file
@ -0,0 +1,41 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const ClosureCompiler = require('google-closure-compiler').compiler;
|
||||
|
||||
/**
|
||||
* Minify a javascript file
|
||||
*
|
||||
* @param {string} inputFile
|
||||
* @param {string} outputFile
|
||||
* @param {object} options
|
||||
*/
|
||||
module.exports = function minify(inFile, outFile, options) {
|
||||
const defaultOptions = {
|
||||
js: inFile,
|
||||
js_output_file: outFile,
|
||||
compilation_level: 'ADVANCED',
|
||||
language_in: 'ECMASCRIPT5',
|
||||
language_out: 'ECMASCRIPT5',
|
||||
warning_level: 'VERBOSE',
|
||||
create_source_map: `${outFile}.map`,
|
||||
rewrite_polyfills: false
|
||||
};
|
||||
|
||||
options = options || {};
|
||||
Object.keys(options).forEach(opt => {
|
||||
defaultOptions[opt] = options[opt];
|
||||
});
|
||||
|
||||
const compiler = new ClosureCompiler(defaultOptions);
|
||||
|
||||
compiler.run((exitCode, stdOut, stdErr) => {
|
||||
if (stdErr) {
|
||||
console.error(stdErr);
|
||||
} else {
|
||||
console.log(stdOut);
|
||||
}
|
||||
|
||||
// Append the source map maping line to the minified file
|
||||
fs.appendFileSync(outFile, '//# sourceMappingURL=' + path.basename(outFile) + '.map');
|
||||
});
|
||||
};
|
Loading…
Reference in New Issue
Block a user