1 | [1]: https://secure.travis-ci.org/litejs/dom-lite.png
|
2 | [2]: https://travis-ci.org/litejs/dom-lite
|
3 | [3]: https://coveralls.io/repos/litejs/dom-lite/badge.png
|
4 | [4]: https://coveralls.io/r/litejs/dom-lite
|
5 | [npm package]: https://npmjs.org/package/dom-lite
|
6 | [GitHub repo]: https://github.com/litejs/dom-lite
|
7 |
|
8 |
|
9 | @version 0.3.1
|
10 | @date 2015-02-02
|
11 | @stability 2 - Unstable
|
12 |
|
13 |
|
14 | DOM lite – [![Build][1]][2] [![Coverage][3]][4]
|
15 | ========
|
16 |
|
17 | A small DOM implementation
|
18 | where most of DOM attributes and methods are implemented.
|
19 |
|
20 |
|
21 | Examples
|
22 | --------
|
23 |
|
24 | ```javascript
|
25 | var document = require("dom-lite").document;
|
26 |
|
27 | var el = document.createElement("h1");
|
28 | el.id = 123;
|
29 | el.className = "large";
|
30 |
|
31 | var fragment = document.createDocumentFragment();
|
32 | var text1 = document.createTextNode("hello");
|
33 | var text2 = document.createTextNode(" world");
|
34 |
|
35 | fragment.appendChild(text1);
|
36 | fragment.appendChild(text2);
|
37 | el.appendChild(fragment);
|
38 |
|
39 | el.toString();
|
40 | // <h1 id="123" class="large">hello world</h1>
|
41 | el.outerHTML;
|
42 | // <h1 id="123" class="large">hello world</h1>
|
43 | el.innerHTML;
|
44 | // hello world
|
45 | ```
|
46 |
|
47 | Implementation notes
|
48 | --------------------
|
49 |
|
50 | - `innerHTML` and `outerHTML` are read only
|
51 | - `querySelector()`, `querySelectorAll()`, `closest()` and `matches()`
|
52 | does not support CSS3 selectors
|
53 |
|
54 |
|
55 |
|
56 | Coding Style Guidelines
|
57 | -----------------------
|
58 |
|
59 | - Use tabs for indentation, align with spaces
|
60 | - Use lowerCamelCase for method and variable names
|
61 | - Use UpperCamelCase for constructor names
|
62 | - Commit files with Unix-style line endings
|
63 | - Do not use spaces in file and directory names
|
64 | Consider substituting a dash (-) where you would normally use spaces.
|
65 | - Rebase before pushing
|
66 | - Fix tests before push or pull request
|
67 |
|
68 |
|
69 | External links
|
70 | --------------
|
71 |
|
72 | - [GitHub repo][]
|
73 | - [npm package][]
|
74 | - [DOM spec](http://dom.spec.whatwg.org/)
|
75 |
|
76 |
|
77 |
|
78 | ### Licence
|
79 |
|
80 | Copyright (c) 2014-2015 Lauri Rooden <lauri@rooden.ee>
|
81 | [The MIT License](http://lauri.rooden.ee/mit-license.txt)
|
82 |
|
83 |
|