unprint 0.10.9 → 0.10.11
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/package.json +1 -1
- package/src/app.js +13 -1
package/package.json
CHANGED
package/src/app.js
CHANGED
|
@@ -135,7 +135,9 @@ function extractContent(element, options) {
|
|
|
135
135
|
|
|
136
136
|
if (attributeKey) {
|
|
137
137
|
// handle attribute extraction in content method so all methods can easily optionally query a specific attribute
|
|
138
|
-
const attribute =
|
|
138
|
+
const attribute = options.forceGetAttribute
|
|
139
|
+
? element.getAttribute(attributeKey)
|
|
140
|
+
: element[attributeKey] || element.getAttribute(attributeKey);
|
|
139
141
|
|
|
140
142
|
if (attribute && options.trim) {
|
|
141
143
|
return trim(attribute);
|
|
@@ -350,6 +352,7 @@ function queryUrl(context, selector = 'a', customOptions) {
|
|
|
350
352
|
const options = {
|
|
351
353
|
...context.options,
|
|
352
354
|
attribute: 'href',
|
|
355
|
+
forceGetAttribute: true, // don't get origin URL when empty
|
|
353
356
|
...customOptions,
|
|
354
357
|
};
|
|
355
358
|
|
|
@@ -362,6 +365,7 @@ function queryUrls(context, selector = 'a', customOptions) {
|
|
|
362
365
|
const options = {
|
|
363
366
|
...context.options,
|
|
364
367
|
attribute: 'href',
|
|
368
|
+
forceGetAttribute: true, // don't get origin URL when empty
|
|
365
369
|
...customOptions,
|
|
366
370
|
};
|
|
367
371
|
|
|
@@ -401,6 +405,7 @@ function queryImage(context, selector = 'img', customOptions) {
|
|
|
401
405
|
const options = {
|
|
402
406
|
...context.options,
|
|
403
407
|
...customOptions,
|
|
408
|
+
forceGetAttribute: true, // don't get origin URL when empty
|
|
404
409
|
};
|
|
405
410
|
|
|
406
411
|
const imageUrl = getImageUrl(context, selector, options);
|
|
@@ -412,6 +417,7 @@ function queryImages(context, selector = 'img', customOptions) {
|
|
|
412
417
|
const options = {
|
|
413
418
|
...context.options,
|
|
414
419
|
...customOptions,
|
|
420
|
+
forceGetAttribute: true, // don't get origin URL when empty
|
|
415
421
|
};
|
|
416
422
|
|
|
417
423
|
const imageUrls = getImageUrls(context, selector, options);
|
|
@@ -477,6 +483,7 @@ function queryVideo(context, selector = 'source', customOptions) {
|
|
|
477
483
|
const options = {
|
|
478
484
|
...context.options,
|
|
479
485
|
attribute: 'src',
|
|
486
|
+
forceGetAttribute: true, // don't get origin URL when empty
|
|
480
487
|
...customOptions,
|
|
481
488
|
};
|
|
482
489
|
|
|
@@ -489,6 +496,7 @@ function queryVideos(context, selector = 'source', customOptions) {
|
|
|
489
496
|
const options = {
|
|
490
497
|
...context.options,
|
|
491
498
|
attribute: 'src',
|
|
499
|
+
forceGetAttribute: true, // don't get origin URL when empty
|
|
492
500
|
...customOptions,
|
|
493
501
|
};
|
|
494
502
|
|
|
@@ -869,6 +877,10 @@ module.exports = {
|
|
|
869
877
|
extractDuration,
|
|
870
878
|
extractTimestamp,
|
|
871
879
|
formatDate,
|
|
880
|
+
dateConstants: {
|
|
881
|
+
ISO_8601: moment.ISO_8601,
|
|
882
|
+
...moment.HTML5_FMT,
|
|
883
|
+
},
|
|
872
884
|
prefixUrl,
|
|
873
885
|
options: configure,
|
|
874
886
|
query: initQueryFns(queryFns),
|