diff --git a/src/plugins/bound/index.js b/src/plugins/bound/index.js index 12246db..a22ef93 100644 --- a/src/plugins/bound/index.js +++ b/src/plugins/bound/index.js @@ -219,7 +219,7 @@ function plugin({ directive, entangle, evaluateLater, mapAttributes, mutateDom, } function process_contenteditable() { - if (el.contentEditable === "true") { + if (el.isContentEditable) { is_nullish(get_value()) && update_variable(); effect(update_property); diff --git a/tests/playwright/x-bound.spec.js b/tests/playwright/x-bound.spec.js index d70ef97..9b7aaf1 100644 --- a/tests/playwright/x-bound.spec.js +++ b/tests/playwright/x-bound.spec.js @@ -425,6 +425,22 @@ test.describe("x-bound: contenteditable", () => { await expect(page.locator("span")).toContainText("Hello World!"); }); + test("supports contenteditable='plaintext-only'", async ({ page }) => { + await set_html(page, ` +
+

+                
+                {{ innerHTML }}
+            
`); + + await expect(page.locator("span")).toContainText("

Sample

"); + await page.locator("button").click(); + await expect(page.locator("span")).toContainText("Hello!"); + await page.locator("pre").clear(); + await page.locator("pre").fill("Hello World!"); + await expect(page.locator("span")).toContainText("Hello World!"); + }); + test("innerHTML (initliaze from element when property is null)", async ({ page }) => { await set_html(page, `