jsquery_node 1.0.4 → 1.0.6

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/jsquery.js CHANGED
@@ -264,9 +264,7 @@ export const { $, JSQuery } = (() => {
264
264
  function J(q) {
265
265
  return Element.from(document.querySelector(q));
266
266
  }
267
- J.from = (elt) => {
268
- return Element.from(elt);
269
- };
267
+ J.from = Element.from;
270
268
  J.all = (q) => {
271
269
  return Element.from(document.querySelectorAll(q));
272
270
  };
package/jsquery.ts CHANGED
@@ -75,7 +75,9 @@ export const { $, JSQuery } = (() => {
75
75
  }
76
76
  this.on(e, func, s);
77
77
  }
78
- static from(elt: HTMLElement | NodeList | HTMLCollection): Element | ElementArray {
78
+ static from(elt: HTMLElement): Element|null;
79
+ static from(elt: NodeList|HTMLCollection): ElementArray;
80
+ static from(elt: HTMLElement | NodeList | HTMLCollection): Element | ElementArray | null {
79
81
  if (elt == null) {
80
82
  return null;
81
83
  }
@@ -158,7 +160,7 @@ export const { $, JSQuery } = (() => {
158
160
  hasClass(name: string) {
159
161
  return this.elt.classList.contains(name);
160
162
  }
161
- $(q: any): Element {
163
+ $(q: any): Element|null {
162
164
  return J.from(this.elt.querySelector(q)) as any;
163
165
  }
164
166
  all(q: any): ElementArray {
@@ -265,13 +267,11 @@ export const { $, JSQuery } = (() => {
265
267
  }
266
268
  }
267
269
 
268
- function J(q: any): Element {
270
+ function J(q: any): Element | null {
269
271
  return Element.from(document.querySelector(q)) as any;
270
272
  }
271
-
272
- J.from = (elt: HTMLElement | NodeList | HTMLCollection) => {
273
- return Element.from(elt);
274
- };
273
+
274
+ J.from = Element.from;
275
275
 
276
276
  J.all = (q: any): ElementArray => {
277
277
  return Element.from(document.querySelectorAll(q)) as any;
@@ -348,6 +348,7 @@ export const { $, JSQuery } = (() => {
348
348
  })();
349
349
 
350
350
  export type ElementArray = typeof JSQuery.ElementArray;
351
- export type Element = typeof JSQuery.ElementArray;
351
+ export type Element = typeof JSQuery.Element;
352
352
  export type Extension = typeof JSQuery.Extension;
353
353
  export type Plugin = typeof JSQuery.Extension;
354
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsquery_node",
3
- "version": "1.0.4",
3
+ "version": "1.0.6",
4
4
  "description": "jsquery",
5
5
  "homepage": "https://github.com/chickencuber/jsquery_node#readme",
6
6
  "bugs": {