testaro 36.1.1 → 36.1.2
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/procs/isInlineLink.js +9 -3
package/package.json
CHANGED
package/procs/isInlineLink.js
CHANGED
|
@@ -28,11 +28,17 @@
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
exports.isInlineLink = async loc => await loc.evaluate(element => {
|
|
31
|
+
let listAncestor;
|
|
31
32
|
// Initialize the link as inline.
|
|
32
33
|
let result = true;
|
|
33
|
-
// If
|
|
34
|
-
const
|
|
35
|
-
if (
|
|
34
|
+
// If its display style property is block:
|
|
35
|
+
const styleDec = window.getComputedStyle(element);
|
|
36
|
+
if (styleDec.display === 'block') {
|
|
37
|
+
// Reclassify the link as non-inline.
|
|
38
|
+
result = false;
|
|
39
|
+
}
|
|
40
|
+
// Otherwise, if it is in a list item in a list of at least 2 links:
|
|
41
|
+
else if (listAncestor = element.closest('ul, ol')) {
|
|
36
42
|
if (listAncestor.children.length > 1 && Array.from(listAncestor.children).every(child => {
|
|
37
43
|
const isValidListItem = child.tagName === 'LI';
|
|
38
44
|
const has1Link = child.querySelectorAll('a').length === 1;
|