Package overit.geocall.util.services
Interface SafeInlineService
- All Known Implementing Classes:
SafeInlineServiceImpl
public interface SafeInlineService
Service interface for handling inline JavaScript and CSS code in a secure manner.
This service provides methods to safely add event handlers and styles to HTML elements
while maintaining compatibility with Content Security Policy (CSP) restrictions.
When the safe inline handlers feature is enabled (via 'foundation.ui.csp.safe' or 'foundation.ui.csp.safe.inline.handler' properties),
instead of using unsafe inline attributes like 'onclick' or 'style', this service:
- For events: converts them to data-event-* attributes and adds appropriate CSS classes
- For styles: converts them to data-style attributes and adds appropriate CSS classes
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidSets a JS event handler on an HTML element in a CSP-compliant way.voidSets a JS event handler on the Icon in a CSP-compliant way.voidSets inline CSS styles on an HTML element in a CSP-compliant way.
-
Field Details
-
SAFENESS_SCRIPT_CLASS
- See Also:
-
SAFENESS_STYLE_CLASS
- See Also:
-
-
Method Details
-
setEvent
Sets a JS event handler on an HTML element in a CSP-compliant way. When safe inline handlers are enabled, instead of setting the event directly (e.g., 'onclick'), it adds a data-event-* attribute and the 'activableScripting' class and the SafeInlineEngine will then handle the event.- Parameters:
e- The HTML element to which the event handler will be addedevent- The event name (e.g., "click", "change"). The "on" prefix will be automatically added if missingscript- The JavaScript code to be executed when the event occurs
-
setEvent
Sets a JS event handler on the Icon in a CSP-compliant way. When safe inline handlers are enabled, instead of setting the event directly (e.g., 'onclick'), it adds a data-event-* attribute and the 'activableScripting' class and the SafeInlineEngine will then handle the event.- Parameters:
i- The icon element to which the event handler will be addedevent- The event name (e.g., "click", "change"). The "on" prefix will be automatically added if missingscript- The JavaScript code to be executed when the event occurs
-
setStyle
Sets inline CSS styles on an HTML element in a CSP-compliant way. When safe inline handlers are enabled, instead of using the 'style' attribute, it adds a data-style attribute and the 'activableStyling' class and the SafeInlineEngine will then handle the event.- Parameters:
e- The HTML element to which the styles will be appliedstyle- The CSS style string to be applied
-