@litejs/dom 23.2.2 → 23.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -18,7 +18,7 @@ Examples
18
18
 
19
19
  ```javascript
20
20
  const { document, DOMParser, XMLSerializer } = require("@litejs/dom");
21
- const { XMLHttpRequest } = require("@litejs/dom/xmlhttprequest");
21
+ const { XMLHttpRequest } = require("@litejs/dom/net");
22
22
 
23
23
  // Use XMLHttpRequest in server side
24
24
  var xhr = new XMLHttpRequest()
package/index.js CHANGED
@@ -1,9 +1,6 @@
1
1
 
2
2
 
3
- /**
4
- * @author Lauri Rooden <lauri@rooden.ee>
5
- * @license MIT License
6
- */
3
+ /*! litejs.com/MIT-LICENSE.txt */
7
4
 
8
5
 
9
6
  var boolAttrs = {
@@ -11,7 +8,7 @@ var boolAttrs = {
11
8
  }
12
9
  , defaultAttrs = {
13
10
  "form method get":1, "input type text":1,
14
- "script type text/javascript":1, "style type text/css": 1
11
+ "script type text/javascript":1, "style type text/css":1
15
12
  }
16
13
  , voidElements = {
17
14
  AREA:1, BASE:1, BR:1, COL:1, EMBED:1, HR:1, IMG:1, INPUT:1, KEYGEN:1, LINK:1, MENUITEM:1, META:1, PARAM:1, SOURCE:1, TRACK:1, WBR:1
package/interactive.js CHANGED
@@ -1,5 +1,8 @@
1
1
 
2
2
 
3
+ /*! litejs.com/MIT-LICENSE.txt */
4
+
5
+
3
6
  var DOM = module.exports = require(".")
4
7
  , HTMLElementExtra = {
5
8
  focus: function() {
@@ -1,5 +1,8 @@
1
1
  /* global unescape */
2
2
 
3
+ /*! litejs.com/MIT-LICENSE.txt */
4
+
5
+
3
6
  var DOM = require(".")
4
7
  , parser = new DOM.DOMParser()
5
8
  , dataUrlRe = /^data:([^;,]*?)(;[^,]+?|),(.*)$/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litejs/dom",
3
- "version": "23.2.2",
3
+ "version": "23.3.0",
4
4
  "description": "A small DOM library for server-side testing, rendering, and handling of HTML files",
5
5
  "license": "MIT",
6
6
  "author": "Lauri Rooden <lauri@rooden.ee>",
@@ -16,11 +16,12 @@
16
16
  "*.js"
17
17
  ],
18
18
  "scripts": {
19
- "test": "lj test --coverage --ignore=xmlhttprequest.js --brief test/index.js && jshint *.js"
19
+ "test": "lj test --coverage --ignore=net.js --brief test/index.js && jshint *.js",
20
+ "test-fast": "lj test --brief test/index.js"
20
21
  },
21
22
  "repository": "github:litejs/dom",
22
23
  "devDependencies": {
23
- "@litejs/cli": "23.2.6",
24
+ "@litejs/cli": "23.3.5",
24
25
  "jshint": "2.13.6"
25
26
  },
26
27
  "litejs": {
package/selector.js CHANGED
@@ -1,12 +1,6 @@
1
1
 
2
2
 
3
-
4
- /**
5
- * @version 20.2.0
6
- * @author Lauri Rooden <lauri@rooden.ee>
7
- * @license MIT License
8
- */
9
-
3
+ /*! litejs.com/MIT-LICENSE.txt */
10
4
 
11
5
 
12
6
  !function(exports) {
@@ -45,11 +39,12 @@
45
39
  "~~": "p(_,v)",
46
40
  "": "c(_.parentNode,v)"
47
41
  }
42
+ , closest = exports.closest = walk.bind(exports, "parentNode", 1)
43
+
48
44
 
49
45
  selectorMap["nth-last-child"] = selectorMap["nth-child"].replace("1+", "v.length-")
50
46
 
51
47
  function selectorFn(str) {
52
- // jshint evil:true, unused:true, eqnull:true
53
48
  if (str != null && typeof str !== "string") throw Error("Invalid selector")
54
49
  return selectorCache[str || ""] ||
55
50
  (selectorCache[str] = Function("m,c,n,p", "return function(_,v,a,b){return " +
@@ -83,8 +78,8 @@
83
78
 
84
79
 
85
80
  function walk(next, first, el, sel, nextFn) {
86
- var out = []
87
- for (sel = selectorFn(sel); el; el = el[next] || nextFn && nextFn(el)) if (sel(el)) {
81
+ sel = selectorFn(sel)
82
+ for (var out = []; el; el = el[next] || nextFn && nextFn(el)) if (sel(el)) {
88
83
  if (first) return el
89
84
  out.push(el)
90
85
  }
@@ -93,8 +88,7 @@
93
88
 
94
89
  function find(node, sel, first) {
95
90
  return walk("firstChild", first, node.firstChild, sel, function(el) {
96
- var next = el.nextSibling
97
- while (!next && ((el = el.parentNode) !== node)) next = el.nextSibling
91
+ for (var next = el.nextSibling; !next && ((el = el.parentNode) !== node); ) next = el.nextSibling
98
92
  return next
99
93
  })
100
94
  }
@@ -103,10 +97,6 @@
103
97
  return !!selectorFn(sel)(el)
104
98
  }
105
99
 
106
- function closest(el, sel) {
107
- return walk("parentNode", 1, el, sel)
108
- }
109
-
110
100
  function next(el, sel) {
111
101
  return walk("nextSibling", 1, el.nextSibling, sel)
112
102
  }
@@ -115,11 +105,9 @@
115
105
  return walk("previousSibling", 1, el.previousSibling, sel)
116
106
  }
117
107
 
118
-
119
108
  exports.find = find
120
109
  exports.fn = selectorFn
121
110
  exports.matches = matches
122
- exports.closest = closest
123
111
  exports.next = next
124
112
  exports.prev = prev
125
113
  exports.selectorMap = selectorMap