capybara-simulated 0.1.1 → 0.2.0
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.
- checksums.yaml +4 -4
- data/README.md +75 -9
- data/lib/capybara/simulated/browser.rb +410 -72
- data/lib/capybara/simulated/driver.rb +92 -13
- data/lib/capybara/simulated/errors.rb +7 -0
- data/lib/capybara/simulated/js/bridge.bundle.js +402 -51
- data/lib/capybara/simulated/node.rb +19 -3
- data/lib/capybara/simulated/runtime_shared.rb +10 -0
- data/lib/capybara/simulated/v8_runtime.rb +64 -9
- data/lib/capybara/simulated/version.rb +1 -1
- metadata +1 -1
|
@@ -3061,22 +3061,6 @@
|
|
|
3061
3061
|
else n._attrs.checked = "";
|
|
3062
3062
|
}
|
|
3063
3063
|
__name(toggleChecked, "toggleChecked");
|
|
3064
|
-
function formNamedAccess(form) {
|
|
3065
|
-
if (form._namedAccessProxy) return form._namedAccessProxy;
|
|
3066
|
-
const proxy = new Proxy(form, {
|
|
3067
|
-
get(target, key) {
|
|
3068
|
-
if (key in target) return target[key];
|
|
3069
|
-
if (typeof key !== "string") return target[key];
|
|
3070
|
-
for (const f of target.elements || []) {
|
|
3071
|
-
if (f._attrs && (f._attrs.name === key || f._attrs.id === key)) return f;
|
|
3072
|
-
}
|
|
3073
|
-
return void 0;
|
|
3074
|
-
}
|
|
3075
|
-
});
|
|
3076
|
-
form._namedAccessProxy = proxy;
|
|
3077
|
-
return proxy;
|
|
3078
|
-
}
|
|
3079
|
-
__name(formNamedAccess, "formNamedAccess");
|
|
3080
3064
|
function checkedRadioInGroup(n) {
|
|
3081
3065
|
const name = n._attrs.name;
|
|
3082
3066
|
if (!name) return n._attrs.checked != null ? n : null;
|
|
@@ -3290,7 +3274,7 @@
|
|
|
3290
3274
|
event.target = event._csimRetargets.has(node) ? event._csimRetargets.get(node) : event._csimTopRetarget;
|
|
3291
3275
|
}
|
|
3292
3276
|
if (!capture && node._attrs && !event._immediatePropagationStopped) {
|
|
3293
|
-
const attrName = "on" + event.type;
|
|
3277
|
+
const attrName = "on" + event.type.toLowerCase();
|
|
3294
3278
|
const propHandler = typeof node[attrName] === "function" ? node[attrName] : null;
|
|
3295
3279
|
const attrVal = propHandler ? null : node._attrs[attrName];
|
|
3296
3280
|
let handler = propHandler;
|
|
@@ -3535,6 +3519,18 @@
|
|
|
3535
3519
|
});
|
|
3536
3520
|
}
|
|
3537
3521
|
__name(fireCEDisconnect, "fireCEDisconnect");
|
|
3522
|
+
function fireCEMoveReactions(subtree) {
|
|
3523
|
+
walk(subtree, (el) => {
|
|
3524
|
+
if (!registry.has(el._tag)) return;
|
|
3525
|
+
if (typeof el.connectedMoveCallback === "function") {
|
|
3526
|
+
fireCEHook(el, "connectedMoveCallback");
|
|
3527
|
+
} else {
|
|
3528
|
+
fireCEHook(el, "disconnectedCallback");
|
|
3529
|
+
fireCEHook(el, "connectedCallback");
|
|
3530
|
+
}
|
|
3531
|
+
});
|
|
3532
|
+
}
|
|
3533
|
+
__name(fireCEMoveReactions, "fireCEMoveReactions");
|
|
3538
3534
|
globalThis.customElements = customElements;
|
|
3539
3535
|
|
|
3540
3536
|
// lib/capybara/simulated/js/src/html-parser.js
|
|
@@ -3681,7 +3677,7 @@
|
|
|
3681
3677
|
]);
|
|
3682
3678
|
var P_SCOPE_BOUNDARY = /* @__PURE__ */ new Set(["applet", "caption", "html", "table", "td", "th", "marquee", "object", "template", "button"]);
|
|
3683
3679
|
var DOCTYPE_RE = /^\s*<!doctype\s+([^\s>]+)(?:\s+(?:public\s+("[^"]*"|'[^']*')(?:\s+("[^"]*"|'[^']*'))?|system\s+("[^"]*"|'[^']*')))?[^>]*>/i;
|
|
3684
|
-
function installHtmlParser({ Document: Document2, Element: Element2, Text: Text2, Comment: Comment2, DocumentFragment: DocumentFragment2, DocumentType: DocumentType2, createHtmlPageDocument: createHtmlPageDocument2 }) {
|
|
3680
|
+
function installHtmlParser({ Document: Document2, Element: Element2, Text: Text2, Comment: Comment2, DocumentFragment: DocumentFragment2, DocumentType: DocumentType2, createHtmlPageDocument: createHtmlPageDocument2, registerNamedAccess: registerNamedAccess2 }) {
|
|
3685
3681
|
const unquote = /* @__PURE__ */ __name((s) => s == null ? "" : s.slice(1, -1), "unquote");
|
|
3686
3682
|
const HTML_NS_P = "http://www.w3.org/1999/xhtml";
|
|
3687
3683
|
const SVG_NS_P = "http://www.w3.org/2000/svg";
|
|
@@ -3975,7 +3971,10 @@
|
|
|
3975
3971
|
if (fa) (el._attrNS || (el._attrNS = {}))[fa.key] = fa.meta;
|
|
3976
3972
|
continue;
|
|
3977
3973
|
}
|
|
3978
|
-
|
|
3974
|
+
const k = asciiLowerAttr(m[1]);
|
|
3975
|
+
const dv = decodeEntities(v);
|
|
3976
|
+
el._attrs[k] = dv;
|
|
3977
|
+
if (k === "id" || k === "name") registerNamedAccess2(el, k, dv);
|
|
3979
3978
|
}
|
|
3980
3979
|
}
|
|
3981
3980
|
__name(applyAttributes, "applyAttributes");
|
|
@@ -4644,6 +4643,16 @@
|
|
|
4644
4643
|
} catch (_) {
|
|
4645
4644
|
globalThis.document = void 0;
|
|
4646
4645
|
}
|
|
4646
|
+
try {
|
|
4647
|
+
delete globalThis.open;
|
|
4648
|
+
} catch (_) {
|
|
4649
|
+
globalThis.open = void 0;
|
|
4650
|
+
}
|
|
4651
|
+
try {
|
|
4652
|
+
delete globalThis.opener;
|
|
4653
|
+
} catch (_) {
|
|
4654
|
+
globalThis.opener = void 0;
|
|
4655
|
+
}
|
|
4647
4656
|
globalThis.WorkerGlobalScope = globalThis.WorkerGlobalScope || /* @__PURE__ */ __name(function WorkerGlobalScope() {
|
|
4648
4657
|
}, "WorkerGlobalScope");
|
|
4649
4658
|
globalThis.DedicatedWorkerGlobalScope = globalThis.DedicatedWorkerGlobalScope || /* @__PURE__ */ __name(function DedicatedWorkerGlobalScope() {
|
|
@@ -6266,7 +6275,13 @@
|
|
|
6266
6275
|
// lib/capybara/simulated/js/src/xml-parser.js
|
|
6267
6276
|
var XML_NS = "http://www.w3.org/XML/1998/namespace";
|
|
6268
6277
|
var XMLNS_NS = "http://www.w3.org/2000/xmlns/";
|
|
6278
|
+
var PARSERERROR_NS = "http://www.mozilla.org/newlayout/xml/parsererror.xml";
|
|
6269
6279
|
var isWs = /* @__PURE__ */ __name((c) => c === " " || c === " " || c === "\n" || c === "\r" || c === "\f", "isWs");
|
|
6280
|
+
var isNCName = /* @__PURE__ */ __name((s) => /^[A-Za-z_][\w.\-]*$/.test(s), "isNCName");
|
|
6281
|
+
var isQName = /* @__PURE__ */ __name((s) => {
|
|
6282
|
+
const c = s.indexOf(":");
|
|
6283
|
+
return c === -1 ? isNCName(s) : isNCName(s.slice(0, c)) && isNCName(s.slice(c + 1));
|
|
6284
|
+
}, "isQName");
|
|
6270
6285
|
function findTagEnd(s, lt) {
|
|
6271
6286
|
let q = null;
|
|
6272
6287
|
for (let i = lt + 1; i < s.length; i++) {
|
|
@@ -6282,6 +6297,7 @@
|
|
|
6282
6297
|
function parseTag(inner) {
|
|
6283
6298
|
let i = 0;
|
|
6284
6299
|
const n = inner.length;
|
|
6300
|
+
let err = false;
|
|
6285
6301
|
while (i < n && isWs(inner[i])) i++;
|
|
6286
6302
|
let nameEnd = i;
|
|
6287
6303
|
while (nameEnd < n && !isWs(inner[nameEnd])) nameEnd++;
|
|
@@ -6291,30 +6307,35 @@
|
|
|
6291
6307
|
while (i < n) {
|
|
6292
6308
|
while (i < n && (isWs(inner[i]) || inner[i] === "/")) i++;
|
|
6293
6309
|
if (i >= n) break;
|
|
6310
|
+
if (inner[i] === "=") {
|
|
6311
|
+
err = true;
|
|
6312
|
+
break;
|
|
6313
|
+
}
|
|
6294
6314
|
let ae = i;
|
|
6295
6315
|
while (ae < n && !isWs(inner[ae]) && inner[ae] !== "=") ae++;
|
|
6296
6316
|
const aname = inner.slice(i, ae);
|
|
6297
6317
|
i = ae;
|
|
6298
6318
|
while (i < n && isWs(inner[i])) i++;
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6319
|
+
if (inner[i] !== "=") {
|
|
6320
|
+
err = true;
|
|
6321
|
+
break;
|
|
6322
|
+
}
|
|
6323
|
+
i++;
|
|
6324
|
+
while (i < n && isWs(inner[i])) i++;
|
|
6325
|
+
const q = inner[i];
|
|
6326
|
+
if (q !== '"' && q !== "'") {
|
|
6327
|
+
err = true;
|
|
6328
|
+
break;
|
|
6329
|
+
}
|
|
6330
|
+
const end = inner.indexOf(q, i + 1);
|
|
6331
|
+
if (end === -1) {
|
|
6332
|
+
err = true;
|
|
6333
|
+
break;
|
|
6314
6334
|
}
|
|
6315
|
-
|
|
6335
|
+
attrs.push({ name: aname, value: decodeEntities(inner.slice(i + 1, end)) });
|
|
6336
|
+
i = end + 1;
|
|
6316
6337
|
}
|
|
6317
|
-
return { name, attrs };
|
|
6338
|
+
return { name, attrs, err };
|
|
6318
6339
|
}
|
|
6319
6340
|
__name(parseTag, "parseTag");
|
|
6320
6341
|
function installXmlParser({ Element: Element2, Text: Text2, Comment: Comment2, ProcessingInstruction: ProcessingInstruction2, CDATASection: CDATASection2, DocumentType: DocumentType2 }) {
|
|
@@ -6341,6 +6362,7 @@
|
|
|
6341
6362
|
const stack = [];
|
|
6342
6363
|
const nsStack = [{ xml: XML_NS }];
|
|
6343
6364
|
let i = 0;
|
|
6365
|
+
let err = false;
|
|
6344
6366
|
const append = /* @__PURE__ */ __name((node) => {
|
|
6345
6367
|
if (stack.length) {
|
|
6346
6368
|
node._parent = stack[stack.length - 1];
|
|
@@ -6380,30 +6402,58 @@
|
|
|
6380
6402
|
}
|
|
6381
6403
|
} else if (s[i + 1] === "/") {
|
|
6382
6404
|
const end = s.indexOf(">", i);
|
|
6383
|
-
|
|
6405
|
+
const raw = end === -1 ? s.slice(i + 2) : s.slice(i + 2, end);
|
|
6406
|
+
const endName = raw.replace(/\s+$/, "");
|
|
6407
|
+
if (end === -1 || /^\s/.test(raw) || !endName) err = true;
|
|
6408
|
+
if (stack.length === 0) {
|
|
6409
|
+
err = true;
|
|
6410
|
+
} else {
|
|
6411
|
+
const top2 = stack[stack.length - 1];
|
|
6412
|
+
const openName = top2._prefix ? top2._prefix + ":" + top2._localName : top2._localName;
|
|
6413
|
+
if (endName !== openName) err = true;
|
|
6384
6414
|
stack.pop();
|
|
6385
6415
|
nsStack.pop();
|
|
6386
6416
|
}
|
|
6387
6417
|
i = end === -1 ? n : end + 1;
|
|
6388
6418
|
} else {
|
|
6419
|
+
if (isWs(s[i + 1])) err = true;
|
|
6389
6420
|
const end = findTagEnd(s, i);
|
|
6390
6421
|
if (end === -1) {
|
|
6422
|
+
err = true;
|
|
6391
6423
|
i = n;
|
|
6392
6424
|
break;
|
|
6393
6425
|
}
|
|
6394
6426
|
let inner = s.slice(i + 1, end);
|
|
6395
6427
|
const selfClose = /\/\s*$/.test(inner);
|
|
6396
6428
|
if (selfClose) inner = inner.replace(/\/\s*$/, "");
|
|
6397
|
-
const { name, attrs } = parseTag(inner);
|
|
6429
|
+
const { name, attrs, err: tagErr } = parseTag(inner);
|
|
6430
|
+
if (tagErr || !isQName(name)) err = true;
|
|
6398
6431
|
i = end + 1;
|
|
6399
6432
|
const scope = Object.assign({}, nsStack[nsStack.length - 1]);
|
|
6400
6433
|
for (const a of attrs) {
|
|
6401
|
-
if (a.name === "xmlns")
|
|
6402
|
-
|
|
6434
|
+
if (a.name === "xmlns") {
|
|
6435
|
+
scope[""] = a.value || null;
|
|
6436
|
+
} else if (a.name.slice(0, 6) === "xmlns:") {
|
|
6437
|
+
const p = a.name.slice(6);
|
|
6438
|
+
if (!isNCName(p) || p === "xmlns") err = true;
|
|
6439
|
+
else scope[p] = a.value || null;
|
|
6440
|
+
}
|
|
6441
|
+
}
|
|
6442
|
+
for (const a of attrs) {
|
|
6443
|
+
if (a.name === "xmlns" || a.name.slice(0, 6) === "xmlns:") continue;
|
|
6444
|
+
if (!isQName(a.name)) {
|
|
6445
|
+
err = true;
|
|
6446
|
+
continue;
|
|
6447
|
+
}
|
|
6448
|
+
const ac = a.name.indexOf(":");
|
|
6449
|
+
if (ac !== -1 && a.name.slice(0, ac) !== "xml" && !(a.name.slice(0, ac) in scope)) {
|
|
6450
|
+
err = true;
|
|
6451
|
+
}
|
|
6403
6452
|
}
|
|
6404
6453
|
const colon = name.indexOf(":");
|
|
6405
6454
|
const prefix = colon === -1 ? null : name.slice(0, colon);
|
|
6406
6455
|
const localName = colon === -1 ? name : name.slice(colon + 1);
|
|
6456
|
+
if (prefix && prefix !== "xml" && !(prefix in scope)) err = true;
|
|
6407
6457
|
const ns = prefix ? scope[prefix] || null : scope[""] || null;
|
|
6408
6458
|
const el = new Element2(name);
|
|
6409
6459
|
el._localName = localName;
|
|
@@ -6437,6 +6487,16 @@
|
|
|
6437
6487
|
i = j;
|
|
6438
6488
|
}
|
|
6439
6489
|
}
|
|
6490
|
+
if (stack.length > 0) err = true;
|
|
6491
|
+
if (err) {
|
|
6492
|
+
const pe = new Element2("parsererror");
|
|
6493
|
+
pe._localName = "parsererror";
|
|
6494
|
+
pe._ns = PARSERERROR_NS;
|
|
6495
|
+
const msg = new Text2("XML parsing error");
|
|
6496
|
+
msg._parent = pe;
|
|
6497
|
+
pe._children.push(msg);
|
|
6498
|
+
return [pe];
|
|
6499
|
+
}
|
|
6440
6500
|
return top;
|
|
6441
6501
|
}
|
|
6442
6502
|
__name(parseXml2, "parseXml");
|
|
@@ -7855,6 +7915,7 @@
|
|
|
7855
7915
|
registerSubtree(c);
|
|
7856
7916
|
}
|
|
7857
7917
|
recordChildList(this, moved.slice(), [], prevSib, nextSib);
|
|
7918
|
+
if (this._tag === "script") globalThis.__csimScriptChildrenChanged(this);
|
|
7858
7919
|
if (connected) for (const c of moved) globalThis.__csimFireCEConnect(c);
|
|
7859
7920
|
for (const c of moved) askForReset(c);
|
|
7860
7921
|
return frag;
|
|
@@ -7898,6 +7959,7 @@
|
|
|
7898
7959
|
liveRangesOnInsert(this, insertIndex, 1);
|
|
7899
7960
|
registerSubtree(child);
|
|
7900
7961
|
recordChildList(this, [child], []);
|
|
7962
|
+
if (this._tag === "script") globalThis.__csimScriptChildrenChanged(this);
|
|
7901
7963
|
if (isConnected(this)) globalThis.__csimFireCEConnect(child);
|
|
7902
7964
|
askForReset(child);
|
|
7903
7965
|
return child;
|
|
@@ -7920,6 +7982,9 @@
|
|
|
7920
7982
|
this._children.splice(i, 1);
|
|
7921
7983
|
child._parent = null;
|
|
7922
7984
|
unregisterSubtree(child);
|
|
7985
|
+
const doc = globalThis.document;
|
|
7986
|
+
const ae = doc && doc._activeElement;
|
|
7987
|
+
if (ae && (ae === child || nodeContains(child, ae))) doc._activeElement = null;
|
|
7923
7988
|
recordChildList(this, [], [child], prevSib, nextSib);
|
|
7924
7989
|
if (wasConnected) fireCEDisconnect(child);
|
|
7925
7990
|
return child;
|
|
@@ -7942,6 +8007,7 @@
|
|
|
7942
8007
|
liveRangesOnInsert(this, i, 1);
|
|
7943
8008
|
registerSubtree(child);
|
|
7944
8009
|
recordChildList(this, [child], []);
|
|
8010
|
+
if (this._tag === "script") globalThis.__csimScriptChildrenChanged(this);
|
|
7945
8011
|
if (isConnected(this)) globalThis.__csimFireCEConnect(child);
|
|
7946
8012
|
askForReset(child);
|
|
7947
8013
|
return child;
|
|
@@ -8485,6 +8551,7 @@
|
|
|
8485
8551
|
this._vtGen = -1;
|
|
8486
8552
|
this._vtCV = -1;
|
|
8487
8553
|
this._attrsColl = null;
|
|
8554
|
+
if (this._tag === "form") Object.setPrototypeOf(this, FormNamedProto);
|
|
8488
8555
|
}
|
|
8489
8556
|
_cloneShell() {
|
|
8490
8557
|
const e = new _Element(this._tag);
|
|
@@ -8542,6 +8609,61 @@
|
|
|
8542
8609
|
}
|
|
8543
8610
|
Object.defineProperty(this, "content", { value: v, writable: true, configurable: true, enumerable: true });
|
|
8544
8611
|
}
|
|
8612
|
+
// `HTMLStyleElement.sheet` — the CSSStyleSheet associated with a connected
|
|
8613
|
+
// `<style>` (CSSOM). It exists once the element is in a document and reflects
|
|
8614
|
+
// the element's current text content, so an earlier-inserted script can
|
|
8615
|
+
// observe a later-inserted `<style>` already applied (cssRules track the text
|
|
8616
|
+
// live). Disconnected → null; `<link>` sheets (which need the fetched
|
|
8617
|
+
// resource) are not modelled here. Created lazily and cached for stable identity.
|
|
8618
|
+
get sheet() {
|
|
8619
|
+
if (this._tag === "style") {
|
|
8620
|
+
if (!this.isConnected) {
|
|
8621
|
+
this._sheet = null;
|
|
8622
|
+
return null;
|
|
8623
|
+
}
|
|
8624
|
+
const type = (this._attrs.type || "").toLowerCase();
|
|
8625
|
+
if (type && type !== "text/css") {
|
|
8626
|
+
this._sheet = null;
|
|
8627
|
+
return null;
|
|
8628
|
+
}
|
|
8629
|
+
if (!this._sheet) {
|
|
8630
|
+
this._sheet = new globalThis.CSSStyleSheet();
|
|
8631
|
+
this._sheet.ownerNode = this;
|
|
8632
|
+
}
|
|
8633
|
+
this._sheet.replaceSync(this.textContent || "");
|
|
8634
|
+
return this._sheet;
|
|
8635
|
+
}
|
|
8636
|
+
if (this._tag === "link") {
|
|
8637
|
+
const rel = (this._attrs.rel || "").toLowerCase().split(/\s+/);
|
|
8638
|
+
const href = this._attrs.href;
|
|
8639
|
+
if (!this.isConnected || !rel.includes("stylesheet") || !href) {
|
|
8640
|
+
this._sheet = null;
|
|
8641
|
+
return null;
|
|
8642
|
+
}
|
|
8643
|
+
if (!this._sheet) {
|
|
8644
|
+
this._sheet = new globalThis.CSSStyleSheet();
|
|
8645
|
+
this._sheet.ownerNode = this;
|
|
8646
|
+
this._sheet.href = href;
|
|
8647
|
+
let css = "";
|
|
8648
|
+
const dataCss = /^data:text\/css[^,]*,(.*)$/is.exec(href);
|
|
8649
|
+
if (dataCss) {
|
|
8650
|
+
try {
|
|
8651
|
+
css = decodeURIComponent(dataCss[1]);
|
|
8652
|
+
} catch (_) {
|
|
8653
|
+
css = dataCss[1];
|
|
8654
|
+
}
|
|
8655
|
+
} else {
|
|
8656
|
+
try {
|
|
8657
|
+
css = globalThis.__csimExternalAsset(href) || "";
|
|
8658
|
+
} catch (_) {
|
|
8659
|
+
}
|
|
8660
|
+
}
|
|
8661
|
+
this._sheet.replaceSync(css);
|
|
8662
|
+
}
|
|
8663
|
+
return this._sheet;
|
|
8664
|
+
}
|
|
8665
|
+
return void 0;
|
|
8666
|
+
}
|
|
8545
8667
|
// `<dialog>` HTML interface — show() / showModal() / close() per
|
|
8546
8668
|
// HTMLDialogElement. Turbo's confirm flow uses this: opens
|
|
8547
8669
|
// `<dialog id="turbo-confirm">` via `showModal()`, waits for the
|
|
@@ -8610,6 +8732,7 @@
|
|
|
8610
8732
|
const old = this._attrs[n];
|
|
8611
8733
|
const next = String(value);
|
|
8612
8734
|
this._attrs[n] = next;
|
|
8735
|
+
if ((n === "id" || n === "name") && next) registerNamedAccess(this, n, next);
|
|
8613
8736
|
if ((n === "src" || n === "srcdoc") && (this._tag === "iframe" || this._tag === "frame") && old !== next) {
|
|
8614
8737
|
const oldRealmId = this._frameRealmId;
|
|
8615
8738
|
this._frameWindow = null;
|
|
@@ -8642,6 +8765,7 @@
|
|
|
8642
8765
|
const old = this._attrs[key];
|
|
8643
8766
|
const next = String(value);
|
|
8644
8767
|
this._attrs[key] = next;
|
|
8768
|
+
if (rns === null && (localName === "id" || localName === "name") && next) registerNamedAccess(this, localName, next);
|
|
8645
8769
|
if (rns !== null || prefix !== null || key !== qn) {
|
|
8646
8770
|
(this._attrNS || (this._attrNS = {}))[key] = { ns: rns, prefix, localName };
|
|
8647
8771
|
} else if (this._attrNS) {
|
|
@@ -8711,6 +8835,7 @@
|
|
|
8711
8835
|
_setAttrNodeValue(key, value) {
|
|
8712
8836
|
const old = this._attrs[key];
|
|
8713
8837
|
this._attrs[key] = value;
|
|
8838
|
+
if ((key === "id" || key === "name") && value) registerNamedAccess(this, key, value);
|
|
8714
8839
|
recordAttrMutation(this, key, old == null ? null : old);
|
|
8715
8840
|
if (old !== value) fireAttrChangedCallback(this, key, old == null ? null : old, value, _Element);
|
|
8716
8841
|
}
|
|
@@ -8732,6 +8857,7 @@
|
|
|
8732
8857
|
const key = hasNs ? this._attrKeyByNS(attr._ns, attr._localName) || freshAttrKey(this, qn) : asciiLower2(qn);
|
|
8733
8858
|
const old = this._attrs[key];
|
|
8734
8859
|
this._attrs[key] = attr._value;
|
|
8860
|
+
if (!hasNs && (key === "id" || key === "name") && attr._value) registerNamedAccess(this, key, attr._value);
|
|
8735
8861
|
if (hasNs) (this._attrNS || (this._attrNS = {}))[key] = { ns: attr._ns, prefix: attr._prefix, localName: attr._localName };
|
|
8736
8862
|
else if (this._attrNS) delete this._attrNS[key];
|
|
8737
8863
|
attr._ownerElement = this;
|
|
@@ -9121,8 +9247,7 @@
|
|
|
9121
9247
|
// `this.form` the onclick threw and the columns never moved.
|
|
9122
9248
|
get form() {
|
|
9123
9249
|
if (!FORM_ASSOCIATED_TAGS.has(this._tag)) return void 0;
|
|
9124
|
-
|
|
9125
|
-
return form ? formNamedAccess(form) : null;
|
|
9250
|
+
return formForControl(this) || null;
|
|
9126
9251
|
}
|
|
9127
9252
|
// Form-control IDL attributes — expose the pair-of-attr-and-IDL
|
|
9128
9253
|
// shape so JS like `input.value = 'x'` / `input.checked = true`
|
|
@@ -10671,6 +10796,93 @@
|
|
|
10671
10796
|
return globalThis.customElements || null;
|
|
10672
10797
|
}
|
|
10673
10798
|
});
|
|
10799
|
+
var FormNamedProto = Object.create(Element.prototype);
|
|
10800
|
+
var FORM_NAMED_PROPS = /* @__PURE__ */ new Set();
|
|
10801
|
+
var FORM_NAMED_TAGS = /* @__PURE__ */ new Set(["input", "select", "textarea", "button", "fieldset", "object"]);
|
|
10802
|
+
function formNamedLookup(form, name) {
|
|
10803
|
+
if (!form || form._tag !== "form") return void 0;
|
|
10804
|
+
const els = form.elements;
|
|
10805
|
+
if (els) for (const c of els) {
|
|
10806
|
+
if (c._attrs && (c._attrs.name === name || c._attrs.id === name)) return c;
|
|
10807
|
+
}
|
|
10808
|
+
return void 0;
|
|
10809
|
+
}
|
|
10810
|
+
__name(formNamedLookup, "formNamedLookup");
|
|
10811
|
+
function registerFormName(el, value) {
|
|
10812
|
+
if (!value || !FORM_NAMED_TAGS.has(el._tag)) return;
|
|
10813
|
+
if (FORM_NAMED_PROPS.has(value)) return;
|
|
10814
|
+
FORM_NAMED_PROPS.add(value);
|
|
10815
|
+
if (value in FormNamedProto) return;
|
|
10816
|
+
Object.defineProperty(FormNamedProto, value, {
|
|
10817
|
+
configurable: true,
|
|
10818
|
+
enumerable: false,
|
|
10819
|
+
get() {
|
|
10820
|
+
return formNamedLookup(this, value);
|
|
10821
|
+
},
|
|
10822
|
+
// Assigning `form.<name> = x` creates an OWN property that shadows the
|
|
10823
|
+
// named getter — matching browser LegacyPlatformObject semantics (named
|
|
10824
|
+
// properties are configurable). Without a setter, strict-mode assignment
|
|
10825
|
+
// to a getter-only property THROWS; jQuery stores its private-data expando
|
|
10826
|
+
// directly on the element (`form[expando] = cache`) and also parks its
|
|
10827
|
+
// marker on `id`/`name` during scoped queries, so a getter-only named prop
|
|
10828
|
+
// would break every form jQuery binds an event to or calls `.data()` on.
|
|
10829
|
+
set(v) {
|
|
10830
|
+
Object.defineProperty(this, value, { value: v, writable: true, enumerable: true, configurable: true });
|
|
10831
|
+
}
|
|
10832
|
+
});
|
|
10833
|
+
}
|
|
10834
|
+
__name(registerFormName, "registerFormName");
|
|
10835
|
+
var WINDOW_NAMED_PROPS = /* @__PURE__ */ new Set();
|
|
10836
|
+
var WINDOW_NAME_VALUES = /* @__PURE__ */ new Set();
|
|
10837
|
+
var WINDOW_NAME_TAGS = /* @__PURE__ */ new Set(["a", "applet", "area", "embed", "form", "frameset", "frame", "iframe", "img", "object"]);
|
|
10838
|
+
var WindowNamedProps = Object.create(Object.getPrototypeOf(globalThis));
|
|
10839
|
+
if (!globalThis.__csimWindowNamedProps) {
|
|
10840
|
+
globalThis.__csimWindowNamedProps = WindowNamedProps;
|
|
10841
|
+
Object.setPrototypeOf(globalThis, WindowNamedProps);
|
|
10842
|
+
}
|
|
10843
|
+
function windowNamedLookup(name) {
|
|
10844
|
+
const doc = globalThis.document;
|
|
10845
|
+
if (!doc) return void 0;
|
|
10846
|
+
const byId2 = doc.getElementById && doc.getElementById(name);
|
|
10847
|
+
if (byId2) return byId2;
|
|
10848
|
+
if (!WINDOW_NAME_VALUES.has(name)) return void 0;
|
|
10849
|
+
let found;
|
|
10850
|
+
walkSubtree(doc, (el) => {
|
|
10851
|
+
if (found || el.nodeType !== NODE_ELEMENT) return;
|
|
10852
|
+
if (WINDOW_NAME_TAGS.has(el._tag) && el._attrs && el._attrs.name === name) found = el;
|
|
10853
|
+
});
|
|
10854
|
+
return found;
|
|
10855
|
+
}
|
|
10856
|
+
__name(windowNamedLookup, "windowNamedLookup");
|
|
10857
|
+
function registerWindowName(el, attrName, value) {
|
|
10858
|
+
if (!value) return;
|
|
10859
|
+
if (attrName === "name") {
|
|
10860
|
+
if (!WINDOW_NAME_TAGS.has(el._tag)) return;
|
|
10861
|
+
WINDOW_NAME_VALUES.add(value);
|
|
10862
|
+
}
|
|
10863
|
+
if (WINDOW_NAMED_PROPS.has(value)) return;
|
|
10864
|
+
WINDOW_NAMED_PROPS.add(value);
|
|
10865
|
+
if (value in globalThis) return;
|
|
10866
|
+
Object.defineProperty(globalThis.__csimWindowNamedProps, value, {
|
|
10867
|
+
configurable: true,
|
|
10868
|
+
enumerable: false,
|
|
10869
|
+
get() {
|
|
10870
|
+
return windowNamedLookup(value);
|
|
10871
|
+
},
|
|
10872
|
+
// As with form named access, assignment shadows the getter with an own
|
|
10873
|
+
// property (configurable named properties); without a setter, strict-mode
|
|
10874
|
+
// `window.foo = x` for an id-named `foo` would throw.
|
|
10875
|
+
set(v) {
|
|
10876
|
+
Object.defineProperty(globalThis, value, { value: v, writable: true, enumerable: true, configurable: true });
|
|
10877
|
+
}
|
|
10878
|
+
});
|
|
10879
|
+
}
|
|
10880
|
+
__name(registerWindowName, "registerWindowName");
|
|
10881
|
+
function registerNamedAccess(el, attrName, value) {
|
|
10882
|
+
registerFormName(el, value);
|
|
10883
|
+
registerWindowName(el, attrName, value);
|
|
10884
|
+
}
|
|
10885
|
+
__name(registerNamedAccess, "registerNamedAccess");
|
|
10674
10886
|
var DocumentFragment = class extends Node {
|
|
10675
10887
|
static {
|
|
10676
10888
|
__name(this, "DocumentFragment");
|
|
@@ -11424,9 +11636,16 @@
|
|
|
11424
11636
|
}
|
|
11425
11637
|
}
|
|
11426
11638
|
const dest = this;
|
|
11639
|
+
const oldDoc = node.ownerDocument;
|
|
11427
11640
|
walkSubtree(node, (n) => {
|
|
11428
11641
|
n._ownerDoc = dest;
|
|
11429
11642
|
});
|
|
11643
|
+
const oldReg = oldDoc && oldDoc._liveRanges;
|
|
11644
|
+
if (oldReg && oldReg.size) {
|
|
11645
|
+
for (const r of [...oldReg]) {
|
|
11646
|
+
if (sameTreeContains(node, r.startContainer) || sameTreeContains(node, r.endContainer)) r._track();
|
|
11647
|
+
}
|
|
11648
|
+
}
|
|
11430
11649
|
return node;
|
|
11431
11650
|
}
|
|
11432
11651
|
// `document.implementation` — a per-document, cached `DOMImplementation`
|
|
@@ -12874,6 +13093,7 @@
|
|
|
12874
13093
|
askForReset(node);
|
|
12875
13094
|
if (oldParent) recordChildList(oldParent, [], [node], prevSib, nextSib);
|
|
12876
13095
|
recordChildList(parent, [node], []);
|
|
13096
|
+
if (isConnected(node)) fireCEMoveReactions(node);
|
|
12877
13097
|
return void 0;
|
|
12878
13098
|
}
|
|
12879
13099
|
__name(moveBeforeImpl, "moveBeforeImpl");
|
|
@@ -12937,7 +13157,7 @@
|
|
|
12937
13157
|
return el._attrNodeFor(key);
|
|
12938
13158
|
}
|
|
12939
13159
|
__name(makeAttr, "makeAttr");
|
|
12940
|
-
var { parseDocument, parseFragment } = installHtmlParser({ Document, Element, Text, Comment, DocumentFragment, DocumentType, createHtmlPageDocument });
|
|
13160
|
+
var { parseDocument, parseFragment } = installHtmlParser({ Document, Element, Text, Comment, DocumentFragment, DocumentType, createHtmlPageDocument, registerNamedAccess });
|
|
12941
13161
|
var { parseXml } = installXmlParser({ Element, Text, Comment, ProcessingInstruction, CDATASection, DocumentType });
|
|
12942
13162
|
|
|
12943
13163
|
// lib/capybara/simulated/js/src/abort.js
|
|
@@ -15363,10 +15583,12 @@
|
|
|
15363
15583
|
const subAction = submitter && submitter._attrs && submitter._attrs.formaction;
|
|
15364
15584
|
const subMethod = submitter && submitter._attrs && submitter._attrs.formmethod;
|
|
15365
15585
|
const subEnctype = submitter && submitter._attrs && submitter._attrs.formenctype;
|
|
15586
|
+
const subTarget = submitter && submitter._attrs && submitter._attrs.formtarget;
|
|
15366
15587
|
return {
|
|
15367
15588
|
action: subAction != null ? subAction : form._attrs.action != null ? form._attrs.action : "",
|
|
15368
15589
|
method: (subMethod || form._attrs.method || "get").toLowerCase(),
|
|
15369
15590
|
enctype: (subEnctype || form._attrs.enctype || "application/x-www-form-urlencoded").toLowerCase(),
|
|
15591
|
+
target: subTarget != null ? subTarget : form._attrs.target != null ? form._attrs.target : "",
|
|
15370
15592
|
fields,
|
|
15371
15593
|
fileInputs
|
|
15372
15594
|
};
|
|
@@ -15667,6 +15889,28 @@
|
|
|
15667
15889
|
const n = handles.get(h);
|
|
15668
15890
|
return n != null && isConnected(n);
|
|
15669
15891
|
};
|
|
15892
|
+
globalThis.__csimEnsureFrameRealm = function(h) {
|
|
15893
|
+
const el = lookup(h);
|
|
15894
|
+
if (!el || el._tag !== "iframe" && el._tag !== "frame") return 0;
|
|
15895
|
+
if (typeof globalThis.__csimFrameWindow !== "function") return 0;
|
|
15896
|
+
globalThis.__csimFrameWindow(el);
|
|
15897
|
+
return el._frameRealmId != null ? el._frameRealmId : 0;
|
|
15898
|
+
};
|
|
15899
|
+
globalThis.__csimLocationHref = function() {
|
|
15900
|
+
return globalThis.location && globalThis.location.href || "";
|
|
15901
|
+
};
|
|
15902
|
+
globalThis.__csimRebindFrameRealm = function(h, oldId, newId) {
|
|
15903
|
+
const el = lookup(h);
|
|
15904
|
+
if (el) {
|
|
15905
|
+
el._frameRealmId = newId || null;
|
|
15906
|
+
el._frameWindow = null;
|
|
15907
|
+
}
|
|
15908
|
+
const ids = globalThis.__csimChildRealmIds;
|
|
15909
|
+
if (ids) {
|
|
15910
|
+
if (oldId) ids.delete(oldId);
|
|
15911
|
+
if (newId) ids.add(newId);
|
|
15912
|
+
}
|
|
15913
|
+
};
|
|
15670
15914
|
globalThis.__csimValue = function(h) {
|
|
15671
15915
|
const n = lookup(h);
|
|
15672
15916
|
if (!n || n.nodeType !== NODE_ELEMENT) return null;
|
|
@@ -17641,6 +17885,101 @@
|
|
|
17641
17885
|
}
|
|
17642
17886
|
};
|
|
17643
17887
|
globalThis.BroadcastChannel = BroadcastChannel;
|
|
17888
|
+
var __csimWindowProxies = /* @__PURE__ */ new Map();
|
|
17889
|
+
function csimWindowProxy(handle) {
|
|
17890
|
+
if (handle == null || handle === "") return null;
|
|
17891
|
+
let proxy = __csimWindowProxies.get(handle);
|
|
17892
|
+
if (proxy) return proxy;
|
|
17893
|
+
const location = {
|
|
17894
|
+
get href() {
|
|
17895
|
+
return globalThis.__csimWindowLocation(handle);
|
|
17896
|
+
},
|
|
17897
|
+
set href(v) {
|
|
17898
|
+
globalThis.__csimWindowSetLocation(handle, String(v));
|
|
17899
|
+
},
|
|
17900
|
+
assign(v) {
|
|
17901
|
+
globalThis.__csimWindowSetLocation(handle, String(v));
|
|
17902
|
+
},
|
|
17903
|
+
replace(v) {
|
|
17904
|
+
globalThis.__csimWindowSetLocation(handle, String(v));
|
|
17905
|
+
},
|
|
17906
|
+
toString() {
|
|
17907
|
+
return globalThis.__csimWindowLocation(handle);
|
|
17908
|
+
}
|
|
17909
|
+
};
|
|
17910
|
+
proxy = {
|
|
17911
|
+
get closed() {
|
|
17912
|
+
return !!globalThis.__csimWindowClosed(handle);
|
|
17913
|
+
},
|
|
17914
|
+
close() {
|
|
17915
|
+
globalThis.__csimWindowClose(handle);
|
|
17916
|
+
},
|
|
17917
|
+
focus() {
|
|
17918
|
+
},
|
|
17919
|
+
blur() {
|
|
17920
|
+
},
|
|
17921
|
+
// Cross-window postMessage. The data round-trips JS→Ruby→JS through the
|
|
17922
|
+
// host marshaller rather than a true structured-clone: plain
|
|
17923
|
+
// primitives/arrays/objects survive, but `undefined`→null, functions /
|
|
17924
|
+
// symbols drop (no DataCloneError is thrown), and prototypes/identity are
|
|
17925
|
+
// lost — fine for the JSON-ish payloads postMessage carries in practice.
|
|
17926
|
+
// `targetOrigin` is accepted but, like the single-origin model elsewhere,
|
|
17927
|
+
// not enforced.
|
|
17928
|
+
postMessage(data, targetOrigin, _transfer) {
|
|
17929
|
+
globalThis.__csimWindowPostMessage(handle, data, String(targetOrigin == null ? "*" : targetOrigin));
|
|
17930
|
+
},
|
|
17931
|
+
get location() {
|
|
17932
|
+
return location;
|
|
17933
|
+
},
|
|
17934
|
+
set location(v) {
|
|
17935
|
+
location.href = v;
|
|
17936
|
+
},
|
|
17937
|
+
get window() {
|
|
17938
|
+
return proxy;
|
|
17939
|
+
},
|
|
17940
|
+
get self() {
|
|
17941
|
+
return proxy;
|
|
17942
|
+
},
|
|
17943
|
+
get __csimWindowHandle() {
|
|
17944
|
+
return handle;
|
|
17945
|
+
}
|
|
17946
|
+
};
|
|
17947
|
+
__csimWindowProxies.set(handle, proxy);
|
|
17948
|
+
return proxy;
|
|
17949
|
+
}
|
|
17950
|
+
__name(csimWindowProxy, "csimWindowProxy");
|
|
17951
|
+
globalThis.open = function(url, name, _features) {
|
|
17952
|
+
const fn = globalThis.__csimWindowOpen;
|
|
17953
|
+
if (typeof fn !== "function") return null;
|
|
17954
|
+
const handle = fn(url == null ? "" : String(url), name == null ? "" : String(name));
|
|
17955
|
+
return handle ? csimWindowProxy(handle) : null;
|
|
17956
|
+
};
|
|
17957
|
+
var __csimOpenerOverride;
|
|
17958
|
+
Object.defineProperty(globalThis, "opener", {
|
|
17959
|
+
configurable: true,
|
|
17960
|
+
get() {
|
|
17961
|
+
if (__csimOpenerOverride !== void 0) return __csimOpenerOverride;
|
|
17962
|
+
const fn = globalThis.__csimWindowOpener;
|
|
17963
|
+
const handle = typeof fn === "function" ? fn() : null;
|
|
17964
|
+
return handle ? csimWindowProxy(handle) : null;
|
|
17965
|
+
},
|
|
17966
|
+
set(v) {
|
|
17967
|
+
__csimOpenerOverride = v;
|
|
17968
|
+
}
|
|
17969
|
+
});
|
|
17970
|
+
globalThis.__csim_deliverWindowMessages = function(events) {
|
|
17971
|
+
if (!events || !events.length) return;
|
|
17972
|
+
for (const ev of events) {
|
|
17973
|
+
const source = ev && ev.sourceHandle ? csimWindowProxy(ev.sourceHandle) : null;
|
|
17974
|
+
dispatchWithOnHandler(globalThis, new MessageEvent("message", {
|
|
17975
|
+
data: ev ? ev.data : void 0,
|
|
17976
|
+
origin: ev && ev.origin || "",
|
|
17977
|
+
source,
|
|
17978
|
+
lastEventId: "",
|
|
17979
|
+
ports: []
|
|
17980
|
+
}));
|
|
17981
|
+
}
|
|
17982
|
+
};
|
|
17644
17983
|
globalThis.NodeFilter = {
|
|
17645
17984
|
SHOW_ALL: 4294967295,
|
|
17646
17985
|
SHOW_ELEMENT: 1,
|
|
@@ -18677,7 +19016,7 @@
|
|
|
18677
19016
|
function fireCEConnect(subtree) {
|
|
18678
19017
|
walkSubtree(subtree, (el) => {
|
|
18679
19018
|
if (el.nodeType !== NODE_ELEMENT) return;
|
|
18680
|
-
if (!__inHTMLGrafting && el._tag === "script" && !el._csimRan) maybeRunScript(el);
|
|
19019
|
+
if (!__inHTMLGrafting && el._tag === "script" && !el._csimRan && el.isConnected) maybeRunScript(el);
|
|
18681
19020
|
if (el._tag === "link") maybeFireLinkLoad(el);
|
|
18682
19021
|
if (el._tag === "iframe" || el._tag === "frame") maybeFireFrameLoad(el);
|
|
18683
19022
|
ceTryConnect(el);
|
|
@@ -18739,9 +19078,9 @@
|
|
|
18739
19078
|
function maybeRunScript(el) {
|
|
18740
19079
|
const type = (el._attrs.type || "").toLowerCase();
|
|
18741
19080
|
if (type && type !== "text/javascript" && type !== "application/javascript" && type !== "application/x-javascript" && type !== "text/ecmascript") return;
|
|
18742
|
-
el._csimRan = true;
|
|
18743
19081
|
let body;
|
|
18744
19082
|
if (el._attrs.src) {
|
|
19083
|
+
el._csimRan = true;
|
|
18745
19084
|
try {
|
|
18746
19085
|
const resp = __rackFetch("GET", el._attrs.src, "", null, "follow");
|
|
18747
19086
|
if (!resp || resp.status >= 400) {
|
|
@@ -18753,12 +19092,14 @@
|
|
|
18753
19092
|
dispatchScriptLoad(el, false);
|
|
18754
19093
|
return;
|
|
18755
19094
|
}
|
|
19095
|
+
if (!body) {
|
|
19096
|
+
dispatchScriptLoad(el, true);
|
|
19097
|
+
return;
|
|
19098
|
+
}
|
|
18756
19099
|
} else {
|
|
18757
19100
|
body = scriptText(el);
|
|
18758
|
-
|
|
18759
|
-
|
|
18760
|
-
dispatchScriptLoad(el, true);
|
|
18761
|
-
return;
|
|
19101
|
+
if (!body) return;
|
|
19102
|
+
el._csimRan = true;
|
|
18762
19103
|
}
|
|
18763
19104
|
const label = el._attrs.src || "inline://" + hashStr(body);
|
|
18764
19105
|
let _ok = true;
|
|
@@ -18771,6 +19112,11 @@
|
|
|
18771
19112
|
dispatchScriptLoad(el, _ok);
|
|
18772
19113
|
}
|
|
18773
19114
|
__name(maybeRunScript, "maybeRunScript");
|
|
19115
|
+
globalThis.__csimScriptChildrenChanged = function(el) {
|
|
19116
|
+
if (!__inHTMLGrafting && el && el._tag === "script" && !el._csimRan && el.isConnected) {
|
|
19117
|
+
maybeRunScript(el);
|
|
19118
|
+
}
|
|
19119
|
+
};
|
|
18774
19120
|
globalThis.Document = Document;
|
|
18775
19121
|
globalThis.Element = Element;
|
|
18776
19122
|
installXPath(Document.prototype);
|
|
@@ -18817,6 +19163,7 @@
|
|
|
18817
19163
|
});
|
|
18818
19164
|
const ownerURL = (this._ownerDoc || globalThis.document).URL;
|
|
18819
19165
|
if (ownerURL) doc._url = ownerURL;
|
|
19166
|
+
doc._noBrowsingContext = true;
|
|
18820
19167
|
return doc;
|
|
18821
19168
|
}
|
|
18822
19169
|
};
|
|
@@ -18886,7 +19233,8 @@
|
|
|
18886
19233
|
}
|
|
18887
19234
|
}
|
|
18888
19235
|
if (typeof globalThis.__csim_createFrameRealm === "function" && globalThis.RustyRacer && typeof globalThis.RustyRacer.contextGlobal === "function") {
|
|
18889
|
-
const
|
|
19236
|
+
const parentId = typeof globalThis.RustyRacer.contextOf === "function" ? globalThis.RustyRacer.contextOf(globalThis) : 0;
|
|
19237
|
+
const id = globalThis.__csim_createFrameRealm(frameUrl, body, contentType, parentId);
|
|
18890
19238
|
if (id != null) {
|
|
18891
19239
|
frameEl._frameRealmId = id;
|
|
18892
19240
|
(globalThis.__csimChildRealmIds || (globalThis.__csimChildRealmIds = /* @__PURE__ */ new Set())).add(id);
|
|
@@ -19161,7 +19509,10 @@
|
|
|
19161
19509
|
} else {
|
|
19162
19510
|
body = scriptText(s);
|
|
19163
19511
|
}
|
|
19164
|
-
if (!body)
|
|
19512
|
+
if (!body) {
|
|
19513
|
+
s._csimRan = false;
|
|
19514
|
+
continue;
|
|
19515
|
+
}
|
|
19165
19516
|
const label = s._attrs.src || "inline://" + hashStr(body);
|
|
19166
19517
|
const prevCurrent = globalThis.document && globalThis.document._currentScript;
|
|
19167
19518
|
if (globalThis.document) globalThis.document._currentScript = s;
|