mirror of
https://github.com/chartjs/Chart.js.git
synced 2026-03-02 22:44:03 +01:00
Use ResizeObserver and MutationObserver to detect detach/attach/resize (#7104)
* Use Resize/MutationObserver to detect detach/attach/resize * Cleanup * Review update * Restore infinite resize detection (#6011)
This commit is contained in:
@@ -64,18 +64,3 @@ require(['moment'], function() {
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
## Content Security Policy
|
||||
|
||||
By default, Chart.js injects CSS directly into the DOM. For webpages secured using [Content Security Policy (CSP)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP), this requires to allow `style-src 'unsafe-inline'`. For stricter CSP environments, where only `style-src 'self'` is allowed, the following CSS file needs to be manually added to your webpage:
|
||||
|
||||
```html
|
||||
<link rel="stylesheet" type="text/css" href="path/to/chartjs/dist/Chart.min.css">
|
||||
```
|
||||
|
||||
And the style injection must be turned off **before creating the first chart**:
|
||||
|
||||
```javascript
|
||||
// Disable automatic style injection
|
||||
Chart.platform.disableCSSInjection = true;
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user