donobu 2.37.3 → 2.37.4

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.
@@ -1 +1 @@
1
- 1362
1
+ 1363
@@ -182,7 +182,15 @@
182
182
  };
183
183
 
184
184
  // Semantic HTML5 elements that are likely to be unique and stable.
185
- const LANDMARK_TAGS = ['header', 'nav', 'main', 'footer', 'form'];
185
+ const LANDMARK_TAGS = [
186
+ 'html',
187
+ 'body',
188
+ 'header',
189
+ 'nav',
190
+ 'main',
191
+ 'footer',
192
+ 'form',
193
+ ];
186
194
 
187
195
  /**
188
196
  * Safely escapes text for use in XPath expressions.
@@ -740,8 +748,19 @@
740
748
  cur = p;
741
749
  }
742
750
 
743
- if (segs.length) {
744
- // Lowest priority
751
+ if (segs.length === 0) {
752
+ const rootDoc = getDocumentForScope(this.root);
753
+
754
+ if (this.el === rootDoc?.documentElement) {
755
+ this.push('html', 1);
756
+ return;
757
+ }
758
+
759
+ if (this.el === rootDoc?.body) {
760
+ this.push('body', 1);
761
+ return;
762
+ }
763
+ } else {
745
764
  this.push(segs.join(' > '), 1);
746
765
  }
747
766
  }
@@ -1 +1 @@
1
- 1362
1
+ 1363
@@ -182,7 +182,15 @@
182
182
  };
183
183
 
184
184
  // Semantic HTML5 elements that are likely to be unique and stable.
185
- const LANDMARK_TAGS = ['header', 'nav', 'main', 'footer', 'form'];
185
+ const LANDMARK_TAGS = [
186
+ 'html',
187
+ 'body',
188
+ 'header',
189
+ 'nav',
190
+ 'main',
191
+ 'footer',
192
+ 'form',
193
+ ];
186
194
 
187
195
  /**
188
196
  * Safely escapes text for use in XPath expressions.
@@ -740,8 +748,19 @@
740
748
  cur = p;
741
749
  }
742
750
 
743
- if (segs.length) {
744
- // Lowest priority
751
+ if (segs.length === 0) {
752
+ const rootDoc = getDocumentForScope(this.root);
753
+
754
+ if (this.el === rootDoc?.documentElement) {
755
+ this.push('html', 1);
756
+ return;
757
+ }
758
+
759
+ if (this.el === rootDoc?.body) {
760
+ this.push('body', 1);
761
+ return;
762
+ }
763
+ } else {
745
764
  this.push(segs.join(' > '), 1);
746
765
  }
747
766
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "donobu",
3
- "version": "2.37.3",
3
+ "version": "2.37.4",
4
4
  "description": "Create browser automations with an LLM agent and replay them as Playwright scripts.",
5
5
  "main": "dist/main.js",
6
6
  "module": "dist/esm/main.js",