Disabling CSS type selectors

MCS optimizes the output CSS to reduce its size. As a part of the optimization process, MCS identifies style rules that are common across types, i.e. element names. If all elements of a particular type have some styles in common, e.g. a color, then a single rule can be output using a type selector to set the color across all elements of that type. Unfortunately, the use of type selectors may cause problems. For example, when the output page contains client-side scripts which create new elements, then the newly created elements will automatically pick up styles that are common for their type.

MCS optimizes the output CSS to reduce its size. As a part of the optimization process, MCS identifies style rules that are common across types, i.e. element names. If all elements of a particular type have some styles in common, e.g. a color, then a single rule can be output using a type selector to set the color across all elements of that type. Unfortunately, the use of type selectors may cause problems. For example, when the output page contains client-side scripts which create new elements, then the newly created elements will automatically pick up styles that are common for their type.

The mcs:allow-css-type-selectors meta property specifies whether CSS type selectors are allowed in the generated CSS. Page authors should set this to 'false' if the page contains client-side scripts that dynamically create elements on the client. This will prevent those elements from picking up styles that were common for elements of the same type in the original page sent from the server. The default value of the property is 'true'.

Related topics