cucu 1.3.9__tar.gz → 1.3.10__tar.gz

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.

Potentially problematic release.


This version of cucu might be problematic. Click here for more details.

Files changed (93) hide show
  1. {cucu-1.3.9 → cucu-1.3.10}/PKG-INFO +1 -1
  2. {cucu-1.3.9 → cucu-1.3.10}/pyproject.toml +1 -1
  3. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/fuzzy/core.py +7 -1
  4. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/fuzzy/fuzzy.js +78 -53
  5. {cucu-1.3.9 → cucu-1.3.10}/README.md +0 -0
  6. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/__init__.py +0 -0
  7. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/ansi_parser.py +0 -0
  8. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/behave_tweaks.py +0 -0
  9. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/browser/__init__.py +0 -0
  10. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/browser/core.py +0 -0
  11. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/browser/frames.py +0 -0
  12. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/browser/selenium.py +0 -0
  13. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/browser/selenium_tweaks.py +0 -0
  14. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/cli/__init__.py +0 -0
  15. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/cli/core.py +0 -0
  16. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/cli/run.py +0 -0
  17. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/cli/steps.py +0 -0
  18. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/cli/thread_dumper.py +0 -0
  19. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/config.py +0 -0
  20. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/db.py +0 -0
  21. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/edgedriver_autoinstaller/README.md +0 -0
  22. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/edgedriver_autoinstaller/__init__.py +0 -0
  23. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/edgedriver_autoinstaller/utils.py +0 -0
  24. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/environment.py +0 -0
  25. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/external/jquery/jquery-3.5.1.min.js +0 -0
  26. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/formatter/__init__.py +0 -0
  27. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/formatter/cucu.py +0 -0
  28. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/formatter/json.py +0 -0
  29. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/formatter/junit.py +0 -0
  30. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/formatter/rundb.py +0 -0
  31. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/fuzzy/__init__.py +0 -0
  32. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/helpers.py +0 -0
  33. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/hooks.py +0 -0
  34. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/init_data/.gitignore +0 -0
  35. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/init_data/README.md +0 -0
  36. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/init_data/cucurc.yml +0 -0
  37. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/init_data/data/www/example.html +0 -0
  38. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/init_data/features/cucurc.yml +0 -0
  39. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/init_data/features/environment.py +0 -0
  40. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/init_data/features/example.feature +0 -0
  41. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/init_data/features/lint_rules/sid.yaml +0 -0
  42. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/init_data/features/steps/__init__.py +0 -0
  43. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/init_data/features/steps/my_steps.py +0 -0
  44. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/language_server/__init__.py +0 -0
  45. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/language_server/core.py +0 -0
  46. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/lint/__init__.py +0 -0
  47. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/lint/linter.py +0 -0
  48. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/lint/rules/format.yaml +0 -0
  49. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/logger.py +0 -0
  50. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/matcher/__init__.py +0 -0
  51. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/matcher/core.py +0 -0
  52. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/page_checks.py +0 -0
  53. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/__init__.py +0 -0
  54. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/external/bootstrap.min.css +0 -0
  55. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/external/bootstrap.min.js +0 -0
  56. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/external/dataTables.bootstrap.min.css +0 -0
  57. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/external/dataTables.bootstrap.min.js +0 -0
  58. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/external/jquery-3.5.1.min.js +0 -0
  59. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/external/jquery.dataTables.min.js +0 -0
  60. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/external/popper.min.js +0 -0
  61. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/favicon.png +0 -0
  62. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/html.py +0 -0
  63. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/templates/feature.html +0 -0
  64. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/templates/flat.html +0 -0
  65. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/templates/index.html +0 -0
  66. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/templates/layout.html +0 -0
  67. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/reporter/templates/scenario.html +0 -0
  68. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/__init__.py +0 -0
  69. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/base_steps.py +0 -0
  70. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/browser_steps.py +0 -0
  71. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/button_steps.py +0 -0
  72. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/checkbox_steps.py +0 -0
  73. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/command_steps.py +0 -0
  74. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/draggable_steps.py +0 -0
  75. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/dropdown_steps.py +0 -0
  76. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/file_input_steps.py +0 -0
  77. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/filesystem_steps.py +0 -0
  78. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/flow_control_steps.py +0 -0
  79. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/image_steps.py +0 -0
  80. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/input_steps.py +0 -0
  81. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/link_steps.py +0 -0
  82. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/menuitem_steps.py +0 -0
  83. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/platform_steps.py +0 -0
  84. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/radio_steps.py +0 -0
  85. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/section_steps.py +0 -0
  86. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/step_utils.py +0 -0
  87. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/tab_steps.py +0 -0
  88. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/table_steps.py +0 -0
  89. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/tables.js +0 -0
  90. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/text_steps.py +0 -0
  91. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/variable_steps.py +0 -0
  92. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/steps/webserver_steps.py +0 -0
  93. {cucu-1.3.9 → cucu-1.3.10}/src/cucu/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: cucu
3
- Version: 1.3.9
3
+ Version: 1.3.10
4
4
  Summary: Easy BDD web testing
5
5
  Keywords: cucumber,selenium,behave
6
6
  Author: Domino Data Lab, Rodney Gomes, Cedric Young, Xin Dong, Kavya Yakkati, Kevin Garton, Joy Liao
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "cucu"
3
- version = "1.3.9"
3
+ version = "1.3.10"
4
4
  description = "Easy BDD web testing"
5
5
  readme = "README.md"
6
6
  license = { text = "The Clear BSD License" }
@@ -97,6 +97,7 @@ def find(
97
97
  str(index),
98
98
  str(direction.value),
99
99
  name_within_thing,
100
+ "true"
100
101
  ]
101
102
 
102
103
  def execute_fuzzy_find():
@@ -104,4 +105,9 @@ def find(
104
105
  script = f"return cucu.fuzzy_find({','.join(args)});"
105
106
  return browser.execute(script)
106
107
 
107
- return search_in_all_frames(browser, execute_fuzzy_find)
108
+ fuzzy_return = search_in_all_frames(browser, execute_fuzzy_find)
109
+ if fuzzy_return is None:
110
+ logger.info("Fuzzy found no element.")
111
+ return None
112
+ logger.info("Fuzzy found element by search term {}".format(fuzzy_return[1]))
113
+ return fuzzy_return[0]
@@ -54,13 +54,15 @@
54
54
  things,
55
55
  index=0,
56
56
  direction=LEFT_TO_RIGHT,
57
- name_within_thing=false) {
57
+ name_within_thing=false,
58
+ insert_label=false) {
58
59
  var elements = [];
60
+ var element_labels = [];
59
61
  var results = null;
60
62
  var attributes = ['aria-label', 'title', 'placeholder', 'value'];
61
63
  var matchers = ['has_text', 'contains'];
62
64
 
63
- name = name.replaceAll('"', '\\"')
65
+ name = name.replaceAll('"', '\\"');
64
66
 
65
67
  /*
66
68
  * try to match on exact text but ultimately fall back to matching on
@@ -75,24 +77,27 @@
75
77
  for(var tIndex = 0; tIndex < things.length; tIndex++) {
76
78
  var thing = things[tIndex];
77
79
 
78
- /*
79
- * <thing>name</thing>
80
- */
81
- results = jqCucu(thing + ':vis:' + matcher + '("' + name + '")', document.body).toArray();
82
- if (cucu.debug) { console.log('<thing>name</thing>', results); }
80
+ var nameInTagContentLabel = `<${thing}>${name}</${thing}>`;
81
+ var nameInTagContentJq = `${thing}:vis:${matcher}("${name}")`;
82
+ results = jqCucu(nameInTagContentJq, document.body).toArray();
83
+ if (cucu.debug) { console.log(nameInTagContentLabel, results); }
83
84
  elements = elements.concat(results);
85
+ element_labels = element_labels.concat(results.map(x => nameInTagContentLabel));
84
86
 
85
- // <thing attribute="name"></thing>
86
87
  for(var aIndex=0; aIndex < attributes.length; aIndex++) {
87
88
  var attribute_name = attributes[aIndex];
89
+ var nameIsAttributeLabel = `<${thing} attribute="${attribute_name}"></${thing}>`;
88
90
  if (matcher == 'has_text') {
89
- results = jqCucu(thing + '[' + attribute_name + '="' + name + '"]:vis', document.body).toArray();
90
- if (cucu.debug) { console.log('<thing attribute="name"></thing>', results); }
91
+ var nameIsAttributeJq = `${thing}[${attribute_name}="${name}"]:vis`;
92
+ results = jqCucu(nameIsAttributeJq, document.body).toArray();
93
+ if (cucu.debug) { console.log(nameIsAttributeLabel, results); }
91
94
  } else if (matcher == 'contains') {
92
- results = jqCucu(thing + '[' + attribute_name + '*="' + name + '"]:vis', document.body).toArray();
93
- if (cucu.debug) { console.log('<thing attribute*="name"></thing>', results); }
95
+ var nameInAttributeJq = `${thing}[${attribute_name}*="${name}"]:vis`;
96
+ results = jqCucu(nameInAttributeJq, document.body).toArray();
97
+ if (cucu.debug) { console.log(nameIsAttributeLabel, results); }
94
98
  }
95
99
  elements = elements.concat(results);
100
+ element_labels = element_labels.concat(results.map(x => nameIsAttributeLabel));
96
101
  }
97
102
  }
98
103
 
@@ -107,38 +112,44 @@
107
112
  for(var tIndex = 0; tIndex < things.length; tIndex++) {
108
113
  var thing = things[tIndex];
109
114
 
110
- // <thing value="name"></thing>
111
115
  if (matcher == 'has_text') {
112
- results = jqCucu(thing + ':vis', document.body).filter(function(){
116
+ var nameIsValueLabel = `${thing} value="${name}"></${thing}>`;
117
+ var nameIsValueJq = `${thing}:vis`;
118
+ results = jqCucu(nameInValueJq, document.body).filter(function(){
113
119
  return this.value == name;
114
120
  }).toArray();
115
- if (cucu.debug) { console.log('<thing value="name"></thing>', results); }
121
+ if (cucu.debug) { console.log(nameIsValueLabel, results); }
116
122
  } else if (matcher == 'contains') {
117
- results = jqCucu(thing + ':vis', document.body).filter(function(){
123
+ var nameInValueLabel = `${thing} value*="${name}"></${thing}>`;
124
+ var nameInValueJq = `${thing}:vis`;
125
+ results = jqCucu(nameInValueJq, document.body).filter(function(){
118
126
  return this.value !== undefined && String(this.value).indexOf(name) != -1;
119
127
  }).toArray();
120
- if (cucu.debug) { console.log('<thing value*="name"></thing>', results); }
128
+ if (cucu.debug) { console.log(nameInValueLabel, results); }
121
129
  }
122
130
  elements = elements.concat(results);
131
+ element_labels = element_labels.concat(results.map(x => nameInValueLabel));
123
132
  }
124
133
 
125
134
  /*
126
135
  * element labeled by another using the for/id attributes
127
136
  */
128
- var labels = jqCucu('*[for]:vis:' + matcher + '("' + name + '")', document.body).toArray();
137
+ var labelForNameJq = `*[for]:vis:${matcher}("${name}")`
138
+ var labels = jqCucu(labelForNameJq, document.body).toArray();
129
139
  for(var tIndex = 0; tIndex < things.length; tIndex++) {
130
140
  var thing = things[tIndex];
131
141
  results = [];
132
142
 
133
- /*
134
- * <* for=...>name</*>...<thing id=...></thing>
135
- */
143
+ var labelForNameLabel = `<* for=...>${name}</*>...<${thing} id=...></${thing}>`;
136
144
  for(var lIndex=0; lIndex < labels.length; lIndex++) {
137
145
  var label = labels[lIndex];
138
146
  var id = label.getAttribute('for');
139
- results = jqCucu(thing + '[id="' + id + '"]:vis', document.body).toArray();
140
- if (cucu.debug) { console.log('<* for=...>name</*>...<thing id=...></thing>', results); }
147
+ var idMatchesForLabelJq = `${thing}[id="${id}"]:vis`;
148
+ results = jqCucu(idMatchesForLabelJq, document.body).toArray();
149
+
150
+ if (cucu.debug) { console.log(labelForNameLabel, results); }
141
151
  elements = elements.concat(results);
152
+ element_labels = element_labels.concat(results.map(x => labelForNameLabel));
142
153
  }
143
154
  }
144
155
 
@@ -148,19 +159,23 @@
148
159
  for(var tIndex = 0; tIndex < things.length; tIndex++) {
149
160
  var thing = things[tIndex];
150
161
 
151
- /*
152
- * <thing><*>...name...</*></thing>
153
- */
162
+ var nameInNestedChildLabel = `<${thing}><*>...${name}...</*></${thing}>`;
154
163
  results = jqCucu('*:vis:' + matcher + '("' + name + '")', document.body).parents(thing).toArray();
155
- if (cucu.debug) { console.log('<thing><*>...name...</*></thing>', results); }
164
+ if (cucu.debug) { console.log(nameInNestedChildLabel, results); }
156
165
  elements = elements.concat(results);
166
+ if (results.length > 0) {
167
+ console.log('!*!*!* Found element labeled by nested child!');
168
+ console.log(`!*!*!* elements: ${elements}`);
169
+ }
170
+ element_labels = element_labels.concat(results.map(x => nameInNestedChildLabel));
157
171
 
158
- // <thing><* attribute="name"></*></thing>
159
172
  for(var aIndex=0; aIndex < attributes.length; aIndex++) {
160
173
  var attribute_name = attributes[aIndex];
161
- results = jqCucu('*:vis[' + attribute_name + '="' + name + '"]', document.body).parents(thing).toArray();
162
- if (cucu.debug) { console.log('<thing><* attibute="name"></*></thing>', results); }
174
+ var innerNestedElementsLabel = `<${thing}><* ${attribute_name}="${name}"></*></${thing}>`;
175
+ results = jqCucu(`*:vis[${attribute_name}="${name}"]`, document.body).parents(thing).toArray();
176
+ if (cucu.debug) { console.log(innerNestedElementsLabel, results); }
163
177
  elements = elements.concat(results);
178
+ element_labels = element_labels.concat(results.map(x => innerNestedElementsLabel));
164
179
  }
165
180
  }
166
181
 
@@ -174,10 +189,11 @@
174
189
  for(var tIndex = 0; tIndex < things.length; tIndex++) {
175
190
  var thing = things[tIndex];
176
191
 
177
- // <*>name</*><thing/>
178
- results = jqCucu('*:vis:' + matcher + '("' + name + '")', document.body).next(thing + ':vis').toArray();
179
- if (cucu.debug) { console.log('<*>name</*><thing/>', results); }
192
+ var nameIsPreviousSiblingLabel = `<*>${name}</*><${thing}/>`;
193
+ results = jqCucu(`*:vis:${matcher}("${name}")`, document.body).next(thing + ':vis').toArray();
194
+ if (cucu.debug) { console.log(nameIsPreviousSiblingLabel, results); }
180
195
  elements = elements.concat(results);
196
+ element_labels = element_labels.concat(results.map(x => nameIsPreviousSiblingLabel));
181
197
  }
182
198
  }
183
199
 
@@ -186,10 +202,11 @@
186
202
  for(var tIndex = 0; tIndex < things.length; tIndex++) {
187
203
  var thing = things[tIndex];
188
204
 
189
- // <thing/><*>name</*>
190
- results = jqCucu('*:vis:' + matcher + '("' + name + '")', document.body).prev(thing).toArray();
191
- if (cucu.debug) { console.log('<thing/><*>name</*>', results); }
205
+ var nameIsNextSiblingLabel = `<${thing}/><*>${name}</*>`;
206
+ results = jqCucu(`*:vis:${matcher}("${name}")`, document.body).prev(thing).toArray();
207
+ if (cucu.debug) { console.log(nameIsNextSiblingLabel, results); }
192
208
  elements = elements.concat(results);
209
+ element_labels = element_labels.concat(results.map(x => nameIsNextSiblingLabel));
193
210
  }
194
211
  }
195
212
 
@@ -199,12 +216,11 @@
199
216
  for(var tIndex = 0; tIndex < things.length; tIndex++) {
200
217
  var thing = things[tIndex];
201
218
 
202
- /*
203
- * <*><thing></thing>name</*>
204
- */
205
- results = jqCucu('*:vis:' + matcher + '("' + name + '")', document.body).children(thing + ':vis').toArray();
206
- if (cucu.debug) { console.log('<*><thing></thing>name</*>', results); }
219
+ var nameIsTextSiblingLabel = `<*><${thing}></${thing}>${name}</*>`;
220
+ results = jqCucu(`*:vis:${matcher}("${name}")`, document.body).children(thing + ':vis').toArray();
221
+ if (cucu.debug) { console.log(nameIsTextSiblingLabel, results); }
207
222
  elements = elements.concat(results);
223
+ element_labels = element_labels.concat(results.map(x => nameIsTextSiblingLabel));
208
224
  }
209
225
 
210
226
  // element labeled with any previous sibling
@@ -212,17 +228,19 @@
212
228
  for(var tIndex = 0; tIndex < things.length; tIndex++) {
213
229
  var thing = things[tIndex];
214
230
 
215
- // <*>name</*>...<thing>...
216
- results = jqCucu('*:vis:' + matcher + '("' + name + '")', document.body).nextAll(thing + ':vis').toArray();
217
- if (cucu.debug) { console.log('<*>name</*>...<thing>...', results); }
231
+ var leftToRightLabel = `<*>${name}</*>...<${thing}>...`;
232
+ results = jqCucu(`*:vis:${matcher}("${name}")`, document.body).nextAll(thing + ':vis').toArray();
233
+ if (cucu.debug) { console.log(leftToRightLabel, results); }
218
234
  elements = elements.concat(results);
235
+ element_labels = element_labels.concat(results.map(x => leftToRightLabel));
219
236
 
220
- // <...><*>name</*></...>...<...><thing></...>
237
+ var leftToRightGrandpaLabel = `<...><*>${name}</*></...>...<...><${thing}></...>`;
221
238
  // XXX: this rule is horribly complicated and I'd rather see it gone
222
239
  // basically: common great grandpranet
223
- results = jqCucu('*:vis:' + matcher + '("' + name + '")', document.body).nextAll().find(thing + ':vis').toArray();
224
- if (cucu.debug) { console.log('<...><*>name</*></...>...<...><thing></...>', results); }
240
+ results = jqCucu(`*:vis:${matcher}("${name}")`, document.body).nextAll().find(thing + ':vis').toArray();
241
+ if (cucu.debug) { console.log(leftToRightGrandpaLabel, results); }
225
242
  elements = elements.concat(results);
243
+ element_labels = element_labels.concat(results.map(x => leftToRightGrandpaLabel));
226
244
  }
227
245
  }
228
246
 
@@ -231,22 +249,29 @@
231
249
  for(var tIndex = 0; tIndex < things.length; tIndex++) {
232
250
  var thing = things[tIndex];
233
251
 
234
- // next siblings: <thing>...<*>name</*>...
235
- results = jqCucu('*:vis:' + matcher + '("' + name + '")', document.body).prevAll(thing).toArray();
236
- if (cucu.debug) { console.log('<thing>...<*>name</*>...', results); }
252
+ var rightToLeftLabel = `<${thing}>...<*>${name}</*>...`;
253
+ results = jqCucu(`*:vis:${matcher}("${name}")`, document.body).prevAll(thing).toArray();
254
+ if (cucu.debug) { console.log(rightToLeftLabel, results); }
237
255
  elements = elements.concat(results);
256
+ element_labels = element_labels.concat(results.map(x => rightToLeftLabel));
238
257
 
239
- // <...><thing></...>...<...><*>name</*></...>
258
+ var rightToLeftGrandpaLabel = `<...><${thing}></...>...<...><*>${name}</*></...>`;
240
259
  // XXX: this rule is horribly complicated and I'd rather see it gone
241
- results = jqCucu('*:vis:' + matcher + '("' + name + '")', document.body).prevAll().find(thing + ':vis').toArray();
242
- if (cucu.debug) { console.log('<...><thin></...>...<...><*>name</*></...>', results); }
260
+ results = jqCucu(`*:vis:${matcher}("${name}")`, document.body).prevAll().find(thing + ':vis').toArray();
261
+ if (cucu.debug) { console.log(rightToLeftGrandpaLabel, results); }
243
262
  elements = elements.concat(results);
263
+ element_labels = element_labels.concat(results.map(x => rightToLeftGrandpaLabel));
244
264
  }
245
265
  }
246
266
  }
247
267
 
248
268
  if (cucu.debug) {
249
269
  console.log(elements);
270
+ console.log(element_labels);
271
+ }
272
+
273
+ if (elements.length > 0 && insert_label) {
274
+ return [elements[index], element_labels[index]];
250
275
  }
251
276
  return elements[index];
252
277
  };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes