Skip to main content

VARS_ATTR

Constant VARS_ATTR 

Source
pub const VARS_ATTR: &str = "data-vars";
Expand description

The attribute an element’s custom properties ride in, instead of style.

A number this crate hands the stylesheet – a bar’s value and its axis, a facet’s depth, a meter’s fill – is a custom property the rules divide or multiply. It used to be written as style="--value: 4210", and a style-src without 'unsafe-inline' refuses every style attribute, so a page under that policy drew every chart flat. The same text in this attribute is data a policy does not police, and the host’s script sets each property through the CSSOM, which the policy allows: quasi-webview’s VARS_JS.

The value is --name: value pairs separated by ;, the declaration syntax the style attribute already had, so the numbers still reach the markup as themselves. That is the property the residual seam needs: see the chart module header.

Only custom properties. A script that applied any declaration from markup would hand the policy’s refusal straight back.