@gitlab/ui 72.11.0 → 72.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [72.11.1](https://gitlab.com/gitlab-org/gitlab-ui/compare/v72.11.0...v72.11.1) (2024-01-23)
2
+
3
+
4
+ ### Performance Improvements
5
+
6
+ * **SafeHtml:** Add unbind hook to the directive ([2b428b1](https://gitlab.com/gitlab-org/gitlab-ui/commit/2b428b1d19c57a8ebd4d92d318a3abb2461745f7))
7
+
1
8
  # [72.11.0](https://gitlab.com/gitlab-org/gitlab-ui/compare/v72.10.0...v72.11.0) (2024-01-23)
2
9
 
3
10
 
@@ -27,9 +27,13 @@ const transform = (el, binding) => {
27
27
  el.appendChild(sanitize(binding.value, config));
28
28
  }
29
29
  };
30
+ const clear = el => {
31
+ el.textContent = '';
32
+ };
30
33
  const SafeHtmlDirective = {
31
34
  bind: transform,
32
- update: transform
35
+ update: transform,
36
+ unbind: clear
33
37
  };
34
38
 
35
39
  export { SafeHtmlDirective };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 23 Jan 2024 16:37:57 GMT
3
+ * Generated on Tue, 23 Jan 2024 17:14:57 GMT
4
4
  */
5
5
 
6
6
  :root {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 23 Jan 2024 16:37:57 GMT
3
+ * Generated on Tue, 23 Jan 2024 17:14:57 GMT
4
4
  */
5
5
 
6
6
  :root.gl-dark {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 23 Jan 2024 16:37:57 GMT
3
+ * Generated on Tue, 23 Jan 2024 17:14:58 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#133a03";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Do not edit directly
3
- * Generated on Tue, 23 Jan 2024 16:37:57 GMT
3
+ * Generated on Tue, 23 Jan 2024 17:14:57 GMT
4
4
  */
5
5
 
6
6
  export const DATA_VIZ_GREEN_50 = "#ddfab7";
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Tue, 23 Jan 2024 16:37:57 GMT
3
+ // Generated on Tue, 23 Jan 2024 17:14:58 GMT
4
4
 
5
5
  $red-950: #fff4f3;
6
6
  $red-900: #fcf1ef;
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Do not edit directly
3
- // Generated on Tue, 23 Jan 2024 16:37:57 GMT
3
+ // Generated on Tue, 23 Jan 2024 17:14:57 GMT
4
4
 
5
5
  $gl-line-height-52: 3.25rem;
6
6
  $gl-line-height-44: 2.75rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gitlab/ui",
3
- "version": "72.11.0",
3
+ "version": "72.11.1",
4
4
  "description": "GitLab UI Components",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -24,7 +24,12 @@ const transform = (el, binding) => {
24
24
  }
25
25
  };
26
26
 
27
+ const clear = (el) => {
28
+ el.textContent = '';
29
+ };
30
+
27
31
  export const SafeHtmlDirective = {
28
32
  bind: transform,
29
33
  update: transform,
34
+ unbind: clear,
30
35
  };
@@ -129,4 +129,21 @@ describe('safe html directive', () => {
129
129
  expect(wrapper.html()).toEqual('<div>click here</div>');
130
130
  });
131
131
  });
132
+
133
+ describe('unbind', () => {
134
+ it('should clear the text content during unbind', () => {
135
+ createComponent();
136
+ wrapper.destroy();
137
+
138
+ expect(wrapper.element.textContent).toEqual('');
139
+ });
140
+
141
+ it('should clear the text content with custom HTML during unbind', () => {
142
+ const customHtml = '<div>custom html</div>';
143
+ createComponent({ html: customHtml });
144
+ wrapper.destroy();
145
+
146
+ expect(wrapper.element.textContent).toEqual('');
147
+ });
148
+ });
132
149
  });