@litejs/dom 26.3.0 → 26.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.
Files changed (3) hide show
  1. package/css.js +2 -2
  2. package/dom.js +9 -2
  3. package/package.json +1 -1
package/css.js CHANGED
@@ -8,7 +8,7 @@ exports.CSSStyleSheet = CSSStyleSheet
8
8
 
9
9
  /* c8 ignore next */
10
10
  var URL = global.URL || require("url").URL
11
- , varRe = /var\((--[^,)]+)(?:,([^)]+))?\)/g
11
+ , varRe = /var\((--[^,)]+),?\s*([^)]*)\)/g
12
12
  , CSS = exports.CSS = {
13
13
  escape(sel) {
14
14
  return ("" + sel).replace(/[^a-zA-Z0-9_\u00A0-\uFFFF-]/g, "\\$&").replace(/^(-?)([0-9])/, "$1\\3$2 ")
@@ -91,7 +91,7 @@ var URL = global.URL || require("url").URL
91
91
  q ? (q = str.indexOf("'") == -1 ? "'" : "\"", q + str.replace(q === "'" ? /\\(")/g : /\\(')/g, "$1")) + q :
92
92
  c ? "" :
93
93
  _.replace(/[\t\n]+/g, " ")
94
- .replace(/ +(?=[,;{}>~+\/])/g, "").replace(/([,;{}>~+\/]) +/g, "$1")
94
+ .replace(/ *([,;{}>~+\/]) */g, "$1")
95
95
  .replace(/;(?=})/g, "")
96
96
  .replace(/: +/g, ":")
97
97
  .replace(/([ :,])0\.([0-9])/g, "$1.$2")
package/dom.js CHANGED
@@ -223,10 +223,10 @@ var boolAttrs = {
223
223
  }
224
224
  , Element = {
225
225
  get firstElementChild() {
226
- return getElement(this.childNodes, 0, 1, 1)
226
+ return getElement(this.childNodes, 0, 1)
227
227
  },
228
228
  get lastElementChild() {
229
- return getElement(this.childNodes, this.childNodes.length - 1, -1, 1)
229
+ return getElement(this.childNodes, this.childNodes.length - 1, -1)
230
230
  },
231
231
  get nextElementSibling() {
232
232
  return getSibling(this, 1, 1)
@@ -414,6 +414,13 @@ extendNode(HTMLElement, Element, {
414
414
  get elements() {
415
415
  return this.tagName === "FORM" ? selector.find(this, "input,select,textarea,button") : undefined
416
416
  },
417
+ get labels() {
418
+ if (!selector.matches(this, "input,select,textarea,button")) return
419
+ var labels = this.id ? selector.find(this.ownerDocument, "label[for='" + this.id + "']") : []
420
+ , parent = selector.closest(this, "label")
421
+ if (parent && labels.indexOf(parent) < 0) labels.push(parent)
422
+ return labels
423
+ },
417
424
  get sheet() {
418
425
  return makeSheet(this)
419
426
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@litejs/dom",
3
- "version": "26.3.0",
3
+ "version": "26.4.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>",