@litejs/ui 23.3.4 → 23.4.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/index.js CHANGED
@@ -1336,11 +1336,11 @@
1336
1336
  done: function() {
1337
1337
  var t = this
1338
1338
  , parent = t.parent
1339
- , arr = t.attr
1340
- t = elCache[t.name] = t._done()
1341
- if (arr[0]) {
1342
- // TODO:2023-03-22:lauri:Add new scope
1343
- }
1339
+ elCache[t.name] = t._done()
1340
+ //, arr = t.attr
1341
+ //if (arr[0]) {
1342
+ // // TODO:2023-03-22:lauri:Add new scope
1343
+ //}
1344
1344
  return parent
1345
1345
  }
1346
1346
  }),
package/load.js CHANGED
@@ -28,9 +28,11 @@
28
28
  // MSXML 6.0 has improved XSD, deprecated several legacy features
29
29
  // What's New in MSXML 6.0: https://msdn.microsoft.com/en-us/library/ms753751.aspx
30
30
 
31
- !function(window, Function, setTimeout) {
31
+ !function(window, Function) {
32
32
  xhr._s = new Date()
33
33
  var loaded = {}
34
+ // IE9, move setTimeout from window.prototype to window object cache, so you can override it later
35
+ , setTimeout_ = (window.setTimeout = window.setTimeout) || setTimeout
34
36
  , rewrite = {
35
37
  //!{loadRewrite}
36
38
  }
@@ -42,7 +44,7 @@
42
44
  window.execScript ||
43
45
  /*** inject ***/
44
46
  // THANKS: Juriy Zaytsev - Global eval [http://perfectionkills.com/global-eval-what-are-the-options/]
45
- Function("e,eval", "try{return e('eval')==e&&e}catch(e){}")(eval) ||
47
+ Function("e,eval", "try{return e('eval')}catch(e){}")(eval) ||
46
48
  Function("a", "var d=document,b=d.body,s=d.createElement('script');s.text=a;b.removeChild(b.insertBefore(s,b.firstChild))")
47
49
  /*/
48
50
  eval
@@ -70,14 +72,14 @@
70
72
  , error && (error.stack || error.stacktrace) || "-"
71
73
  , "" + location
72
74
  ]
73
- )) setTimeout(sendErrors, 307)
75
+ )) setTimeout_(sendErrors, 307)
74
76
  }
75
77
 
76
78
  function sendErrors() {
77
79
  if (xhr.err) {
78
80
  xhr.err(unsentErrors)
79
81
  } else {
80
- setTimeout(sendErrors, 1307)
82
+ setTimeout_(sendErrors, 1307)
81
83
  }
82
84
  }
83
85
  /*/
@@ -119,7 +121,7 @@
119
121
  // if (sessionID) xhr.setRequestHeader("Cookie", sessionID);
120
122
  // if (xhr.getResponseHeader("Set-Cookie")) sessionID = xhr.getResponseHeader("Set-Cookie");
121
123
 
122
- xhr.open(method, url, next !== true)
124
+ xhr.open(method, rewrite[url] || url, next !== true)
123
125
 
124
126
  // With IE 8 XMLHttpRequest gains the timeout property.
125
127
  // With the timeout property, Web developers can specify
@@ -222,7 +224,7 @@
222
224
  , len = files && files.length
223
225
  , res = []
224
226
 
225
- for (; i < len; i++) if ((file = files[i]) && 2 !== loaded[file = rewrite[file] || file]) {
227
+ for (; i < len; i++) if ((file = files[i]) && 2 !== loaded[file]) {
226
228
  if (loaded[file]) {
227
229
  // Same file requested again
228
230
  ;(loaded[file].x || (loaded[file].x = [])).push(cb, file, i)
@@ -254,7 +256,7 @@
254
256
  if (++pos < len) exec()
255
257
  /*** inject ***/
256
258
  // inject can be async
257
- else if (pos === len) setTimeout(exec, 1)
259
+ else if (pos === len) setTimeout_(exec, 1)
258
260
  /**/
259
261
  else {
260
262
  if (next) next()
@@ -272,5 +274,5 @@
272
274
  /**/
273
275
 
274
276
  function nop() {}
275
- }(this, Function, setTimeout) // jshint ignore:line
277
+ }(this, Function) // jshint ignore:line
276
278
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litejs/ui",
3
- "version": "23.3.4",
3
+ "version": "23.4.0",
4
4
  "description": "UI engine for LiteJS full-stack framework",
5
5
  "license": "MIT",
6
6
  "author": "Lauri Rooden <lauri@rooden.ee>",
@@ -25,7 +25,7 @@
25
25
  "test": "TZ='Europe/Tallinn' lj test test/index.js --brief --coverage && jshint --verbose *.js src/*.js binding/*.js polyfill/*.js"
26
26
  },
27
27
  "devDependencies": {
28
- "@litejs/cli": "23.3.4",
28
+ "@litejs/cli": "23.4.0",
29
29
  "jshint": "2.13.6"
30
30
  },
31
31
  "litejs": {
package/polyfill/index.js CHANGED
@@ -21,7 +21,7 @@
21
21
 
22
22
  /* global El, xhr */
23
23
  /* c8 ignore start */
24
- !function(window, Function) {
24
+ !function(window, Function, Infinity, P) {
25
25
 
26
26
  // Array#flat() - Chrome69, Edge79, Firefox62, Safari12
27
27
  // window.PointerEvent - Chrome55, Edge12, Firefox59, Safari13, IE11
@@ -30,7 +30,6 @@
30
30
  // queueMicrotask - Chrome71, Edge79, Firefox69, Safari12.1
31
31
 
32
32
  var isArr, oKeys
33
- , P = "prototype"
34
33
  , O = window
35
34
  , patched = (window.xhr || window)._p = []
36
35
  , jsonRe = /[\x00-\x1f\x22\x5c]/g
@@ -173,7 +172,7 @@
173
172
  try {
174
173
  // FF4-beta with dom.storage.enabled=false throws for accessing windows.localStorage
175
174
  // iOS5 private browsing throws for localStorage.setItem()
176
- return window[name].setItem(name, name)
175
+ return window[name += "Storage"].setItem(name, name)
177
176
  } catch(e){}
178
177
  /***
179
178
  } else if (el.addBehavior) {
@@ -217,8 +216,8 @@
217
216
  patch(name, data, 1)
218
217
  }
219
218
 
220
- createStorage("sessionStorage") // Chrome5, FF2, IE8, Safari4
221
- createStorage("localStorage") // Chrome5, FF3.5, IE8, Safari4
219
+ createStorage("session") // Chrome5, FF2, IE8, Safari4
220
+ createStorage("local") // Chrome5, FF3.5, IE8, Safari4
222
221
 
223
222
  // 20 fps is good enough
224
223
  patch("requestAnimationFrame", "return setTimeout(a,50)")
@@ -230,6 +229,10 @@
230
229
  // IE8 has console, however, the console object does not exist if the console is not opened.
231
230
  patch("console", {log: nop, error: nop})
232
231
 
232
+ /*** ie9 ***/
233
+ patch("matchMedia", "b=a||'all';return{media:b,matches:X?X.matchMedium(b):!1,addListener:Y}", 0, window.styleMedia || window.media, nop)
234
+ /**/
235
+
233
236
 
234
237
  function jsonFn(str) {
235
238
  return JSONmap[str] || esc(str).replace(/%u/g, "\\u").replace(/%/g, "\\x")
@@ -243,21 +246,19 @@
243
246
  // IE 8 serializes `undefined` as `"undefined"`
244
247
  return (
245
248
  isStr(o) ? "\"" + o.replace(jsonRe, jsonFn) + "\"" :
246
- o && typeof o == "object" ? (
249
+ o !== o || o == null || o === Infinity || o === -Infinity ? "null" :
250
+ typeof o == "object" ? (
247
251
  isFn(o.toJSON) ? stringify(o.toJSON()) :
248
252
  isArr(o) ? "[" + o.map(stringify) + "]" :
249
- "{" + oKeys(o).map(function(a){return stringify(a) + ":" + stringify(o[a])}) + "}"
253
+ "{" + oKeys(o).flatMap(function(a){
254
+ return o[a] === void 0 ? [] : stringify(a) + ":" + stringify(o[a])
255
+ }) + "}"
250
256
  ) :
251
- typeof o == "number" && !isFinite(o) ? "null" :
252
257
  "" + o
253
258
  )
254
259
  }
255
260
  })
256
261
 
257
- /*** ie9 ***/
258
- patch("matchMedia", "b=a||'all';return{media:b,matches:X?X.matchMedium(b):!1,addListener:Y}", 0, window.styleMedia || window.media, nop)
259
- /**/
260
-
261
262
  O = patch("performance")
262
263
  patch("p:now", (a = "return+new Date") + "-X", 0, new Date())
263
264
  patch("timing")
@@ -326,10 +327,11 @@
326
327
  // Fixed in Safari 12.0.1 and iOS 12.1 on October 30, 2018
327
328
  // patch("reverse", "if(X(t))t.length=t.length;return O.call(t)", "2,1" != [1, 2].reverse(), isArr)
328
329
 
329
- // In ES3 standard the second deleteCount argument is required, IE<=8 requires deleteCount
330
- patch("splice", "if(b===Y)A[1]=t.length-a;return O.apply(t,A)", "1,2" != [1, 2].splice(0))
330
+ // In ES3 the second deleteCount argument is required, IE<=8 requires deleteCount
331
+ // IE6-9 silently fails to write to the arguments object, make it to array first.
332
+ patch("splice", "if(b===Y){A=S.call(A);A[1]=t.length-a}return O.apply(t,A)", "1,2" != [1, 2].splice(0))
331
333
 
332
- b = a + "while(++i<l)if(i in t)"
334
+ b = a + "while(++i<l)"
333
335
  patch("every", b + "if(!a.call(b,t[i],i,t))return!1;return!0")
334
336
  patch("forEach", b + "a.call(b,t[i],i,t)")
335
337
 
@@ -386,7 +388,7 @@
386
388
  "": "c(_.parentNode,v)"
387
389
  }
388
390
  , matches = patch("matches", "return!!X(a)(t)", 0, selectorFn)
389
- , closest = patch("closest", "return X(t,'parentNode',a,1)", 0, walk)
391
+ , closest = walk.bind(window, "parentNode", 1)
390
392
 
391
393
  // Note: querySelector in IE8 supports only CSS 2.1 selectors
392
394
  patch((b="querySelector"), (a = "return X(t,a,") + "1)", ie678, find)
@@ -425,18 +427,18 @@
425
427
  }).join("||") + "}"
426
428
  )(matches, closest))
427
429
  }
428
- function walk(el, by, sel, first, nextFn) {
429
- var out = []
430
- if (!isFn(sel)) sel = selectorFn(sel)
431
- for (; el; el = el[by] || nextFn && nextFn(el)) if (sel(el)) {
432
- if (first === 1) return el
430
+ function walk(next, first, el, sel, nextFn) {
431
+ sel = selectorFn(sel)
432
+ for (var out = []; el; el = el[next] || nextFn && nextFn(el)) if (sel(el)) {
433
+ if (first) return el
433
434
  out.push(el)
434
435
  }
435
- return first === 1? null : out
436
+ return first ? null : out
436
437
  }
438
+
437
439
  function find(node, sel, first) {
438
- return walk(node.firstChild, "firstChild", sel, first, function(el) {
439
- for (var next = el.nextSibling; !next && ((el = el.parentNode) !== node);) next = el.nextSibling
440
+ return walk("firstChild", first, node.firstChild, sel, function(el) {
441
+ for (var next = el.nextSibling; !next && ((el = el.parentNode) !== node); ) next = el.nextSibling
440
442
  return next
441
443
  })
442
444
  }
@@ -469,7 +471,7 @@
469
471
  src || {}
470
472
  ))
471
473
  }
472
- }(this, Function) // jshint ignore:line
474
+ }(this, Function, Infinity, "prototype") // jshint ignore:line
473
475
  /* c8 ignore stop */
474
476
 
475
477