├── .gitignore
├── BUILDING.md
├── CNAME
├── LICENSE
├── README.md
├── coffee
└── index.coffee
├── comparisons
├── components
│ ├── image_slider
│ │ ├── a11y.txt
│ │ ├── caniuse.txt
│ │ ├── codepen.html
│ │ ├── demo.html
│ │ ├── html.html
│ │ ├── resources.txt
│ │ └── scss.scss
│ ├── modal
│ │ ├── a11y.txt
│ │ ├── codepen.html
│ │ ├── demo.html
│ │ ├── html.html
│ │ ├── resources.txt
│ │ └── scss.scss
│ └── view_switcher
│ │ ├── a11y.txt
│ │ ├── caniuse.txt
│ │ ├── codepen.html
│ │ ├── demo.html
│ │ ├── html.html
│ │ ├── resources.txt
│ │ └── scss.scss
├── forms
│ ├── color_picker
│ │ ├── a11y.txt
│ │ ├── caniuse.txt
│ │ ├── codepen.html
│ │ ├── demo.html
│ │ └── html.html
│ ├── file_upload
│ │ ├── a11y.txt
│ │ ├── codepen.html
│ │ ├── demo.html
│ │ └── html.html
│ ├── form_validation
│ │ ├── a11y.txt
│ │ ├── caniuse.txt
│ │ ├── codepen.html
│ │ ├── demo.html
│ │ ├── html.html
│ │ └── resources.txt
│ └── resources.txt
├── interactions
│ └── scroll_indicator
│ │ ├── a11y.txt
│ │ ├── caniuse.txt
│ │ ├── codepen.html
│ │ ├── demo.html
│ │ ├── html.html
│ │ ├── resources.txt
│ │ └── scss.scss
└── navigation
│ ├── accordion
│ ├── a11y.txt
│ ├── caniuse.txt
│ ├── codepen.html
│ ├── demo.html
│ ├── html.html
│ ├── resources.txt
│ └── scss.scss
│ ├── lightbox
│ ├── a11y.txt
│ ├── codepen.html
│ ├── demo.html
│ ├── html.html
│ ├── resources.txt
│ └── scss.scss
│ └── tabs
│ ├── a11y.txt
│ ├── codepen.html
│ ├── demo.html
│ ├── html.html
│ ├── resources.txt
│ └── scss.scss
├── css
├── index.css
└── prism.css
├── gulpfile.coffee
├── gulpfile.js
├── index.html
├── jade
├── _caniuse.jade
├── _resources.jade
└── index.jade
├── js
├── index.js
└── prism.js
├── package.json
├── readTree.coffee
├── shareimg.jpg
└── styl
└── index.styl
/.gitignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .DS_Store
3 |
--------------------------------------------------------------------------------
/BUILDING.md:
--------------------------------------------------------------------------------
1 | Building YMNNJQ requires Node.js
2 |
3 | - Run: `npm install -g gulp`
4 | - In the project directory, run `npm install`
5 | - To build/watch, run `gulp`
6 |
7 | Please make all changes in the jade, coffee, styl, and comparisons folders, the rest are built files.
8 |
9 | To add a new section, just create a folder for it, and add `jquery.js`, and `ie8.js`, `ie9.js` and `ie10.js` as needed. For example, if you have `ie8.js` and `ie9.js`, the ie9 version will be shown to people looking for a solution that works in ie9 or 10.
10 |
--------------------------------------------------------------------------------
/CNAME:
--------------------------------------------------------------------------------
1 | youmightnotneedjs.com
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014 HubSpot, Inc.
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
9 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # You Might Not Need JavaScript
2 |
3 | A fork of [YouMightNotNeedjQuery.com](http://youmightnotneedjquery.com). You might not need scripts at all.
4 |
5 | ### [YouMightNotNeedJs.com](http://youmightnotneedjs.com)
6 |
7 | To contribute, please open an issue and/or submit a Pull Request referencing the issue.
8 |
9 | File Structure:
10 |
11 | - `index.jade` = Jade code layout
12 | - `index.styl` = Stylus styling
13 | - `comparisons/` = folder containing comparison items and topics
14 | - Individual subtopics are inside of comparisons. Each has:
15 | - `html.html` = markup
16 | - `scss.scss` or `css.css` = css
17 | - `resources.txt` = resource list
--------------------------------------------------------------------------------
/coffee/index.coffee:
--------------------------------------------------------------------------------
1 | showFirst = (els...) ->
2 | found = false
3 |
4 | for el in els
5 | if el and not found
6 | found = true
7 | el.style.display = 'block'
8 | else if el
9 | el.style.display = 'none'
10 |
11 | hide = (els...) ->
12 | for el in els when el
13 | el.style.display = 'none'
14 |
15 | filter = (term) ->
16 | visibleIndex = 0
17 |
18 | allEmpty = true
19 |
20 | for section in document.querySelectorAll('section')
21 | empty = true
22 |
23 | for comp in section.querySelectorAll('.comparison')
24 | if not term or comp.textContent.toLowerCase().indexOf(term.toLowerCase()) isnt -1
25 | empty = false
26 | comp.classList.remove 'hidden'
27 | else
28 | comp.classList.add 'hidden'
29 |
30 | if empty
31 | section.classList.add 'hidden'
32 | else
33 | allEmpty = false
34 |
35 | section.classList.remove 'hidden'
36 |
37 | if ++visibleIndex % 2
38 | section.classList.add 'odd'
39 | else
40 | section.classList.remove 'odd'
41 |
42 | comparisons = document.querySelector('.comparisons')
43 | if allEmpty
44 | comparisons.classList.add 'empty'
45 | else
46 | comparisons.classList.remove 'empty'
47 |
48 | document.addEventListener 'DOMContentLoaded', ->
49 | search = document.querySelector('input[type="search"]')
50 |
51 | search.addEventListener 'input', ->
52 | filter search.value
--------------------------------------------------------------------------------
/comparisons/components/image_slider/a11y.txt:
--------------------------------------------------------------------------------
1 | Usage: Presentational, Option to read or be skipped by screen reader, no user control over images.
--------------------------------------------------------------------------------
/comparisons/components/image_slider/caniuse.txt:
--------------------------------------------------------------------------------
1 | CSS Animation: http://caniuse.com/#feat=css-animation
2 | Will Change: http://caniuse.com/#feat=will-change
3 | Transform: http://caniuse.com/#feat=transforms2d
--------------------------------------------------------------------------------
/comparisons/components/image_slider/codepen.html:
--------------------------------------------------------------------------------
1 |
See the Pen CSS-Only Slider: youmightnotneedjs.com by Una Kravets (@una ) on CodePen .
--------------------------------------------------------------------------------
/comparisons/components/image_slider/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Document
6 |
86 |
87 |
88 |
95 |
96 |
--------------------------------------------------------------------------------
/comparisons/components/image_slider/html.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
content1
4 |
content2
5 |
content3
6 |
7 |
8 |
--------------------------------------------------------------------------------
/comparisons/components/image_slider/resources.txt:
--------------------------------------------------------------------------------
1 | CSS Slider Builder: http://cssslider.com/
2 | 12 CSS Slider Examples: http://xdesigns.net/2013/08/css-slider/
3 | CSS Gallery: http://benschwarz.github.io/gallery-css/
--------------------------------------------------------------------------------
/comparisons/components/image_slider/scss.scss:
--------------------------------------------------------------------------------
1 | #slider {
2 | width: $slide-width;
3 | height: $slide-height;
4 | overflow: hidden;
5 | }
6 |
7 | .slide {
8 | width: $slide-width;
9 | height: $slide-height;
10 | float: left;
11 | position: relative;
12 | }
13 |
14 | #slide-holder {
15 | // wide enough to fit all the slides
16 | width: 400%;
17 | position: relative;
18 | left: 0;
19 | will-change: transform;
20 | animation: scroller 10s infinite;
21 | }
22 |
23 | // need a step for each slide
24 | @keyframes scroller {
25 | 0% { transform: translateX(0); }
26 | 33% { transform: translateX(-$slide-width); }
27 | 66% { transform: translateX(-$slide-width*2); }
28 | 100% { transform: translateX(0); }
29 | }
30 |
--------------------------------------------------------------------------------
/comparisons/components/modal/a11y.txt:
--------------------------------------------------------------------------------
1 | Usage: Safe for production with caveat (see scss) — Shoutout to Marcy Sutton
--------------------------------------------------------------------------------
/comparisons/components/modal/codepen.html:
--------------------------------------------------------------------------------
1 | See the Pen CSS-Only Modal: youmightnotneedjs.com by Una Kravets (@una ) on CodePen .
2 |
--------------------------------------------------------------------------------
/comparisons/components/modal/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Document
6 |
94 |
95 |
96 | Click Me
97 |
98 |
×
99 |
Hello Beautiful!
100 |
101 |
102 |
--------------------------------------------------------------------------------
/comparisons/components/modal/html.html:
--------------------------------------------------------------------------------
1 |
3 | Open dialog
4 |
5 |
6 |
8 |
14 |
15 |
--------------------------------------------------------------------------------
/comparisons/components/modal/resources.txt:
--------------------------------------------------------------------------------
1 | Austin Lord's CodePen: http://codepen.io/ohnoitsaustin/pen/zGmJjz
2 | Simple Example by Daniel Griffith: http://codepen.io/danielgriffiths/pen/AXGOym
--------------------------------------------------------------------------------
/comparisons/components/modal/scss.scss:
--------------------------------------------------------------------------------
1 | // Modal hidden until it matches an anchor target
2 | // Note: you can't close it with the escape key
3 | // or trap focus inside of it.
4 | .modal {
5 | opacity: 0;
6 | visibility: hidden;
7 | }
8 |
9 | // modal fades in when it matches
10 | // an anchor link (i.e. clicked on)
11 | #modalDialog:target {
12 | opacity: 1;
13 | visibility: hidden;
14 | }
--------------------------------------------------------------------------------
/comparisons/components/view_switcher/a11y.txt:
--------------------------------------------------------------------------------
1 | Usage: Presentational: keyboard navigable, not screen reader accessible.
--------------------------------------------------------------------------------
/comparisons/components/view_switcher/caniuse.txt:
--------------------------------------------------------------------------------
1 | Transition: http://caniuse.com/#feat=css-transitions
--------------------------------------------------------------------------------
/comparisons/components/view_switcher/codepen.html:
--------------------------------------------------------------------------------
1 | See the Pen CSS-Only Image Switcher: youmightnotneedjs.com by Una Kravets (@una ) on CodePen .
--------------------------------------------------------------------------------
/comparisons/components/view_switcher/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Document
6 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 | 1
93 | 2
94 | 3
95 | 4
96 |
97 |
98 |
99 |
--------------------------------------------------------------------------------
/comparisons/components/view_switcher/html.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | 1
12 | 2
13 | 3
14 | 4
15 |
16 |
17 |
--------------------------------------------------------------------------------
/comparisons/components/view_switcher/resources.txt:
--------------------------------------------------------------------------------
1 | CSS Image Switcher Tutorial: http://css3.bradshawenterprises.com/cfimg/
2 | Tiffany Tse CSS Slider: http://codepen.io/tiffanytse/pen/BnDlb
--------------------------------------------------------------------------------
/comparisons/components/view_switcher/scss.scss:
--------------------------------------------------------------------------------
1 | #slider {
2 | img {
3 | position: absolute;
4 | top: 0;
5 | left: 0;
6 | width: 300px;
7 | height: 200px;
8 |
9 | &:target {
10 | transition: all .5s ease-in-out;
11 | }
12 |
13 | &:not(:target),
14 | &:target ~ img#slide-4 {
15 | position: relative;
16 | opacity: 0;
17 | }
18 |
19 | // set initially visible
20 | slide-4 {
21 | position: absolute;
22 | opacity: 1;
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/comparisons/forms/color_picker/a11y.txt:
--------------------------------------------------------------------------------
1 | Usage: Safe for production.
--------------------------------------------------------------------------------
/comparisons/forms/color_picker/caniuse.txt:
--------------------------------------------------------------------------------
1 | Color Input Type: http://caniuse.com/#feat=input-color
--------------------------------------------------------------------------------
/comparisons/forms/color_picker/codepen.html:
--------------------------------------------------------------------------------
1 | See the Pen HTML File Upload: youmightnotneedjs.com by Una Kravets (@una ) on CodePen .
2 |
--------------------------------------------------------------------------------
/comparisons/forms/color_picker/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Document
6 |
29 |
30 |
31 |
35 |
36 |
--------------------------------------------------------------------------------
/comparisons/forms/color_picker/html.html:
--------------------------------------------------------------------------------
1 |
4 |
--------------------------------------------------------------------------------
/comparisons/forms/file_upload/a11y.txt:
--------------------------------------------------------------------------------
1 | Usage: Safe for production.
--------------------------------------------------------------------------------
/comparisons/forms/file_upload/codepen.html:
--------------------------------------------------------------------------------
1 | See the Pen HTML File Upload: youmightnotneedjs.com by Una Kravets (@una ) on CodePen .
--------------------------------------------------------------------------------
/comparisons/forms/file_upload/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Document
6 |
29 |
30 |
31 |
35 |
36 |
--------------------------------------------------------------------------------
/comparisons/forms/file_upload/html.html:
--------------------------------------------------------------------------------
1 |
5 |
--------------------------------------------------------------------------------
/comparisons/forms/form_validation/a11y.txt:
--------------------------------------------------------------------------------
1 | Usage: Safe for production.
--------------------------------------------------------------------------------
/comparisons/forms/form_validation/caniuse.txt:
--------------------------------------------------------------------------------
1 | Pattern Attribute: http://caniuse.com/#feat=input-pattern
--------------------------------------------------------------------------------
/comparisons/forms/form_validation/codepen.html:
--------------------------------------------------------------------------------
1 | See the Pen HTML Form Validation: youmightnotneedjs.com by Una Kravets (@una ) on CodePen .
--------------------------------------------------------------------------------
/comparisons/forms/form_validation/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Document
6 |
29 |
30 |
31 |
58 |
59 |
--------------------------------------------------------------------------------
/comparisons/forms/form_validation/html.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Would you prefer a banana or a cherry?
6 |
7 |
8 |
9 | What's your e-mail?
10 |
11 |
12 |
13 | Leave a short message
14 |
15 |
16 |
17 | Phone Number (format: xxxx-xxx-xxxx):
18 |
19 |
20 | Submit
21 |
--------------------------------------------------------------------------------
/comparisons/forms/form_validation/resources.txt:
--------------------------------------------------------------------------------
1 | MDN Data Form Validation: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms/Data_form_validation
2 | Phone Number Validation by SitePoint: https://codepen.io/SitePoint/pen/Eambf
--------------------------------------------------------------------------------
/comparisons/forms/resources.txt:
--------------------------------------------------------------------------------
1 | HTML Form Guide: https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms
--------------------------------------------------------------------------------
/comparisons/interactions/scroll_indicator/a11y.txt:
--------------------------------------------------------------------------------
1 | Usage: Presentational, no screen reader support. Not recommended for production (mobile)
--------------------------------------------------------------------------------
/comparisons/interactions/scroll_indicator/caniuse.txt:
--------------------------------------------------------------------------------
1 | Linear Gradient: http://caniuse.com/#feat=css-gradients
2 | Viewport Units: http://caniuse.com/#feat=viewport-units
--------------------------------------------------------------------------------
/comparisons/interactions/scroll_indicator/codepen.html:
--------------------------------------------------------------------------------
1 | See the Pen CSS Only Scroll Indicator: youmightnotneedjs.com by Una Kravets (@una ) on CodePen .
--------------------------------------------------------------------------------
/comparisons/interactions/scroll_indicator/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Document
6 |
52 |
53 |
54 |
55 |
56 | Content Must Be Longer Than The Viewport Height or This Makes No Sense.
57 | Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur dolorum a natus, praesentium nesciunt recusandae excepturi qui debitis optio enim eligendi iusto quos animi. Soluta neque ad eos itaque debitis.
58 | Quidem minus deserunt reiciendis temporibus quisquam! Eaque illum eligendi, perspiciatis ea animi pariatur dolores necessitatibus aliquam quos esse autem rerum possimus culpa neque sit sapiente accusantium odio! Dicta, facilis, earum.
59 | Sequi, doloribus tempora sit odit dolorum, aliquam inventore. Qui libero ea iure velit iste impedit, corrupti est. Recusandae, est inventore explicabo quis accusamus ipsam repellendus nostrum soluta ad. Enim, voluptatem.
60 | Eum beatae placeat voluptate. Iste pariatur aspernatur expedita voluptates, eius exercitationem nisi ratione sapiente sunt sint quo nihil sit repellendus veniam provident ea debitis atque similique iure vitae fugiat. Pariatur!
61 | Dolores sunt voluptatibus qui maxime distinctio, repellendus iure animi assumenda, perferendis minima amet doloribus odit recusandae, magnam doloremque dolorum quae quas expedita ab laborum rerum mollitia. Commodi voluptatum, deleniti fugiat.
62 | Minima voluptate ut facere officiis, perferendis rem beatae et tempore aperiam debitis, vel sequi asperiores placeat repellendus fuga? Dolorem, maxime eveniet, inventore excepturi fugit molestias sed minus natus placeat numquam?
63 | Quam dignissimos saepe vero omnis quidem, voluptatum nisi consequatur fugiat, veniam quo, ea. Fuga ut ducimus, libero doloremque corporis labore voluptas nulla modi qui voluptate, alias fugit dignissimos quibusdam odit!
64 | Nisi totam nesciunt error magnam fugit enim possimus earum commodi! Nesciunt provident deserunt totam officiis cumque consequatur ex dolorem! Accusantium mollitia laboriosam beatae perferendis ab quibusdam dolor veniam nobis amet.
65 | Voluptatem voluptates officiis fuga, dolore eveniet ab praesentium doloremque numquam cum magni sapiente quaerat ea voluptatum quae explicabo similique cumque veniam id blanditiis velit itaque quidem temporibus. Illo, consequatur, doloremque.
66 | Nam, omnis. Sit, dolore quia, sunt consequatur commodi alias quo repudiandae ab, rem accusantium, in molestiae. Voluptate possimus quas fugiat totam esse dignissimos! Odit quasi accusamus, iure laudantium id corporis?
67 | Lorem ipsum dolor sit amet, consectetur adipisicing elit. Consectetur dolorum a natus, praesentium nesciunt recusandae excepturi qui debitis optio enim eligendi iusto quos animi. Soluta neque ad eos itaque debitis.
68 | Quidem minus deserunt reiciendis temporibus quisquam! Eaque illum eligendi, perspiciatis ea animi pariatur dolores necessitatibus aliquam quos esse autem rerum possimus culpa neque sit sapiente accusantium odio! Dicta, facilis, earum.
69 | Sequi, doloribus tempora sit odit dolorum, aliquam inventore. Qui libero ea iure velit iste impedit, corrupti est. Recusandae, est inventore explicabo quis accusamus ipsam repellendus nostrum soluta ad. Enim, voluptatem.
70 | Eum beatae placeat voluptate. Iste pariatur aspernatur expedita voluptates, eius exercitationem nisi ratione sapiente sunt sint quo nihil sit repellendus veniam provident ea debitis atque similique iure vitae fugiat. Pariatur!
71 | Dolores sunt voluptatibus qui maxime distinctio, repellendus iure animi assumenda, perferendis minima amet doloribus odit recusandae, magnam doloremque dolorum quae quas expedita ab laborum rerum mollitia. Commodi voluptatum, deleniti fugiat.
72 | Minima voluptate ut facere officiis, perferendis rem beatae et tempore aperiam debitis, vel sequi asperiores placeat repellendus fuga? Dolorem, maxime eveniet, inventore excepturi fugit molestias sed minus natus placeat numquam?
73 | Quam dignissimos saepe vero omnis quidem, voluptatum nisi consequatur fugiat, veniam quo, ea. Fuga ut ducimus, libero doloremque corporis labore voluptas nulla modi qui voluptate, alias fugit dignissimos quibusdam odit!
74 | Nisi totam nesciunt error magnam fugit enim possimus earum commodi! Nesciunt provident deserunt totam officiis cumque consequatur ex dolorem! Accusantium mollitia laboriosam beatae perferendis ab quibusdam dolor veniam nobis amet.
75 | Voluptatem voluptates officiis fuga, dolore eveniet ab praesentium doloremque numquam cum magni sapiente quaerat ea voluptatum quae explicabo similique cumque veniam id blanditiis velit itaque quidem temporibus. Illo, consequatur, doloremque.
76 | Nam, omnis. Sit, dolore quia, sunt consequatur commodi alias quo repudiandae ab, rem accusantium, in molestiae. Voluptate possimus quas fugiat totam esse dignissimos! Odit quasi accusamus, iure laudantium id corporis?
77 |
78 |
79 |
--------------------------------------------------------------------------------
/comparisons/interactions/scroll_indicator/html.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | content must be longer than 100vh
4 |
--------------------------------------------------------------------------------
/comparisons/interactions/scroll_indicator/resources.txt:
--------------------------------------------------------------------------------
1 | Example by Mike Riethmuller: http://codepen.io/MadeByMike/pen/ZOrEmr
--------------------------------------------------------------------------------
/comparisons/interactions/scroll_indicator/scss.scss:
--------------------------------------------------------------------------------
1 | body {
2 | background: linear-gradient(to right top,
3 | $scroller-color 50%,
4 | $scroller-background 50%);
5 | background-size: 100% calc(100% - 100vh + #{$scroller-height});
6 | background-repeat: no-repeat;
7 | }
8 |
9 | body:before {
10 | content:'';
11 | position: fixed;
12 | top: $scroller-height;
13 | bottom: 0;
14 | width: 100%;
15 | z-index: -1;
16 | background: $body-background;
17 | }
18 |
--------------------------------------------------------------------------------
/comparisons/navigation/accordion/a11y.txt:
--------------------------------------------------------------------------------
1 | Usage: Not keyboard navigable, inability to focus.
--------------------------------------------------------------------------------
/comparisons/navigation/accordion/caniuse.txt:
--------------------------------------------------------------------------------
1 | Transition: http://caniuse.com/#feat=css-transitions
--------------------------------------------------------------------------------
/comparisons/navigation/accordion/codepen.html:
--------------------------------------------------------------------------------
1 | See the Pen CSS Only Accordion: youmightnotneedjs.com by Una Kravets (@una ) on CodePen .
--------------------------------------------------------------------------------
/comparisons/navigation/accordion/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Document
6 |
54 |
55 |
56 |
57 |
58 |
Label 1
59 |
60 | Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ab ea veritatis cumque unde dolore quasi hic praesentium, in consequatur, incidunt alias iure illum facilis qui odit excepturi tenetur, error eligendi. Accusamus quasi eveniet dolorem, nihil cupiditate, facilis id quas consectetur mollitia quod minima excepturi maiores. A, molestias suscipit sunt provident libero magnam quas dolores aspernatur totam tenetur vel quis. Officia?
61 |
62 |
63 |
64 |
Label 2
65 |
66 | Lorem ipsum dolor sit amet, consectetur adipisicing elit. Autem tempora quia fugit eveniet nostrum amet quod aliquid repellendus sint. Adipisci voluptas ratione doloremque delectus vel nemo cumque autem beatae minus.
67 |
68 |
69 |
70 |
Label 3
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/comparisons/navigation/accordion/html.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Label 1
4 |
5 | Content for the first accordion
6 |
7 |
8 |
9 |
Label 2
10 |
11 | Content for the second accordion
12 |
13 |
14 |
15 |
Label 3
16 |
17 | Content for the third accordion
18 |
19 |
--------------------------------------------------------------------------------
/comparisons/navigation/accordion/resources.txt:
--------------------------------------------------------------------------------
1 | 4 Ways to Create CSS Accordions: http://www.hongkiat.com/blog/css-only-accordion/
2 | CodePen Example by Oliver Knoblich: http://codepen.io/oknoblich/pen/tKfab
--------------------------------------------------------------------------------
/comparisons/navigation/accordion/scss.scss:
--------------------------------------------------------------------------------
1 | // Visually hide radio buttons
2 | input[type="radio"] {
3 | position: absolute;
4 | opacity: 0;
5 |
6 | &:focus + label {
7 | color: black;
8 | background-color: wheat;
9 | }
10 | }
11 |
12 | // Style label/entry for accordion
13 | label {
14 | position: relative;
15 | display: block;
16 | cursor: pointer;
17 | }
18 |
19 | // Style accordion content
20 | section {
21 | height: 0;
22 | transition: .3s all;
23 | overflow: hidden;
24 | }
25 |
26 | // Open content when clicking label
27 | #toggle1:checked ~ #content1,
28 | #toggle2:checked ~ #content2,
29 | #toggle3:checked ~ #content3,
30 | #toggle4:checked ~ #content4 {
31 | // set height for transition duration to work
32 | // (also can set to auto without transition)
33 | height: 200px;
34 | }
--------------------------------------------------------------------------------
/comparisons/navigation/lightbox/a11y.txt:
--------------------------------------------------------------------------------
1 | Usage: Not keyboard navigable.
--------------------------------------------------------------------------------
/comparisons/navigation/lightbox/codepen.html:
--------------------------------------------------------------------------------
1 | See the Pen CSS Only Lightbox: youmightnotneedjs.com by Una Kravets (@una ) on CodePen .
--------------------------------------------------------------------------------
/comparisons/navigation/lightbox/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Document
6 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/comparisons/navigation/lightbox/html.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/comparisons/navigation/lightbox/resources.txt:
--------------------------------------------------------------------------------
1 | Gregory Schier's Codepen: http://codepen.io/gschier/pen/HCoqh
--------------------------------------------------------------------------------
/comparisons/navigation/lightbox/scss.scss:
--------------------------------------------------------------------------------
1 | $thumbnail-size: 40px;
2 | $background-color: black;
3 |
4 | .thumbnail {
5 | max-width: $thumbnail-size;
6 | }
7 |
8 | .lightbox {
9 | // Hide lightbox image
10 | display: none;
11 |
12 | // Position/style of lightbox
13 | position: fixed;
14 | z-index: 999;
15 | width: 100%;
16 | height: 100%;
17 | text-align: center;
18 | top: 0;
19 | left: 0;
20 | background: $background-color;
21 | }
22 |
23 | .lightbox img {
24 | /// Pad the lightbox image
25 | max-width: 90%;
26 | max-height: 80%;
27 | margin-top: 2%;
28 | }
29 |
30 | .lightbox:target {
31 | // Remove default outline and unhide lightbox
32 | outline: none;
33 | display: block;
34 | }
--------------------------------------------------------------------------------
/comparisons/navigation/tabs/a11y.txt:
--------------------------------------------------------------------------------
1 | Usage: Not keyboard navigable.
--------------------------------------------------------------------------------
/comparisons/navigation/tabs/codepen.html:
--------------------------------------------------------------------------------
1 | See the Pen KgRzRE by Una Kravets (@una ) on CodePen .
--------------------------------------------------------------------------------
/comparisons/navigation/tabs/demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Document
6 |
67 |
68 |
69 |
70 |
71 |
72 |
One
73 |
74 |
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laborum debitis dignissimos velit quasi vel! Ipsum illo vero amet cumque voluptatem accusamus dignissimos nisi quam adipisci aperiam! Temporibus necessitatibus deleniti excepturi.
75 |
76 |
77 |
78 |
79 |
80 |
Two
81 |
82 |
Hi there! Fancy seeing you here!
83 |
84 |
85 |
86 |
87 |
88 |
Three
89 |
90 |
Tempora minima itaque officia aliquid, facilis, enim atque. Quibusdam velit quo alias, laboriosam non nobis, dolorem itaque commodi ullam, corporis tempore sapiente doloribus libero cupiditate doloremque tempora. Reiciendis, ab, modi.
91 |
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/comparisons/navigation/tabs/html.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
Label One
5 |
8 |
9 |
10 |
11 |
12 |
Label Two
13 |
14 |
Tab Two Content
15 |
16 |
17 |
18 |
19 |
20 |
Label Three
21 |
22 |
Tab Three Content
23 |
24 |
25 |
--------------------------------------------------------------------------------
/comparisons/navigation/tabs/resources.txt:
--------------------------------------------------------------------------------
1 | Functional CSS Tabs Revisited: https://css-tricks.com/functional-css-tabs-re-revisited/
2 | Material Design CSS Tabs: http://codepen.io/mildrenben/pen/bdGdOb
--------------------------------------------------------------------------------
/comparisons/navigation/tabs/scss.scss:
--------------------------------------------------------------------------------
1 | .tabs {
2 | position: relative;
3 | // set height to be even for all tab groups
4 | min-height: 200px;
5 | }
6 |
7 | .tab {
8 | float: left;
9 | }
10 |
11 | .tab label {
12 | // set label height
13 | top: 1em;
14 | }
15 |
16 | // Visually hide radio buttons
17 | .tab [type=radio] {
18 | position: absolute;
19 | height: 0;
20 | width: 0;
21 | overflow: hidden;
22 | clip: rect(0, 0, 0, 0);
23 |
24 | &:focus + label {
25 | outline: 2px dotted black;
26 | }
27 | }
28 |
29 | .content {
30 | position: absolute;
31 | top: 1em; left: 0; right: 0; bottom: 0;
32 | opacity: 0;
33 | }
34 |
35 | [type=radio]:checked ~ label {
36 | z-index: 2;
37 | }
38 |
39 | [type=radio]:checked ~ label ~ .content {
40 | z-index: 1;
41 | opacity: 1;
42 | }
--------------------------------------------------------------------------------
/css/index.css:
--------------------------------------------------------------------------------
1 | *,
2 | *:after,
3 | *:before {
4 | -webkit-box-sizing: border-box;
5 | -moz-box-sizing: border-box;
6 | box-sizing: border-box;
7 | }
8 | html {
9 | overflow-y: scroll;
10 | }
11 | a {
12 | cursor: pointer;
13 | color: #006da0;
14 | }
15 | ::-webkit-input-placeholder {
16 | color: rgba(0,0,0,0.5);
17 | }
18 | :-moz-placeholder {
19 | color: rgba(0,0,0,0.5);
20 | }
21 | ::-moz-placeholder {
22 | color: rgba(0,0,0,0.5);
23 | }
24 | :-ms-input-placeholder {
25 | color: rgba(0,0,0,0.5);
26 | }
27 | input[type="search"][required] {
28 | -webkit-border-radius: 0;
29 | border-radius: 0;
30 | position: relative;
31 | padding: 0.1rem 1.1rem 0.1rem 0.25rem;
32 | }
33 | input[type="search"][required]::-ms-clear {
34 | display: none;
35 | }
36 | input[type="search"][required]::-webkit-search-cancel-button {
37 | -webkit-appearance: none;
38 | }
39 | input[type="search"][required]::-webkit-search-cancel-button:after {
40 | font-family: Arial, sans-serif;
41 | content: "\00D7";
42 | display: block;
43 | position: absolute;
44 | right: 0;
45 | top: 0;
46 | bottom: 0;
47 | width: 0.85rem;
48 | font-size: 0.8rem;
49 | text-align: left;
50 | cursor: pointer;
51 | }
52 | input[type="search"][required]:valid::-webkit-search-cancel-button:after {
53 | opacity: 1;
54 | -ms-filter: none;
55 | filter: none;
56 | }
57 | input[type="search"][required]:invalid::-webkit-search-cancel-button:after {
58 | opacity: 0;
59 | -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
60 | filter: alpha(opacity=0);
61 | }
62 | body {
63 | font-family: "Lato", "Helvetica Neue", Helvetica, arial, sans-serif;
64 | color: #444;
65 | margin: 0;
66 | -webkit-font-smoothing: antialiased;
67 | }
68 | .page {
69 | background: #fff;
70 | }
71 | header.page-header {
72 | width: 44em;
73 | max-width: 100%;
74 | padding: 3em 0 2em;
75 | margin: 0 auto;
76 | text-align: center;
77 | }
78 | @media (max-width: 840px) {
79 | header.page-header {
80 | font-size: 12px;
81 | }
82 | }
83 | @media (max-width: 540px) {
84 | header.page-header {
85 | font-size: 8px;
86 | padding-top: 0;
87 | width: 100%;
88 | }
89 | }
90 | header.page-header .inner {
91 | padding: 3em 2em 2.4em;
92 | background: #c69;
93 | max-height: 178px;
94 | }
95 | header.page-header .inner h1 {
96 | font-size: 2.3em;
97 | font-weight: 200;
98 | margin: 0;
99 | color: #fff;
100 | text-transform: uppercase;
101 | letter-spacing: 0.01em;
102 | line-height: 1;
103 | }
104 | .explanation {
105 | width: 40em;
106 | max-width: 100%;
107 | padding: 0 1em;
108 | margin: auto;
109 | text-align: justify;
110 | }
111 | .explanation .inner {
112 | font-size: 1.1em;
113 | }
114 | .share-buttons {
115 | zoom: 1;
116 | max-width: 250px;
117 | margin: 2em auto 0;
118 | height: 2em;
119 | }
120 | .share-buttons:before,
121 | .share-buttons:after {
122 | content: "";
123 | display: table;
124 | }
125 | .share-buttons:after {
126 | clear: both;
127 | }
128 | .share-buttons .twitter-share-button {
129 | float: left;
130 | width: 90px;
131 | height: 1em;
132 | }
133 | .share-buttons .github-stars-button {
134 | float: left;
135 | height: 1em;
136 | }
137 | .old-ie-message {
138 | display: none;
139 | }
140 | html.old-ie .old-ie-message {
141 | display: block;
142 | background-color: #ffaeae;
143 | padding: 10px;
144 | color: #fff;
145 | }
146 | .empty-message {
147 | display: none;
148 | }
149 | .comparisons.empty .empty-message {
150 | display: block;
151 | padding: 1em 0;
152 | font-size: 1.5em;
153 | text-align: center;
154 | }
155 | .comparison {
156 | zoom: 1;
157 | }
158 | .comparison:before,
159 | .comparison:after {
160 | content: "";
161 | display: table;
162 | }
163 | .comparison:after {
164 | clear: both;
165 | }
166 | .comparison h3 {
167 | text-align: center;
168 | font-size: 2em;
169 | font-weight: normal;
170 | }
171 | .comparison h3 a {
172 | position: relative;
173 | color: inherit;
174 | text-decoration: none;
175 | }
176 | .comparison h3 a:hover:before {
177 | content: '§';
178 | position: absolute;
179 | right: 100%;
180 | padding-right: 0.3em;
181 | }
182 | .comparison h4 {
183 | font-weight: 200;
184 | color: #666;
185 | letter-spacing: 0.07em;
186 | font-size: 1.4em;
187 | text-transform: uppercase;
188 | margin-bottom: 0;
189 | line-height: 1;
190 | display: inline-block;
191 | }
192 | header.search {
193 | zoom: 1;
194 | max-width: 40em;
195 | margin: 2em auto 0;
196 | padding: 0 1em;
197 | }
198 | header.search:before,
199 | header.search:after {
200 | content: "";
201 | display: table;
202 | }
203 | header.search:after {
204 | clear: both;
205 | }
206 | header.search input[type="search"] {
207 | height: 3em;
208 | border: 0;
209 | font-family: inherit;
210 | font-size: 1.5em;
211 | font-weight: 200;
212 | letter-spacing: 0.08em;
213 | padding-left: 0.52em;
214 | margin: 0;
215 | color: inherit;
216 | opacity: 0.5;
217 | -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
218 | filter: alpha(opacity=50);
219 | width: 50%;
220 | background: rgba(0,0,0,0.1);
221 | margin-bottom: 4px;
222 | width: 100%;
223 | padding: 1em;
224 | margin-bottom: 1em;
225 | }
226 | header.search input[type="search"]::-webkit-search-cancel-button:after {
227 | position: absolute;
228 | top: 0;
229 | bottom: 0;
230 | margin: auto;
231 | height: 1em;
232 | font-size: 1em;
233 | line-height: 1;
234 | font-weight: normal;
235 | padding-right: 1em;
236 | cursor: pointer;
237 | }
238 | header.search input[type="search"]:focus {
239 | background: rgba(0,0,0,0.05);
240 | opacity: 1;
241 | -ms-filter: none;
242 | filter: none;
243 | outline: none;
244 | }
245 | header.search .field {
246 | position: relative;
247 | }
248 | header.search .field label {
249 | padding-right: 10em;
250 | font-size: 1.1em;
251 | line-height: 1.2em;
252 | padding-top: 0em;
253 | padding-bottom: 3em;
254 | display: block;
255 | }
256 | header.search .field .slider {
257 | position: absolute;
258 | top: 0;
259 | right: 0;
260 | width: 10em;
261 | height: 2em;
262 | }
263 | .hidden {
264 | display: none;
265 | }
266 | .resources-block {
267 | text-align: center;
268 | }
269 | .resources-block h4 {
270 | font-size: 1.1em;
271 | display: inline-block;
272 | font-weight: 200;
273 | color: #666;
274 | letter-spacing: 0.07em;
275 | font-size: 1.4em;
276 | text-transform: uppercase;
277 | margin-bottom: 0;
278 | line-height: 1;
279 | }
280 | .resources-block ul {
281 | display: inline-block;
282 | list-style: none;
283 | padding: 0;
284 | }
285 | .resources-block ul li {
286 | display: inline-block;
287 | padding-left: 10px;
288 | }
289 | section {
290 | /* Hide section titles when they're empty */
291 | position: relative;
292 | overflow: hidden;
293 | background: #fff;
294 | padding: 5.5em 0;
295 | }
296 | section.odd {
297 | background: #eee;
298 | }
299 | section.odd :not(pre) > code[class*="language-"],
300 | section.odd pre[class*="language-"] {
301 | background: #fff;
302 | }
303 | section .inner {
304 | width: 1200px;
305 | max-width: 100%;
306 | margin: 0 auto;
307 | padding: 0 1em;
308 | }
309 | section .comparison {
310 | padding-top: 40px;
311 | padding-bottom: -40px;
312 | }
313 | section h2 {
314 | font-size: 3em;
315 | font-weight: 100;
316 | letter-spacing: 0.3em;
317 | text-transform: uppercase;
318 | color: #888;
319 | text-align: center;
320 | margin: 0;
321 | }
322 | @media (max-width: 840px) {
323 | section h2 {
324 | font-size: 2em;
325 | }
326 | }
327 | input[type='range'] {
328 | -webkit-appearance: none !important;
329 | margin: 0;
330 | background-color: #f0f0f0;
331 | height: 30px;
332 | width: 100%;
333 | padding: 4px;
334 | }
335 | input[type='range']::-webkit-slider-thumb {
336 | -webkit-appearance: none !important;
337 | height: 20px;
338 | width: 20px;
339 | border: 2px solid #ccc;
340 | -webkit-border-radius: 5px;
341 | border-radius: 5px;
342 | background-color: #fcfcfc;
343 | }
344 | .range-label {
345 | float: left;
346 | width: 33%;
347 | text-align: center;
348 | padding: 0 4px;
349 | }
350 | .range-label:first-of-type {
351 | text-align: left;
352 | }
353 | .range-label:last-of-type {
354 | text-align: right;
355 | }
356 | footer {
357 | margin: 3em auto;
358 | text-align: center;
359 | }
360 | footer a {
361 | color: #c69;
362 | }
363 | .comparison-group {
364 | display: -webkit-box;
365 | display: -moz-box;
366 | display: -webkit-flex;
367 | display: -ms-flexbox;
368 | display: box;
369 | display: flex;
370 | -webkit-box-lines: multiple;
371 | -moz-box-lines: multiple;
372 | -o-box-lines: multiple;
373 | -webkit-flex-wrap: wrap;
374 | -ms-flex-wrap: wrap;
375 | flex-wrap: wrap;
376 | }
377 | .comparison-group .code {
378 | -webkit-box-flex: 1;
379 | -moz-box-flex: 1;
380 | -o-box-flex: 1;
381 | box-flex: 1;
382 | -webkit-flex: 1;
383 | -ms-flex: 1;
384 | flex: 1;
385 | margin: 10px;
386 | -webkit-flex-basis: 400px;
387 | flex-basis: 400px;
388 | overflow: auto;
389 | }
390 | .native-example iframe {
391 | background: #fff;
392 | border: 1px solid #eee;
393 | height: 200px;
394 | margin: 15px 0;
395 | width: 100%;
396 | }
397 | .usage-note {
398 | text-align: center;
399 | }
400 |
--------------------------------------------------------------------------------
/css/prism.css:
--------------------------------------------------------------------------------
1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+scss&plugins=show-language */
2 | /**
3 | * prism.js default theme for JavaScript, CSS and HTML
4 | * Based on dabblet (http://dabblet.com)
5 | * @author Lea Verou
6 | */
7 |
8 | code[class*="language-"],
9 | pre[class*="language-"] {
10 | color: black;
11 | background: none;
12 | text-shadow: 0 1px white;
13 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
14 | text-align: left;
15 | white-space: pre;
16 | word-spacing: normal;
17 | word-break: normal;
18 | word-wrap: normal;
19 | line-height: 1.5;
20 |
21 | -moz-tab-size: 4;
22 | -o-tab-size: 4;
23 | tab-size: 4;
24 |
25 | -webkit-hyphens: none;
26 | -moz-hyphens: none;
27 | -ms-hyphens: none;
28 | hyphens: none;
29 | }
30 |
31 | pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
32 | code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
33 | text-shadow: none;
34 | background: #b3d4fc;
35 | }
36 |
37 | pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
38 | code[class*="language-"]::selection, code[class*="language-"] ::selection {
39 | text-shadow: none;
40 | background: #b3d4fc;
41 | }
42 |
43 | @media print {
44 | code[class*="language-"],
45 | pre[class*="language-"] {
46 | text-shadow: none;
47 | }
48 | }
49 |
50 | /* Code blocks */
51 | pre[class*="language-"] {
52 | padding: 1em;
53 | margin: .5em 0;
54 | overflow: auto;
55 | }
56 |
57 | :not(pre) > code[class*="language-"],
58 | pre[class*="language-"] {
59 | background: #f5f2f0;
60 | }
61 |
62 | /* Inline code */
63 | :not(pre) > code[class*="language-"] {
64 | padding: .1em;
65 | border-radius: .3em;
66 | white-space: normal;
67 | }
68 |
69 | .token.comment,
70 | .token.prolog,
71 | .token.doctype,
72 | .token.cdata {
73 | color: slategray;
74 | }
75 |
76 | .token.punctuation {
77 | color: #999;
78 | }
79 |
80 | .namespace {
81 | opacity: .7;
82 | }
83 |
84 | .token.property,
85 | .token.tag,
86 | .token.boolean,
87 | .token.number,
88 | .token.constant,
89 | .token.symbol,
90 | .token.deleted {
91 | color: #905;
92 | }
93 |
94 | .token.selector,
95 | .token.attr-name,
96 | .token.string,
97 | .token.char,
98 | .token.builtin,
99 | .token.inserted {
100 | color: #690;
101 | }
102 |
103 | .token.operator,
104 | .token.entity,
105 | .token.url,
106 | .language-css .token.string,
107 | .style .token.string {
108 | color: #a67f59;
109 | background: hsla(0, 0%, 100%, .5);
110 | }
111 |
112 | .token.atrule,
113 | .token.attr-value,
114 | .token.keyword {
115 | color: #07a;
116 | }
117 |
118 | .token.function {
119 | color: #DD4A68;
120 | }
121 |
122 | .token.regex,
123 | .token.important,
124 | .token.variable {
125 | color: #e90;
126 | }
127 |
128 | .token.important,
129 | .token.bold {
130 | font-weight: bold;
131 | }
132 | .token.italic {
133 | font-style: italic;
134 | }
135 |
136 | .token.entity {
137 | cursor: help;
138 | }
139 |
140 | div.prism-show-language {
141 | position: relative;
142 | }
143 |
144 | div.prism-show-language > div.prism-show-language-label {
145 | color: black;
146 | background-color: #CFCFCF;
147 | display: inline-block;
148 | position: absolute;
149 | bottom: auto;
150 | left: auto;
151 | top: 0;
152 | right: 0;
153 | width: auto;
154 | height: auto;
155 | font-size: 0.9em;
156 | border-radius: 0 0 0 5px;
157 | padding: 0 0.5em;
158 | text-shadow: none;
159 | z-index: 1;
160 | box-shadow: none;
161 | -webkit-transform: none;
162 | -moz-transform: none;
163 | -ms-transform: none;
164 | -o-transform: none;
165 | transform: none;
166 | }
167 |
168 |
--------------------------------------------------------------------------------
/gulpfile.coffee:
--------------------------------------------------------------------------------
1 | gulp = require('gulp')
2 | stylus = require('gulp-stylus')
3 | jade = require('gulp-jade')
4 | coffee = require('gulp-coffee')
5 |
6 | readTree = require('./readTree')
7 |
8 | CAPS_WORDS = ['JSON', 'HTML', 'AJAX']
9 | titleCase = (str) ->
10 | str = str.replace /(^|\b)([a-z])([a-z]+)/g, (match, space, first, rest) ->
11 | "#{ space }#{ first.toUpperCase() }#{ rest }"
12 |
13 | str = str.replace new RegExp("(?:^|\b)(#{ CAPS_WORDS.join('|') })(?:$|\b)", 'ig'), (match, word) ->
14 | word.toUpperCase()
15 |
16 | str
17 |
18 | getNamePart = (str) ->
19 | str.split('.')[0]
20 |
21 | fullLanguage = (ext) ->
22 | LANGS =
23 | js: 'javascript'
24 | css: 'css'
25 | scss: 'scss'
26 | html: 'markup'
27 |
28 | LANGS[ext]
29 |
30 | gulp.task 'coffee', ->
31 | gulp.src('./coffee/*')
32 | .pipe(coffee())
33 | .pipe(gulp.dest('./js/'))
34 |
35 | gulp.task 'stylus', ->
36 | gulp.src('./styl/index.styl')
37 | .pipe(stylus({use: ['nib']}))
38 | .pipe(gulp.dest('./css/'))
39 |
40 | gulp.task 'jade', ->
41 | readTree (err, comparisons) ->
42 | if err
43 | console.error "Error loading comparisons tree", err
44 | return
45 |
46 | comps = []
47 | for title, comparison of comparisons
48 | comps.push {title, comparison}
49 |
50 | comps.sort (a, b) ->
51 | a.title.localeCompare b.title
52 |
53 | gulp.src('./jade/**/index.jade')
54 | .pipe(jade({pretty: true, data: {comparisons: comps, titleCase, getNamePart, fullLanguage}}))
55 | .pipe(gulp.dest('./'))
56 |
57 | gulp.task 'default', ->
58 |
59 | gulp.run 'coffee', 'stylus', 'jade'
60 |
61 | gulp.watch './coffee/*', ->
62 | gulp.run 'coffee'
63 |
64 | gulp.watch './styl/*', ->
65 | gulp.run 'stylus'
66 |
67 | gulp.watch ['./jade/**/*.jade', './comparisons/**/*'], ->
68 | gulp.run 'jade'
69 |
--------------------------------------------------------------------------------
/gulpfile.js:
--------------------------------------------------------------------------------
1 | require('coffee-script')
2 | require('./gulpfile.coffee')
3 |
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | You Might Not Need JavaScript
18 |
19 |
20 |
21 |
25 |
26 |
27 |
28 |
37 |
38 |
39 |
40 |
45 |
46 |
47 |
JavaScript is great, and by all means use it, while also being aware that you can build so many functional UI components without the additional dependancy.
48 |
49 | Maybe you can include a few lines of utility code, or a mixin, and forgo the requirement. If you're only targeting more modern browsers,
50 | you might not need anything more than what the browser ships with.
51 |
52 |
53 | This site is fully copied from youmightnotneedjquery.com , an excellent resource for vanilla JavaScript created by @adamfschwartz and @zackbloom .
54 | But this time, we take a look at the power of modern native HTML and CSS as well as some of the syntactic sugar of Sass. Because, you might not need scripts for that task at all!
55 |
56 |
57 |
58 | (Note: Some of these demos may not be accessible and work on all browsers. Please take a moment to review the usage notes and to test them in your project before using in production)
59 |
60 |
61 |
62 |
70 |
73 |
74 |
Your search didn't match any comparisons.
75 |
76 |
77 |
Components
78 |
79 |
80 |
81 |
resources:
82 |
87 |
88 |
89 |
90 |
DEMO
91 |
92 |
93 |
94 |
95 |
96 |
99 |
Usage: Presentational, Option to read or be skipped by screen reader, no user control over images.
100 |
101 |
102 |
103 |
HTML
104 |
105 |
<div id="slider">
106 | <div id="slide-holder">
107 | <div class="slide">content1</div>
108 | <div class="slide">content2</div>
109 | <div class="slide">content3</div>
110 | </div>
111 | </div>
112 |
113 |
114 |
115 |
116 |
SCSS
117 |
118 |
#slider {
119 | width: $slide-width;
120 | height: $slide-height;
121 | overflow: hidden;
122 | }
123 |
124 | .slide {
125 | width: $slide-width;
126 | height: $slide-height;
127 | float: left;
128 | position: relative;
129 | }
130 |
131 | #slide-holder {
132 | // wide enough to fit all the slides
133 | width: 400%;
134 | position: relative;
135 | left: 0;
136 | will-change: transform;
137 | animation: scroller 10s infinite;
138 | }
139 |
140 | // need a step for each slide
141 | @keyframes scroller {
142 | 0% { transform: translateX(0); }
143 | 33% { transform: translateX(-$slide-width); }
144 | 66% { transform: translateX(-$slide-width*2); }
145 | 100% { transform: translateX(0); }
146 | }
147 |
148 |
149 |
150 |
151 |
152 |
can i use:
153 |
158 |
159 |
160 |
161 |
162 |
163 |
resources:
164 |
168 |
169 |
170 |
171 |
DEMO
172 |
173 |
174 |
175 |
176 |
177 |
181 |
Usage: Safe for production with caveat (see scss) — Shoutout to Marcy Sutton
182 |
183 |
184 |
185 |
HTML
186 |
187 |
<a class="modalTrigger" id="modalTrigger"
188 | href="#modalDialog1">
189 | Open dialog
190 | </a>
191 |
192 | <dialog class="modal" id="modalDialog1"
193 | tabindex="-1" role="dialog">
194 | <div>
195 | <a href="#modalTrigger" aria-label="Close">
196 | ×
197 | </a>
198 | <p>Hello Beautiful!</p>
199 | </div>
200 | </dialog>
201 |
202 |
203 |
204 |
205 |
SCSS
206 |
207 |
// Modal hidden until it matches an anchor target
208 | // Note: you can't close it with the escape key
209 | // or trap focus inside of it.
210 | .modal {
211 | opacity: 0;
212 | visibility: hidden;
213 | }
214 |
215 | // modal fades in when it matches
216 | // an anchor link (i.e. clicked on)
217 | #modalDialog:target {
218 | opacity: 1;
219 | visibility: hidden;
220 | }
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
resources:
229 |
233 |
234 |
235 |
236 |
DEMO
237 |
238 |
239 |
240 |
241 |
242 |
245 |
Usage: Presentational: keyboard navigable, not screen reader accessible.
246 |
247 |
248 |
249 |
HTML
250 |
251 |
<div id="slider">
252 |
253 | <!-- Slide Images -->
254 | <img id="slide-1" src="img1.jpg" alt="img description"/>
255 | <img id="slide-2" src="img2.jpg" alt="img description"/>
256 | <img id="slide-3" src="img3.jpg" alt="img description"/>
257 | <img id="slide-4" src="img4.jpg" alt="img description"/>
258 |
259 | <!-- Navigation for the slides -->
260 | <ul>
261 | <li><a href="#slide-1" aria-label="Image 1">1</a></li>
262 | <li><a href="#slide-2" aria-label="Image 2">2</a></li>
263 | <li><a href="#slide-3" aria-label="Image 3">3</a></li>
264 | <li><a href="#slide-4" aria-label="Image 4">4</a></li>
265 | </ul>
266 | </div>
267 |
268 |
269 |
270 |
271 |
SCSS
272 |
273 |
#slider {
274 | img {
275 | position: absolute;
276 | top: 0;
277 | left: 0;
278 | width: 300px;
279 | height: 200px;
280 |
281 | &:target {
282 | transition: all .5s ease-in-out;
283 | }
284 |
285 | &:not(:target),
286 | &:target ~ img#slide-4 {
287 | position: relative;
288 | opacity: 0;
289 | }
290 |
291 | // set initially visible
292 | &#slide-4 {
293 | position: absolute;
294 | opacity: 1;
295 | }
296 | }
297 | }
298 |
299 |
300 |
301 |
302 |
can i use:
303 |
306 |
307 |
308 |
309 |
310 |
440 |
441 |
442 |
Interactions
443 |
506 |
507 |
508 |
509 |
510 |
Navigation
511 |
512 |
513 |
514 |
resources:
515 |
519 |
520 |
521 |
522 |
DEMO
523 |
524 |
525 |
526 |
527 |
528 |
531 |
Usage: Not keyboard navigable, inability to focus.
532 |
533 |
534 |
535 |
HTML
536 |
537 |
<div class="togglebox">
538 | <input id="toggle1" type="radio" name="toggle" />
539 | <label for="toggle1">Label 1</label>
540 | <section id="content1">
541 | <p>Content for the first accordion</p>
542 | </section>
543 |
544 | <input id="toggle2" type="radio" name="toggle" />
545 | <label for="toggle2">Label 2</label>
546 | <section id="content2">
547 | <p>Content for the second accordion</p>
548 | </section>
549 |
550 | <input id="toggle3" type="radio" name="toggle" />
551 | <label for="toggle3">Label 3</label>
552 | <section id="content3">
553 | <p>Content for the third accordion</p>
554 | </section>
555 | </div>
556 |
557 |
558 |
559 |
SCSS
560 |
561 |
// Visually hide radio buttons
562 | input[type="radio"] {
563 | position: absolute;
564 | opacity: 0;
565 |
566 | &:focus + label {
567 | color: black;
568 | background-color: wheat;
569 | }
570 | }
571 |
572 | // Style label/entry for accordion
573 | label {
574 | position: relative;
575 | display: block;
576 | cursor: pointer;
577 | }
578 |
579 | // Style accordion content
580 | section {
581 | height: 0;
582 | transition: .3s all;
583 | overflow: hidden;
584 | }
585 |
586 | // Open content when clicking label
587 | #toggle1:checked ~ #content1,
588 | #toggle2:checked ~ #content2,
589 | #toggle3:checked ~ #content3,
590 | #toggle4:checked ~ #content4 {
591 | // set height for transition duration to work
592 | // (also can set to auto without transition)
593 | height: 200px;
594 | }
595 |
596 |
597 |
598 |
599 |
can i use:
600 |
603 |
604 |
605 |
606 |
607 |
608 |
resources:
609 |
612 |
613 |
614 |
615 |
DEMO
616 |
617 |
618 |
619 |
620 |
621 |
624 |
Usage: Not keyboard navigable.
625 |
626 |
627 |
628 |
HTML
629 |
630 |
<!-- thumbnail image wrapped in a link -->
631 | <a href="#img1">
632 | <img src="img.jpg" class="thumbnail">
633 | </a>
634 |
635 | <!-- lightbox container hidden with CSS -->
636 | <a href="#" class="lightbox" id="img1">
637 | <img src="img.jpg">
638 | </a>
639 |
640 |
641 |
642 |
SCSS
643 |
644 |
$thumbnail-size: 40px;
645 | $background-color: black;
646 |
647 | .thumbnail {
648 | max-width: $thumbnail-size;
649 | }
650 |
651 | .lightbox {
652 | // Hide lightbox image
653 | display: none;
654 |
655 | // Position/style of lightbox
656 | position: fixed;
657 | z-index: 999;
658 | width: 100%;
659 | height: 100%;
660 | text-align: center;
661 | top: 0;
662 | left: 0;
663 | background: $background-color;
664 | }
665 |
666 | .lightbox img {
667 | /// Pad the lightbox image
668 | max-width: 90%;
669 | max-height: 80%;
670 | margin-top: 2%;
671 | }
672 |
673 | .lightbox:target {
674 | // Remove default outline and unhide lightbox
675 | outline: none;
676 | display: block;
677 | }
678 |
679 |
680 |
681 |
682 |
683 |
684 |
685 |
resources:
686 |
690 |
691 |
692 |
693 |
DEMO
694 |
695 |
696 |
697 |
698 |
699 |
702 |
Usage: Not keyboard navigable.
703 |
704 |
705 |
706 |
HTML
707 |
708 |
<div class="tabs">
709 | <div class="tab">
710 | <input type="radio" name="tabgroup" id="tab-1" checked>
711 | <label for="tab-1">Label One</label>
712 | <div class="content">
713 | <p>Tab One Content</p>
714 | </div>
715 | </div>
716 |
717 | <div class="tab">
718 | <input type="radio" name="tabgroup" id="tab-2">
719 | <label for="tab-2">Label Two</label>
720 | <div class="content">
721 | <p>Tab Two Content</p>
722 | </div>
723 | </div>
724 |
725 | <div class="tab">
726 | <input type="radio" name="tabgroup" id="tab-3">
727 | <label for="tab-3">Label Three</label>
728 | <div class="content">
729 | <p>Tab Three Content</p>
730 | </div>
731 | </div>
732 | </div>
733 |
734 |
735 |
736 |
SCSS
737 |
738 |
.tabs {
739 | position: relative;
740 | // set height to be even for all tab groups
741 | min-height: 200px;
742 | }
743 |
744 | .tab {
745 | float: left;
746 | }
747 |
748 | .tab label {
749 | // set label height
750 | top: 1em;
751 | }
752 |
753 | // Visually hide radio buttons
754 | .tab [type=radio] {
755 | position: absolute;
756 | height: 0;
757 | width: 0;
758 | overflow: hidden;
759 | clip: rect(0, 0, 0, 0);
760 |
761 | &:focus + label {
762 | outline: 2px dotted black;
763 | }
764 | }
765 |
766 | .content {
767 | position: absolute;
768 | top: 1em; left: 0; right: 0; bottom: 0;
769 | opacity: 0;
770 | }
771 |
772 | [type=radio]:checked ~ label {
773 | z-index: 2;
774 | }
775 |
776 | [type=radio]:checked ~ label ~ .content {
777 | z-index: 1;
778 | opacity: 1;
779 | }
780 |
781 |
782 |
783 |
784 |
785 |
786 |
787 |
790 |
791 |
792 |
--------------------------------------------------------------------------------
/jade/_caniuse.jade:
--------------------------------------------------------------------------------
1 | mixin caniuse(list)
2 | - var alts = list.split('\n')
3 |
4 | div.resources-block
5 | h4 can i use:
6 |
7 | ul.resources
8 |
9 | for alt in alts
10 | - var name = alt.substring(0, alt.indexOf(':'))
11 | - var url = alt.substring(alt.indexOf(':') + 1)
12 |
13 | if name
14 | li
15 | a(href=url, target="_blank")= name
16 |
--------------------------------------------------------------------------------
/jade/_resources.jade:
--------------------------------------------------------------------------------
1 | mixin resources(list)
2 | - var alts = list.split('\n')
3 |
4 | .resources-block
5 | h4 resources:
6 |
7 | ul.resources
8 |
9 | for alt in alts
10 | - var name = alt.substring(0, alt.indexOf(':'))
11 | - var url = alt.substring(alt.indexOf(':') + 1)
12 |
13 | if name
14 | li
15 | a(href=url, target="_blank")= name
16 |
--------------------------------------------------------------------------------
/jade/index.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 |
3 | //- This will go into the HTML file to let people know to edit this file instead:
4 | // Please edit the index.jade or the files in comparisons/, this file is generated
5 |
6 | include _resources
7 | include _caniuse
8 |
9 |
10 |
11 | head
12 | meta(charset='utf-8')
13 | meta(http-equiv='X-UA-Compatible', content='chrome=1')
14 | meta(name='viewport', content='width=device-width, initial-scale=1')
15 | meta(name='description', content='Examples of common UI elements and interactions with HTML and CSS alone.')
16 | meta(name='twitter:card', content='summary_large_image')
17 | meta(name='twitter:site', content='@una')
18 | meta(name='twitter:creator', content='@una')
19 | meta(name='twitter:title', content='You Might Not Need JavaScript')
20 | meta(name='twitter:description', content='Examples of common UI elements and interactions with HTML and CSS alone.')
21 | meta(name='twitter:image' content='http://youmightnotneedjs.com/shareimg.jpg')
22 | meta(name='og:image' content='http://youmightnotneedjs.com/shareimg.jpg')
23 | meta(name='og:title', content='You Might Not Need JavaScript')
24 |
25 | title You Might Not Need JavaScript
26 |
27 | link(rel='stylesheet', href='css/prism.css')
28 | link(rel='stylesheet', href='css/index.css')
29 |
30 | link(rel='stylesheet', href='https://fonts.googleapis.com/css?family=Lato')
31 |
32 | script(type='text/javascript').
33 | try{Typekit.load();}catch(e){}
34 |
35 | script(src='js/prism.js')
36 | script(src='js/index.js')
37 | script(src='https://assets.codepen.io/assets/embed/ei.js')
38 |
39 | script.
40 | (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
41 | (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
42 | m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
43 | })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
44 | ga('create', 'UA-36758177-10', 'auto');
45 | ga('send', 'pageview');
46 |
47 | body
48 | .page
49 | header.page-header
50 | .inner
51 | h1
52 | | You might no t need JavaScript
53 |
54 | .explanation
55 | .inner
56 | p
57 | | JavaScript is great, and by all means use it, while also being aware that you can build so many functional UI components without the additional dependancy.
58 |
59 | p
60 | | Maybe you can include a few lines of utility code, or a mixin, and forgo the requirement. If you're only targeting more modern browsers,
61 | | you might not need anything more than what the browser ships with.
62 |
63 | p
64 | | This site is fully copied from youmightnotneedjquery.com , an excellent resource for vanilla JavaScript created by @adamfschwartz and @zackbloom .
65 | | But this time, we take a look at the power of modern native HTML and CSS as well as some of the syntactic sugar of Sass. Because, you might not need scripts for that task at all!
66 |
67 | p
68 | | (Note: Some of these demos may not be accessible and work on all browsers. Please take a moment to review the usage notes and to test them in your project before using in production)
69 |
70 | .share-buttons
71 |
72 | .share-button.twitter-share-button
73 | iframe(src='https://platform.twitter.com/widgets/tweet_button.html?size=l&url=http%3A%2F%2Fyoumightnotneedjs.com&text=You%20might%20not%20need%20JavaScript!', sharecount=true, frameborder=0, scrolling=0, width="90px", title="Tweet button")
74 |
75 | .share-button.github-stars-button
76 | iframe(src="https://ghbtns.com/github-btn.html?user=una&repo=YouMightNotNeedJS&type=star&count=true&size=large" frameborder="0" scrolling="0" width="160px" height="30px" title="View on Github" )
77 |
78 | header.search
79 |
80 | input(type="search", placeholder="Search...", required, aria-label="Search")
81 |
82 | .comparisons
83 |
84 | .empty-message
85 | | Your search didn't match any comparisons.
86 |
87 | - var i = 0
88 | for comp in comparisons
89 | section(id=comp.title, class=(++i % 2 ? 'odd' : ''))
90 | .inner
91 | h2= titleCase(comp.title)
92 |
93 | if comp.comparison._resources
94 | +resources(comp.comparison._resources)
95 |
96 | if comp.comparison._caniuse
97 | +caniuse(comp.comparison._caniuse)
98 |
99 | for co, name in comp.comparison
100 | - if (name[0] === '_') continue;
101 |
102 | .comparison(id=name.replace(' ', '-').toLowerCase())
103 | h3
104 | a(href='#' + name.replace(' ', '-'))= titleCase(name.replace(/_/g, ' '))
105 |
106 | if co.resources
107 | +resources(co.resources.txt)
108 |
109 | noscript
110 | div.native-example
111 |
112 | for code in ['demo']
113 | if co[code]
114 | h4= code.toUpperCase()
115 |
116 | for lang in ['html', 'markup']
117 | if co[code][lang]
118 | div
119 | iframe(src='comparisons/' + comp.title + '/' + name + '/demo.html')
120 |
121 | div.codpen-example
122 |
123 | for code in ['codepen']
124 | if co[code]
125 | h4= code.toUpperCase()
126 |
127 | for lang in ['html', 'markup']
128 | if co[code][lang]
129 | !{co[code][lang]}
130 |
131 | div.usage-note
132 |
133 | if co.a11y
134 | strong !{co.a11y.txt}
135 |
136 | div.comparison-group
137 |
138 | for code in ['html', 'css', 'scss', 'markup']
139 | if co[code]
140 | .code(data-code=getNamePart(code), class=getNamePart(code))
141 |
142 | h4= code.toUpperCase()
143 |
144 | for lang in ['html', 'scss', 'css', 'markup']
145 | if co[code][lang]
146 | .code-block(class='language-' + fullLanguage(lang), data-lang=fullLanguage(lang))
147 | pre
148 | code= co[code][lang]
149 |
150 | if co.caniuse
151 | +caniuse(co.caniuse.txt)
152 |
153 | footer
154 | p made by @una based on youmightnotneedjquery.com | contribute on github
155 |
156 | div(style='-webkit-transform: translateZ(0);')
157 |
158 |
--------------------------------------------------------------------------------
/js/index.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var filter, hide, showFirst,
3 | __slice = [].slice;
4 |
5 | showFirst = function() {
6 | var el, els, found, _i, _len, _results;
7 | els = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
8 | found = false;
9 | _results = [];
10 | for (_i = 0, _len = els.length; _i < _len; _i++) {
11 | el = els[_i];
12 | if (el && !found) {
13 | found = true;
14 | _results.push(el.style.display = 'block');
15 | } else if (el) {
16 | _results.push(el.style.display = 'none');
17 | } else {
18 | _results.push(void 0);
19 | }
20 | }
21 | return _results;
22 | };
23 |
24 | hide = function() {
25 | var el, els, _i, _len, _results;
26 | els = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
27 | _results = [];
28 | for (_i = 0, _len = els.length; _i < _len; _i++) {
29 | el = els[_i];
30 | if (el) {
31 | _results.push(el.style.display = 'none');
32 | }
33 | }
34 | return _results;
35 | };
36 |
37 | filter = function(term) {
38 | var allEmpty, comp, comparisons, empty, section, visibleIndex, _i, _j, _len, _len1, _ref, _ref1;
39 | visibleIndex = 0;
40 | allEmpty = true;
41 | _ref = document.querySelectorAll('section');
42 | for (_i = 0, _len = _ref.length; _i < _len; _i++) {
43 | section = _ref[_i];
44 | empty = true;
45 | _ref1 = section.querySelectorAll('.comparison');
46 | for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
47 | comp = _ref1[_j];
48 | if (!term || comp.textContent.toLowerCase().indexOf(term.toLowerCase()) !== -1) {
49 | empty = false;
50 | comp.classList.remove('hidden');
51 | } else {
52 | comp.classList.add('hidden');
53 | }
54 | }
55 | if (empty) {
56 | section.classList.add('hidden');
57 | } else {
58 | allEmpty = false;
59 | section.classList.remove('hidden');
60 | if (++visibleIndex % 2) {
61 | section.classList.add('odd');
62 | } else {
63 | section.classList.remove('odd');
64 | }
65 | }
66 | }
67 | comparisons = document.querySelector('.comparisons');
68 | if (allEmpty) {
69 | return comparisons.classList.add('empty');
70 | } else {
71 | return comparisons.classList.remove('empty');
72 | }
73 | };
74 |
75 | document.addEventListener('DOMContentLoaded', function() {
76 | var search;
77 | search = document.querySelector('input[type="search"]');
78 | return search.addEventListener('input', function() {
79 | return filter(search.value);
80 | });
81 | });
82 |
83 | }).call(this);
84 |
--------------------------------------------------------------------------------
/js/prism.js:
--------------------------------------------------------------------------------
1 | /* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+scss&plugins=line-highlight+line-numbers */
2 | var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(\w+)\b/i,t=0,n=_self.Prism={util:{encode:function(e){return e instanceof a?new a(e.type,n.util.encode(e.content),e.alias):"Array"===n.util.type(e)?e.map(n.util.encode):e.replace(/&/g,"&").replace(/e.length)break e;if(!(v instanceof a)){u.lastIndex=0;var b=u.exec(v),k=1;if(!b&&h&&m!=r.length-1){if(u.lastIndex=y,b=u.exec(e),!b)break;for(var w=b.index+(g?b[1].length:0),_=b.index+b[0].length,A=m,S=y,P=r.length;P>A&&_>S;++A)S+=(r[A].matchedStr||r[A]).length,w>=S&&(++m,y=S);if(r[m]instanceof a||r[A-1].greedy)continue;k=A-m,v=e.slice(y,S),b.index-=y}if(b){g&&(f=b[1].length);var w=b.index+f,b=b[0].slice(f),_=w+b.length,x=v.slice(0,w),O=v.slice(_),j=[m,k];x&&j.push(x);var N=new a(l,c?n.tokenize(b,c):b,d,b,h);j.push(N),O&&j.push(O),Array.prototype.splice.apply(r,j)}}}}}return r},hooks:{all:{},add:function(e,t){var a=n.hooks.all;a[e]=a[e]||[],a[e].push(t)},run:function(e,t){var a=n.hooks.all[e];if(a&&a.length)for(var r,i=0;r=a[i++];)r(t)}}},a=n.Token=function(e,t,n,a,r){this.type=e,this.content=t,this.alias=n,this.matchedStr=a||null,this.greedy=!!r};if(a.stringify=function(e,t,r){if("string"==typeof e)return e;if("Array"===n.util.type(e))return e.map(function(n){return a.stringify(n,t,e)}).join("");var i={type:e.type,content:a.stringify(e.content,t,r),tag:"span",classes:["token",e.type],attributes:{},language:t,parent:r};if("comment"==i.type&&(i.attributes.spellcheck="true"),e.alias){var l="Array"===n.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(i.classes,l)}n.hooks.run("wrap",i);var o="";for(var s in i.attributes)o+=(o?" ":"")+s+'="'+(i.attributes[s]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'"'+(o?" "+o:"")+">"+i.content+""+i.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var t=JSON.parse(e.data),a=t.language,r=t.code,i=t.immediateClose;_self.postMessage(n.highlight(r,n.languages[a],a)),i&&_self.close()},!1),_self.Prism):_self.Prism;var r=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return r&&(n.filename=r.src,document.addEventListener&&!r.hasAttribute("data-manual")&&("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(n.highlightAll):window.setTimeout(n.highlightAll,16):document.addEventListener("DOMContentLoaded",n.highlightAll))),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
3 | Prism.languages.markup={comment://,prolog:/<\?[\w\W]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
4 | Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:{pattern:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,greedy:!0},property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(