#1113·snabbdom

Tailwind 样式复杂类名有问题吗?

作者: tslocke创建于 2024年3月5日更新于 2024年3月20日

最近我转而使用 snabbdom 来高效地更新我正在开发的网页构建器中的页面预览。HTML 中包含 Tailwind 类,例如 class='block my-2 rounded bg-[#A31F24] text-white px-3 py-1' 有时我会收到调用 patch(oldVnode, newVnode) 时的错误:

DOMException: Failed to execute 'createElement' on 'Document': The provided tag name ('a.block.my-2.rounded.bg-[') is not a valid name.

我的 patch 函数如下所示

内容来源: snabbdom/snabbdom