From 8b058a8a9141d7f6a4f55eefbfe5e9213cb94c44 Mon Sep 17 00:00:00 2001 From: Godefroid Chapelle Date: Wed, 15 Dec 2021 17:51:42 +0100 Subject: [PATCH 1/2] Make eventListener work on elements inside shadow DOM --- src/htmx.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/htmx.js b/src/htmx.js index e6868ba2..f575cd27 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -248,9 +248,13 @@ return (function () { return elemTop < window.innerHeight && elemBottom >= 0; } - function bodyContains(elt) { - return getDocument().body.contains(elt); - } + function bodyContains(elt) { + if (elt.getRootNode() instanceof ShadowRoot) { + return getDocument().body.contains(elt.getRootNode().host); + } else { + return getDocument().body.contains(elt); + } + } function splitOnWhitespace(trigger) { return trigger.trim().split(/\s+/); From b25d95993c11a3b76d47079c0c92ea27428b75a4 Mon Sep 17 00:00:00 2001 From: Godefroid Chapelle Date: Wed, 15 Dec 2021 18:46:24 +0100 Subject: [PATCH 2/2] Circle CI first step --- .circleci/config.yml | 22 ++++++++++++++++++++++ package.json | 1 + test/index.html | 1 + 3 files changed, 24 insertions(+) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..c29ebc77 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,22 @@ +version: 2.1 + +commands: + +orbs: + browser-tools: circleci/browser-tools@1.1.0 +jobs: + test: + docker: + - image: cimg/node:16.13.1-browsers + steps: + - browser-tools/install-browser-tools + - checkout + - run: | + node --version + java --version + google-chrome --version + +workflows: + tests-containers: + jobs: + - test diff --git a/package.json b/package.json index 4fac3ca6..db18f0ef 100644 --- a/package.json +++ b/package.json @@ -41,6 +41,7 @@ "fs-extra": "^9.1.0", "mocha": "^7.2.0", "mocha-chrome": "^2.2.0", + "mocha-webdriver-runner": "^0.6.3", "sass": "^1.34.0", "sinon": "^9.2.4", "typescript": "^4.3.5", diff --git a/test/index.html b/test/index.html index 457b90c4..359156c2 100644 --- a/test/index.html +++ b/test/index.html @@ -30,6 +30,7 @@ +