The MDN Content Kitchensink
The kitchensink is a page that attempts to incorporate every possible content element and Yari macro.
[!WARNING] Don't delete this page. It's used by mdn/yari for its automation.
About this page
The kitchensink is a page that attempts to incorporate every possible content element and Yari macro.
This page attempts to be the complete intersection of every other page. Not in terms of the text but in terms of the styles and macros. Let's start with some notes…
Text that uses the <kbd> tag: Shift
[!NOTE] Here's a block indicator note.
[!WARNING] Here's a block indicator warning.
Prev/Next buttons
Games/Techniques/Control_mechanisms/Other
Another one…
Games/Tutorials/2D_breakout_game_Phaser/Buttons
Code snippets
Plain text
___________________________
< I'm an expert in my field. >
---------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
HTML
<pre></pre>
JavaScript
const f = () => {
return Math.random();
};
CSS
:root {
--first-color: #488cff;
--second-color: #ffff8c;
}
#firstParagraph {
background-color: var(--first-color);
color: var(--second-color);
}
WebAssembly
(func (param i32) (param f32) (local f64)
local.get 0
local.get 1
local.get 2)
Rust
#[cfg(test)]
mod tests {
#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}
Python
class BookListView(generic.ListView):
model = Book
# your own name for the list as a template variable
context_object_name = 'my_book_list'
queryset = Book.objects.filter(title__icontains='war')[:5]
template_name = 'books/my_arbitrary_template_name_list.html'
Interactive examples
tabbed-shorter
```html interactive-example
New Products:
- Mini Ketchup
- Jumbo Ketchup
- Mega Jumbo Ketchup
```css interactive-example
data:hover::after {
content: " (ID " attr(value) ")";
font-size: 0.7em;
}
JavaScript Demo: Set.prototypeSymbol.iterator
```js interactive-example const set = new Set();
set.add(42); set.add("forty two");
const iterator = setSymbol.iterator;
console.log(iterator.next().value); // Expected output: 42
console.log(iterator.next().value); // Expected output: "forty two"
CSS Demo: filter
```css interactive-example-choice
filter: url("/shared-assets/images/examples/shadow.svg#element-id");
```css interactive-example-choice filter: blur(5px);
```css interactive-example-choice
filter: contrast(200%);
```css interactive-example-choice filter: grayscale(80%);
```css interactive-example-choice
filter: hue-rotate(90deg);
```css interactive-example-choice filter: drop-shadow(16px 16px 20px red) invert(75%);
```html interactive-example
<section id="default-example">
<div class="example-container">
<img
id="example-element"
src="/shared-assets/images/examples/firefox-logo.svg"
width="200" />
</div>
</section>
```css interactive-example .example-container { background-color: white; width: 260px; height: 260px; display: flex; align-items: center; justify-content: center; }
example-element {
flex: 1; padding: 30px; }
## Tables
### Markdown table
| Constant name | Value | Description |
| ---------------------------- | ------ | ---------------------------------------------------------------------- |
| `QUERY_COUNTER_BITS_EXT` | 0x8864 | The number of bits used to hold the query result for the given target. |
| `CURRENT_QUERY_EXT` | 0x8865 | The currently active query. |
| `QUERY_RESULT_EXT` | 0x8866 | The query result. |
| `QUERY_RESULT_AVAILABLE_EXT` | 0x8867 | A Boolean indicating whether a query result is available. |
| `TIME_ELAPSED_EXT` | 0x88BF | Elapsed time (in nanoseconds). |
| `TIMESTAMP_EXT` | 0x8E28 | The current time. |
| `GPU_DISJOINT_EXT` | 0x8FBB | A Boolean indicating whether the GPU performed any disjoint operation. |
### HTML table
<table class="properties">
<tbody>
<tr>
<th scope="row">
<a href="/en-US/docs/Web/HTML/Guides/Content_categories">Content categories</a>
</th>
<td>
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#flow_content">Flow content</a>,
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content">phrasing content</a>, palpable content.
</td>
</tr>
<tr>
<th scope="row">Permitted content</th>
<td>
<a href="/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content">Phrasing content</a>.
</td>
</tr>
<tr>
<th scope="row">Tag omission</th>
<td>None, both the starting and ending tag are mandatory.</td>
</tr>
<tr>
<th scope="row">Permitted parents</th>
<td>
Any element that accepts <a href="/en-US/docs/Web/HTML/Guides/Content_categories#phrasing_content">phrasing content</a>.
</td>
</tr>
<tr>
<th scope="row">Implicit ARIA role</th>
<td>
<a href="https://w3c.github.io/html-aria/#dfn-no-corresponding-role">No corresponding role</a>
</td>
</tr>
<tr>
<th scope="row">Permitted ARIA roles</th>
<td>Any</td>
</tr>
<tr>
<th scope="row">DOM interface</th>
<td>HTMLElement</td>
</tr>
</tbody>
</table>
<table class="fullwidth-table">
<caption>
Values for the content of <code><meta name="viewport"></code>
</caption>
<thead>
<tr>
<th scope="col">Value</th>
<th scope="col">Possible subvalues</th>
<th scope="col">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>width</code></td>
<td>A positive integer number, or the text <code>device-width</code></td>
<td>
Defines the pixel width of the viewport that you want the website to be
rendered at.
</td>
</tr>
<tr>
<td><code>user-scalable</code> </td>
<td><code>yes</code> or <code>no</code></td>
<td>
If set to <code>no</code>, the user is not able to zoom in the webpage.
The default is <code>yes</code>. Browser settings can ignore this rule,
and iOS10+ ignores it by default.
</td>
</tr>
<tr>
<td><code>viewport-fit</code></td>
<td><code>auto</code>, <code>contain</code> or <code>cover</code></td>
<td>
<p>
The <code>auto</code> value doesn't affect the initial layout viewport, and the whole web page is viewable.
</p>
<p>
The <code>contain</code> value means that the viewport is scaled to
fit the largest rectangle inscribed within the display.
</p>
<p>
The <code>cover</code> value means that the viewport is scaled to fill the device display.
It is highly recommended to make use of the <a href="/en-US/docs/Web/CSS/Reference/Values/env">safe area inset</a> variables to
ensure that important content doesn't end up outside the display.
</p>
</td>
</tr>
</tbody>
</table>
## Every macro under the sun
**Well, almost every macro. Hopefully only the ones that are in active use.**
An HTTP error code meaning "Bad Gateway".
A server can act as a gateway or proxy (go-between) between a client (like your Web browser) and another, upstream server.
When you request to access a URL, the gateway server can relay your request to the upstream server.
"502" means that the upstream server has returned an invalid response.
- JavaScript Array on MDN
Listening for mouse movement is even easier than listening for key presses: all we need is the listener for the mousemove event.
## Browser compatibility
## Axis-Aligned Bounding Box
One of the simpler forms of collision detection is between two rectangles that are axis aligned — meaning no rotation.
The algorithm works by ensuring there is no gap between any of the 4 sides of the rectangles.
Any gap means a collision does not exist.
```js
var rect1 = { x: 5, y: 5, width: 50, height: 50 };
var rect2 = { x: 20, y: 10, width: 10, height: 10 };
if (
rect1.x < rect2.x + rect2.width &&
rect1.x + rect1.width > rect2.x &&
rect1.y < rect2.y + rect2.height &&
rect1.y + rect1.height > rect2.y
) {
// collision detected!
}
// filling in the values =>
if (5 < 30 && 55 > 20 && 5 < 20 && 55 > 10) {
// collision detected!
}
Rect code
<div id="cr-stage"></div>
<p>
Move the rectangle with arrow keys. Green means collision, blue means no
collision.
</p>
<script src="https://cdnjs.cloudflare.com/ajax/libs/crafty/0.5.4/crafty-min.js"></script>
Crafty.init(200, 200);
var dim1 = { x: 5, y: 5, w: 50, h: 50 };
var dim2 = { x: 20, y: 10, w: 60, h: 40 };
var rect1 = Crafty.e("2D, Canvas, Color").attr(dim1).color("red");
var rect2 = Crafty.e("2D, Canvas, Color, Keyboard, Fourway")
.fourway(2)
.attr(dim2)
.color("blue");
rect2.bind("EnterFrame", function () {
if (
rect1.x > rect2.x + rect2.w &&
rect1.x + rect1.w > rect2.x &&
rect1.y > rect2.y + rect2.h &&
rect1.h + rect1.y > rect2.y
) {
// collision detected!
this.color("green");
} else {
// no collision
this.color("blue");
}
});
700
tabs.mutedInfo
Obsolete CSSOM interfaces
WheelEvent
100%
- Accessibility resources at MDN
- Web accessibility on Wikipedia
The AvailableInWorkers macro inserts a localized note box indicating that a feature is available in a Web worker context.
- Create a canvas element and set its
widthandheightattributes to the original, smaller resolution. - Set its CSS width and height properties to be 2x or 4x the value of the HTML
widthandheight. If the canvas was created with a 128 pixel width, for example, we would set the CSSwidthto512pxif we wanted a 4x scale. - Set the canvas element's
image-renderingCSS property to some value that does not make the image blurry. Eithercrisp-edgesorpixelatedwill work. Check out the image-rendering article for more information on the differences between these values, and which prefixes to use depending on the browser.
- MDN Web Docs Glossary:
-
XHR
-
AJAX on Wikipedia
- Learn: Making network requests with JavaScript
- XMLHttpRequest
- Fetch API
- Using Fetch API
- Synchronous vs. Asynchronous Communications
Types
- alarms.Alarm
- : Information about a particular alarm.
