Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plugins/bound/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
16 changes: 16 additions & 0 deletions tests/playwright/x-bound.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, `
<div x-data="{ innerHTML: '<h1>Sample</h1>' }">
<pre contenteditable="plaintext-only" &innerHTML></pre>
<button @click="innerHTML='Hello!'">Click</button>
<span x-format>{{ innerHTML }}</pre>
</div>`);

await expect(page.locator("span")).toContainText("<h1>Sample</h1>");
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, `
<div x-data="{ innerHTML: null }">
Expand Down