m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/html.md
blob: 85e6911336781858ebc31b7f0ea6da773575e305 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# HTML stuff

## DOM manipulation

    // create new element
    document.createElement('button')
    
    // append child
    element1.appendChild(element2)
    
## Elements

### Button

By default, a button has type `reset` or `submit`, both of which reload the
page. To avoid reloading:

    <button type='button'></button>

### Checkbox

To check by default:

    <input type='checkbox' checked>

### Built-in collapsable

    <details>
        <summary>Description</summary>
        The rest of this text will be hidden until this is expanded.
    </details>

### Definitions

    <dl>
        <dt>Term</dt>
        <dd>Defintion of term</dd>
        ...
    </dl>

## CLI parsing with `pup`

`pup` is a little command line parser, inspired by `jq`.

    pup --file <file> '<selectors> [display function]'

By default pretty prints the full selected HTML elements. Setting display
function to `text{}` prints out just the inner text.

### Extracting attributes

Use the `attr` display function.

    pup ... audio attr{src}