snabbdom / snabbdom

A virtual DOM library with focus on simplicity, modularity, powerful features and performance.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A question for style module

Censwin opened this issue · comments

Hi,I see the following description on the readme:

Note that the style module does not remove style attributes if they
are removed as properties from the style object. To remove a style,
you should instead set it to the empty string.

and I tried to remove the properties from the style object, like this:

const container = document.getElementById("app");
const patch = init([styleModule, attributesModule]);
const vnode1 = h("section", [
  h("span", { style: { color: "red" }, attrs: { id: "span_1" } }, "Hello")
]);
patch(container, vnode1);

const vnode3 = h("section", [
  h("span", { style: {},attrs: { id: "span_1" } }, "Hello")
]);
patch(vnode1, vnode3);

It is working.
Could somebody provide an incorrect example?

Looking at the code, this is outdated documentation. Could you open a PR to fix it?

Looking at the code, this is outdated documentation. Could you open a PR to fix it?

This code commits at 6 years ago, maybe it is really outdated. Can I delete this code?