unprint 0.4.1 → 0.4.3

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/README.md +6 -1
  2. package/package.json +1 -1
  3. package/src/app.js +3 -3
package/README.md CHANGED
@@ -74,7 +74,12 @@ Options
74
74
  Returns
75
75
  ```javascript
76
76
  {
77
- query, // (object) unprint querying methods
77
+ context: { // using select or no option
78
+ query, // (object) unprint querying methods
79
+ },
80
+ context: [{ // using selectAll
81
+ query,
82
+ }],
78
83
  html, // (string) HTML body
79
84
  data, // (object) parsed JSON response
80
85
  status, // (number) HTTP status code
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unprint",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "Simplify common web scraping tasks while staying in control of the data.",
5
5
  "main": "src/app.js",
6
6
  "scripts": {
package/src/app.js CHANGED
@@ -508,13 +508,13 @@ function initAll(context, selector, options) {
508
508
  return initAll(window.document, selector, { ...options, window });
509
509
  }
510
510
 
511
- if (!(context instanceof globalWindow.HTMLElement)) {
511
+ if (!isDomObject(context)) {
512
512
  // the context is not a valid
513
513
  return handleError(new Error('Init context is not a DOM element, HTML or an array'), 'INVALID_CONTEXT');
514
514
  }
515
515
 
516
- return Array.from(context.querySelectorAll(options.select))
517
- .map((element) => init(element, selector, options));
516
+ return Array.from(context.querySelectorAll(selector))
517
+ .map((element) => init(element, null, options));
518
518
  }
519
519
 
520
520
  async function request(url, body, customOptions = {}, method = 'GET') {