diagnostics
The warnings produced by the last render. Nothing in the language is a fatal error, so this is where problems show up.
Syntax
- doodle.diagnostics
An array of { message } objects. A warning from the code also carries its place in the source:
index, the character offset, or pos, the zero-based [column, line] from the parser.
Warnings from @doodle() bodies are not included; they only arrive as warn events.
Every warning is also dispatched, on each render, as a warn event; preventDefault() keeps it out of the console.
Reported situations include an unknown function called with arguments,
an unclosed parenthesis, a @keyframes without a name, and a @use variable that includes itself.
Examples
const doodle = document.querySelector('css-doodle');
doodle.update(`
@grid: 5 / 60vmin;
background: @colour(red, blue);
`);
console.log(doodle.diagnostics);
// [{ message: 'unknown function @colour()', index: … }]