File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed
Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 55import { setHooks as lwcSetHooks } from 'lwc' ;
66
77let sanitizeHtmlContentHook = function shouldBeReplaced ( ) {
8- throw new Error ( 'sanitizeHtmlContent hook must be implemented.' ) ;
8+ throw new Error ( '[TEST] sanitizeHtmlContent hook must be implemented.' ) ;
99} ;
1010
1111lwcSetHooks ( {
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ export default {
2525 files : [
2626 // FIXME: These tests are just symlinks to integration-karma for now so the git diff smaller
2727 'test-hydration/**/*.spec.js' ,
28+ '!test-hydration/light-dom/scoped-styles/replace-scoped-styles-with-dynamic-templates/index.spec.js' ,
2829 ] ,
2930 nodeResolve : true ,
3031 rootDir : import . meta. dirname ,
Original file line number Diff line number Diff line change @@ -16,19 +16,23 @@ interface OverridableHooks {
1616
1717let hooksAreSet = false ;
1818
19+ let sanitizeHtmlContentImpl : SanitizeHtmlContentHook = ( ) : string => {
20+ // locker-service patches this function during runtime to sanitize HTML content.
21+ throw new Error ( 'sanitizeHtmlContent hook must be implemented.' ) ;
22+ } ;
23+
1924/**
2025 * EXPERIMENTAL: This function acts like a hook for Lightning Locker Service and other similar
2126 * libraries to sanitize HTML content. This hook process the content passed via the template to
2227 * lwc:inner-html directive.
2328 * It is meant to be overridden via `setHooks`; it throws an error by default.
2429 */
25- export let sanitizeHtmlContent : SanitizeHtmlContentHook = ( ) : string => {
26- // locker-service patches this function during runtime to sanitize HTML content.
27- throw new Error ( 'sanitizeHtmlContent hook must be implemented.' ) ;
30+ export const sanitizeHtmlContent : SanitizeHtmlContentHook = ( value ) => {
31+ return sanitizeHtmlContentImpl ( value ) ;
2832} ;
2933
3034export function setHooks ( hooks : OverridableHooks ) {
3135 assert . isFalse ( hooksAreSet , 'Hooks are already overridden, only one definition is allowed.' ) ;
3236 hooksAreSet = true ;
33- sanitizeHtmlContent = hooks . sanitizeHtmlContent ;
37+ sanitizeHtmlContentImpl = hooks . sanitizeHtmlContent ;
3438}
You can’t perform that action at this time.
0 commit comments