@openui5/sap.m 1.108.37 → 1.108.39
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/THIRDPARTY.txt +1 -1
- package/package.json +4 -4
- package/src/sap/m/.library +3 -3
- package/src/sap/m/AccButton.js +2 -2
- package/src/sap/m/AccButtonRenderer.js +1 -1
- package/src/sap/m/ActionListItem.js +2 -2
- package/src/sap/m/ActionListItemRenderer.js +1 -1
- package/src/sap/m/ActionSelect.js +2 -2
- package/src/sap/m/ActionSelectRenderer.js +1 -1
- package/src/sap/m/ActionSheet.js +2 -2
- package/src/sap/m/ActionSheetRenderer.js +1 -1
- package/src/sap/m/ActionTile.js +2 -2
- package/src/sap/m/ActionTileContent.js +2 -2
- package/src/sap/m/ActionTileContentRenderer.js +1 -1
- package/src/sap/m/AdditionalTextButton.js +2 -2
- package/src/sap/m/AdditionalTextButtonRenderer.js +1 -1
- package/src/sap/m/App.js +2 -2
- package/src/sap/m/AppRenderer.js +1 -1
- package/src/sap/m/AssociativeOverflowToolbar.js +2 -2
- package/src/sap/m/Avatar.js +2 -2
- package/src/sap/m/AvatarColor.js +1 -1
- package/src/sap/m/AvatarImageFitType.js +1 -1
- package/src/sap/m/AvatarRenderer.js +1 -1
- package/src/sap/m/AvatarShape.js +1 -1
- package/src/sap/m/AvatarSize.js +1 -1
- package/src/sap/m/AvatarType.js +1 -1
- package/src/sap/m/BadgeCustomData.js +1 -1
- package/src/sap/m/BadgeEnabler.js +1 -1
- package/src/sap/m/Bar.js +2 -2
- package/src/sap/m/BarInPageEnabler.js +1 -1
- package/src/sap/m/BarRenderer.js +1 -1
- package/src/sap/m/Breadcrumbs.js +2 -2
- package/src/sap/m/BreadcrumbsRenderer.js +1 -1
- package/src/sap/m/BusyDialog.js +2 -2
- package/src/sap/m/BusyIndicator.js +2 -2
- package/src/sap/m/BusyIndicatorRenderer.js +1 -1
- package/src/sap/m/Button.js +2 -2
- package/src/sap/m/ButtonRenderer.js +1 -1
- package/src/sap/m/Carousel.js +2 -2
- package/src/sap/m/CarouselLayout.js +3 -3
- package/src/sap/m/CarouselRenderer.js +1 -1
- package/src/sap/m/CheckBox.js +2 -2
- package/src/sap/m/CheckBoxRenderer.js +1 -1
- package/src/sap/m/ColorPalette.js +2 -2
- package/src/sap/m/ColorPalettePopover.js +2 -2
- package/src/sap/m/ColorPaletteRenderer.js +1 -1
- package/src/sap/m/Column.js +2 -2
- package/src/sap/m/ColumnHeaderPopover.js +2 -2
- package/src/sap/m/ColumnListItem.js +2 -2
- package/src/sap/m/ColumnListItemRenderer.js +1 -1
- package/src/sap/m/ColumnPopoverActionItem.js +2 -2
- package/src/sap/m/ColumnPopoverCustomItem.js +2 -2
- package/src/sap/m/ColumnPopoverItem.js +2 -2
- package/src/sap/m/ColumnPopoverSelectListItem.js +2 -2
- package/src/sap/m/ColumnPopoverSortItem.js +2 -2
- package/src/sap/m/ComboBox.js +2 -2
- package/src/sap/m/ComboBoxBase.js +2 -2
- package/src/sap/m/ComboBoxBaseRenderer.js +1 -1
- package/src/sap/m/ComboBoxRenderer.js +1 -1
- package/src/sap/m/ComboBoxTextField.js +2 -2
- package/src/sap/m/ComboBoxTextFieldRenderer.js +1 -1
- package/src/sap/m/CustomAttribute.js +1 -1
- package/src/sap/m/CustomDynamicDateOption.js +2 -2
- package/src/sap/m/CustomListItem.js +2 -2
- package/src/sap/m/CustomListItemRenderer.js +1 -1
- package/src/sap/m/CustomTile.js +2 -2
- package/src/sap/m/CustomTileRenderer.js +1 -1
- package/src/sap/m/CustomTreeItem.js +2 -2
- package/src/sap/m/CustomTreeItemRenderer.js +1 -1
- package/src/sap/m/DatePicker.js +2 -2
- package/src/sap/m/DatePickerRenderer.js +1 -1
- package/src/sap/m/DateRangeSelection.js +3 -3
- package/src/sap/m/DateRangeSelectionRenderer.js +1 -1
- package/src/sap/m/DateTimeField.js +2 -2
- package/src/sap/m/DateTimeFieldRenderer.js +1 -1
- package/src/sap/m/DateTimeInput.js +2 -2
- package/src/sap/m/DateTimeInputRenderer.js +1 -1
- package/src/sap/m/DateTimePicker.js +2 -2
- package/src/sap/m/DateTimePickerRenderer.js +1 -1
- package/src/sap/m/Dialog.js +2 -2
- package/src/sap/m/DialogRenderer.js +1 -1
- package/src/sap/m/DisplayListItem.js +2 -2
- package/src/sap/m/DisplayListItemRenderer.js +1 -1
- package/src/sap/m/DraftIndicator.js +2 -2
- package/src/sap/m/DraftIndicatorRenderer.js +1 -1
- package/src/sap/m/DynamicDate.js +2 -2
- package/src/sap/m/DynamicDateFormat.js +1 -1
- package/src/sap/m/DynamicDateOption.js +2 -2
- package/src/sap/m/DynamicDateRange.js +2 -2
- package/src/sap/m/DynamicDateRangeRenderer.js +1 -1
- package/src/sap/m/DynamicDateUtil.js +1 -1
- package/src/sap/m/DynamicDateValueHelpUIType.js +2 -2
- package/src/sap/m/ExpandableText.js +2 -2
- package/src/sap/m/ExpandableTextRenderer.js +1 -1
- package/src/sap/m/FacetFilter.js +2 -2
- package/src/sap/m/FacetFilterItem.js +2 -2
- package/src/sap/m/FacetFilterItemRenderer.js +1 -1
- package/src/sap/m/FacetFilterList.js +2 -2
- package/src/sap/m/FacetFilterListRenderer.js +1 -1
- package/src/sap/m/FacetFilterRenderer.js +1 -1
- package/src/sap/m/FeedContent.js +2 -2
- package/src/sap/m/FeedContentRenderer.js +1 -1
- package/src/sap/m/FeedInput.js +2 -2
- package/src/sap/m/FeedInputRenderer.js +1 -1
- package/src/sap/m/FeedListItem.js +2 -2
- package/src/sap/m/FeedListItemAction.js +2 -2
- package/src/sap/m/FeedListItemRenderer.js +1 -1
- package/src/sap/m/Fiori20Adapter.js +3 -3
- package/src/sap/m/FlexBox.js +2 -2
- package/src/sap/m/FlexBoxRenderer.js +1 -1
- package/src/sap/m/FlexBoxStylingHelper.js +1 -1
- package/src/sap/m/FlexItemData.js +2 -2
- package/src/sap/m/FormattedText.js +2 -2
- package/src/sap/m/FormattedTextAnchorGenerator.js +1 -1
- package/src/sap/m/FormattedTextRenderer.js +1 -1
- package/src/sap/m/GenericTag.js +2 -2
- package/src/sap/m/GenericTagRenderer.js +1 -1
- package/src/sap/m/GenericTile.js +2 -2
- package/src/sap/m/GenericTileLineModeRenderer.js +1 -1
- package/src/sap/m/GenericTileRenderer.js +1 -1
- package/src/sap/m/GroupHeaderListItem.js +2 -2
- package/src/sap/m/GroupHeaderListItemRenderer.js +1 -1
- package/src/sap/m/GrowingEnablement.js +1 -1
- package/src/sap/m/GrowingList.js +2 -2
- package/src/sap/m/GrowingListRenderer.js +1 -1
- package/src/sap/m/HBox.js +2 -2
- package/src/sap/m/HBoxRenderer.js +1 -1
- package/src/sap/m/HeaderContainer.js +2 -2
- package/src/sap/m/HeaderContainerItemNavigator.js +2 -2
- package/src/sap/m/HeaderContainerRenderer.js +1 -1
- package/src/sap/m/HyphenationSupport.js +1 -1
- package/src/sap/m/IconTabBar.js +2 -2
- package/src/sap/m/IconTabBarDragAndDropUtil.js +1 -1
- package/src/sap/m/IconTabBarRenderer.js +1 -1
- package/src/sap/m/IconTabBarSelectList.js +2 -2
- package/src/sap/m/IconTabBarSelectListRenderer.js +1 -1
- package/src/sap/m/IconTabFilter.js +2 -2
- package/src/sap/m/IconTabFilterExpandButtonBadge.js +2 -2
- package/src/sap/m/IconTabHeader.js +2 -2
- package/src/sap/m/IconTabHeaderRenderer.js +1 -1
- package/src/sap/m/IconTabSeparator.js +2 -2
- package/src/sap/m/IllustratedMessage.js +2 -2
- package/src/sap/m/IllustratedMessageRenderer.js +1 -1
- package/src/sap/m/IllustratedMessageSize.js +1 -1
- package/src/sap/m/IllustratedMessageType.js +1 -1
- package/src/sap/m/Illustration.js +2 -2
- package/src/sap/m/IllustrationPool.js +1 -1
- package/src/sap/m/IllustrationRenderer.js +1 -1
- package/src/sap/m/Image.js +19 -3
- package/src/sap/m/ImageContent.js +2 -2
- package/src/sap/m/ImageContentRenderer.js +1 -1
- package/src/sap/m/ImageRenderer.js +10 -6
- package/src/sap/m/Input.js +2 -2
- package/src/sap/m/InputBase.js +2 -2
- package/src/sap/m/InputBaseRenderer.js +1 -1
- package/src/sap/m/InputListItem.js +2 -2
- package/src/sap/m/InputListItemRenderer.js +1 -1
- package/src/sap/m/InputRenderer.js +1 -1
- package/src/sap/m/InstanceManager.js +1 -1
- package/src/sap/m/Label.js +2 -2
- package/src/sap/m/LabelRenderer.js +1 -1
- package/src/sap/m/LightBox.js +2 -2
- package/src/sap/m/LightBoxItem.js +2 -2
- package/src/sap/m/LightBoxRenderer.js +1 -1
- package/src/sap/m/Link.js +2 -2
- package/src/sap/m/LinkRenderer.js +1 -1
- package/src/sap/m/List.js +2 -2
- package/src/sap/m/ListBase.js +2 -2
- package/src/sap/m/ListBaseRenderer.js +1 -1
- package/src/sap/m/ListItemBase.js +2 -2
- package/src/sap/m/ListItemBaseRenderer.js +1 -1
- package/src/sap/m/ListRenderer.js +1 -1
- package/src/sap/m/MaskEnabler.js +2 -2
- package/src/sap/m/MaskInput.js +2 -2
- package/src/sap/m/MaskInputRenderer.js +1 -1
- package/src/sap/m/MaskInputRule.js +2 -2
- package/src/sap/m/Menu.js +2 -2
- package/src/sap/m/MenuButton.js +2 -2
- package/src/sap/m/MenuButtonRenderer.js +1 -1
- package/src/sap/m/MenuItem.js +2 -2
- package/src/sap/m/MenuListItem.js +2 -2
- package/src/sap/m/MenuListItemRenderer.js +1 -1
- package/src/sap/m/MessageBox.js +1 -1
- package/src/sap/m/MessageItem.js +2 -2
- package/src/sap/m/MessageListItem.js +2 -2
- package/src/sap/m/MessageListItemRenderer.js +1 -1
- package/src/sap/m/MessagePage.js +2 -2
- package/src/sap/m/MessagePageRenderer.js +1 -1
- package/src/sap/m/MessagePopover.js +2 -2
- package/src/sap/m/MessagePopoverItem.js +2 -2
- package/src/sap/m/MessagePopoverRenderer.js +1 -1
- package/src/sap/m/MessageStrip.js +2 -2
- package/src/sap/m/MessageStripRenderer.js +1 -1
- package/src/sap/m/MessageStripUtilities.js +1 -1
- package/src/sap/m/MessageToast.js +2 -2
- package/src/sap/m/MessageView.js +2 -2
- package/src/sap/m/MessageViewRenderer.js +1 -1
- package/src/sap/m/MultiComboBox.js +2 -2
- package/src/sap/m/MultiComboBoxRenderer.js +1 -1
- package/src/sap/m/MultiEditField.js +2 -2
- package/src/sap/m/MultiInput.js +2 -2
- package/src/sap/m/MultiInputRenderer.js +1 -1
- package/src/sap/m/NavContainer.js +2 -2
- package/src/sap/m/NavContainerRenderer.js +1 -1
- package/src/sap/m/NewsContent.js +2 -2
- package/src/sap/m/NewsContentRenderer.js +1 -1
- package/src/sap/m/NotificationList.js +2 -2
- package/src/sap/m/NotificationListBase.js +2 -2
- package/src/sap/m/NotificationListGroup.js +2 -2
- package/src/sap/m/NotificationListGroupRenderer.js +1 -1
- package/src/sap/m/NotificationListItem.js +2 -2
- package/src/sap/m/NotificationListItemRenderer.js +1 -1
- package/src/sap/m/NotificationListRenderer.js +1 -1
- package/src/sap/m/NumericContent.js +2 -2
- package/src/sap/m/NumericContentRenderer.js +1 -1
- package/src/sap/m/NumericInput.js +2 -2
- package/src/sap/m/NumericInputRenderer.js +1 -1
- package/src/sap/m/ObjectAttribute.js +2 -2
- package/src/sap/m/ObjectAttributeRenderer.js +1 -1
- package/src/sap/m/ObjectHeader.js +2 -2
- package/src/sap/m/ObjectHeaderRenderer.js +1 -1
- package/src/sap/m/ObjectIdentifier.js +2 -2
- package/src/sap/m/ObjectIdentifierRenderer.js +1 -1
- package/src/sap/m/ObjectListItem.js +2 -2
- package/src/sap/m/ObjectListItemRenderer.js +1 -1
- package/src/sap/m/ObjectMarker.js +2 -2
- package/src/sap/m/ObjectMarkerRenderer.js +1 -1
- package/src/sap/m/ObjectNumber.js +2 -2
- package/src/sap/m/ObjectNumberRenderer.js +1 -1
- package/src/sap/m/ObjectStatus.js +2 -2
- package/src/sap/m/ObjectStatusRenderer.js +1 -1
- package/src/sap/m/OverflowToolbar.js +2 -2
- package/src/sap/m/OverflowToolbarAssociativePopover.js +2 -2
- package/src/sap/m/OverflowToolbarAssociativePopoverControls.js +1 -1
- package/src/sap/m/OverflowToolbarAssociativePopoverRenderer.js +1 -1
- package/src/sap/m/OverflowToolbarButton.js +2 -2
- package/src/sap/m/OverflowToolbarLayoutData.js +2 -2
- package/src/sap/m/OverflowToolbarRenderer.js +1 -1
- package/src/sap/m/OverflowToolbarToggleButton.js +2 -2
- package/src/sap/m/P13nAnyFilterItem.js +2 -2
- package/src/sap/m/P13nColumnsItem.js +2 -2
- package/src/sap/m/P13nColumnsPanel.js +2 -2
- package/src/sap/m/P13nConditionPanel.js +2 -2
- package/src/sap/m/P13nConditionPanelRenderer.js +1 -1
- package/src/sap/m/P13nDialog.js +2 -2
- package/src/sap/m/P13nDimMeasureItem.js +2 -2
- package/src/sap/m/P13nDimMeasurePanel.js +2 -2
- package/src/sap/m/P13nFilterItem.js +2 -2
- package/src/sap/m/P13nFilterPanel.js +2 -2
- package/src/sap/m/P13nFilterPanelRenderer.js +1 -1
- package/src/sap/m/P13nGroupItem.js +2 -2
- package/src/sap/m/P13nGroupPanel.js +2 -2
- package/src/sap/m/P13nItem.js +2 -2
- package/src/sap/m/P13nOperationsHelper.js +1 -1
- package/src/sap/m/P13nPanel.js +2 -2
- package/src/sap/m/P13nSelectionItem.js +2 -2
- package/src/sap/m/P13nSelectionPanel.js +2 -2
- package/src/sap/m/P13nSortItem.js +2 -2
- package/src/sap/m/P13nSortPanel.js +2 -2
- package/src/sap/m/PDFViewer.js +102 -56
- package/src/sap/m/PDFViewerRenderManager.js +1 -1
- package/src/sap/m/PDFViewerRenderer.js +2 -2
- package/src/sap/m/Page.js +2 -2
- package/src/sap/m/PageAccessibleLandmarkInfo.js +2 -2
- package/src/sap/m/PageRenderer.js +1 -1
- package/src/sap/m/PagingButton.js +2 -2
- package/src/sap/m/PagingButtonRenderer.js +1 -1
- package/src/sap/m/Panel.js +2 -2
- package/src/sap/m/PanelRenderer.js +1 -1
- package/src/sap/m/PlanningCalendar.js +2 -2
- package/src/sap/m/PlanningCalendarHeader.js +2 -2
- package/src/sap/m/PlanningCalendarHeaderRenderer.js +1 -1
- package/src/sap/m/PlanningCalendarLegend.js +2 -2
- package/src/sap/m/PlanningCalendarLegendRenderer.js +1 -1
- package/src/sap/m/PlanningCalendarRenderer.js +1 -1
- package/src/sap/m/PlanningCalendarRow.js +2 -2
- package/src/sap/m/PlanningCalendarView.js +2 -2
- package/src/sap/m/Popover.js +2 -2
- package/src/sap/m/PopoverRenderer.js +1 -1
- package/src/sap/m/ProgressIndicator.js +2 -2
- package/src/sap/m/ProgressIndicatorRenderer.js +1 -1
- package/src/sap/m/PullToRefresh.js +2 -2
- package/src/sap/m/PullToRefreshRenderer.js +1 -1
- package/src/sap/m/QuickView.js +2 -2
- package/src/sap/m/QuickViewBase.js +2 -2
- package/src/sap/m/QuickViewCard.js +2 -2
- package/src/sap/m/QuickViewCardRenderer.js +1 -1
- package/src/sap/m/QuickViewGroup.js +2 -2
- package/src/sap/m/QuickViewGroupElement.js +2 -2
- package/src/sap/m/QuickViewPage.js +2 -2
- package/src/sap/m/QuickViewPageRenderer.js +1 -1
- package/src/sap/m/RadioButton.js +2 -2
- package/src/sap/m/RadioButtonGroup.js +2 -2
- package/src/sap/m/RadioButtonGroupRenderer.js +1 -1
- package/src/sap/m/RadioButtonRenderer.js +1 -1
- package/src/sap/m/RangeSlider.js +2 -2
- package/src/sap/m/RangeSliderRenderer.js +1 -1
- package/src/sap/m/RatingIndicator.js +2 -2
- package/src/sap/m/RatingIndicatorRenderer.js +1 -1
- package/src/sap/m/ResponsivePopover.js +2 -2
- package/src/sap/m/ResponsivePopoverRenderer.js +1 -1
- package/src/sap/m/ResponsiveScale.js +2 -2
- package/src/sap/m/ScrollBar.js +2 -2
- package/src/sap/m/ScrollBarRenderer.js +1 -1
- package/src/sap/m/ScrollContainer.js +2 -2
- package/src/sap/m/ScrollContainerRenderer.js +1 -1
- package/src/sap/m/SearchField.js +2 -2
- package/src/sap/m/SearchFieldRenderer.js +1 -1
- package/src/sap/m/SegmentedButton.js +2 -2
- package/src/sap/m/SegmentedButtonItem.js +2 -2
- package/src/sap/m/SegmentedButtonRenderer.js +1 -1
- package/src/sap/m/Select.js +2 -2
- package/src/sap/m/SelectDialog.js +2 -2
- package/src/sap/m/SelectDialogBase.js +2 -2
- package/src/sap/m/SelectList.js +2 -2
- package/src/sap/m/SelectListRenderer.js +1 -1
- package/src/sap/m/SelectRenderer.js +1 -1
- package/src/sap/m/SelectionDetails.js +2 -2
- package/src/sap/m/SelectionDetailsFacade.js +3 -3
- package/src/sap/m/SelectionDetailsItem.js +2 -2
- package/src/sap/m/SelectionDetailsItemLine.js +2 -2
- package/src/sap/m/SelectionDetailsListItemRenderer.js +1 -1
- package/src/sap/m/SelectionDetailsRenderer.js +1 -1
- package/src/sap/m/Shell.js +2 -2
- package/src/sap/m/ShellRenderer.js +1 -1
- package/src/sap/m/SimpleFixFlex.js +2 -2
- package/src/sap/m/SimpleFixFlexRenderer.js +1 -1
- package/src/sap/m/SinglePlanningCalendar.js +2 -2
- package/src/sap/m/SinglePlanningCalendarDayView.js +2 -2
- package/src/sap/m/SinglePlanningCalendarGrid.js +2 -2
- package/src/sap/m/SinglePlanningCalendarGridRenderer.js +1 -1
- package/src/sap/m/SinglePlanningCalendarMonthGrid.js +2 -2
- package/src/sap/m/SinglePlanningCalendarMonthGridRenderer.js +1 -1
- package/src/sap/m/SinglePlanningCalendarMonthView.js +2 -2
- package/src/sap/m/SinglePlanningCalendarRenderer.js +1 -1
- package/src/sap/m/SinglePlanningCalendarUtilities.js +1 -1
- package/src/sap/m/SinglePlanningCalendarView.js +2 -2
- package/src/sap/m/SinglePlanningCalendarWeekView.js +2 -2
- package/src/sap/m/SinglePlanningCalendarWorkWeekView.js +2 -2
- package/src/sap/m/SlideTile.js +2 -2
- package/src/sap/m/SlideTileRenderer.js +1 -1
- package/src/sap/m/Slider.js +2 -2
- package/src/sap/m/SliderRenderer.js +1 -1
- package/src/sap/m/SliderTooltip.js +2 -2
- package/src/sap/m/SliderTooltipBase.js +2 -2
- package/src/sap/m/SliderTooltipBaseRenderer.js +1 -1
- package/src/sap/m/SliderTooltipContainer.js +2 -2
- package/src/sap/m/SliderTooltipContainerRenderer.js +1 -1
- package/src/sap/m/SliderTooltipRenderer.js +1 -1
- package/src/sap/m/SliderUtilities.js +1 -1
- package/src/sap/m/SplitApp.js +2 -2
- package/src/sap/m/SplitAppRenderer.js +1 -1
- package/src/sap/m/SplitButton.js +2 -2
- package/src/sap/m/SplitButtonRenderer.js +1 -1
- package/src/sap/m/SplitContainer.js +2 -2
- package/src/sap/m/SplitContainerRenderer.js +1 -1
- package/src/sap/m/StandardDynamicDateOption.js +2 -2
- package/src/sap/m/StandardListItem.js +2 -2
- package/src/sap/m/StandardListItemRenderer.js +1 -1
- package/src/sap/m/StandardTile.js +2 -2
- package/src/sap/m/StandardTileRenderer.js +1 -1
- package/src/sap/m/StandardTreeItem.js +2 -2
- package/src/sap/m/StandardTreeItemRenderer.js +1 -1
- package/src/sap/m/StepInput.js +2 -2
- package/src/sap/m/StepInputRenderer.js +1 -1
- package/src/sap/m/Suggest.js +1 -1
- package/src/sap/m/SuggestionItem.js +2 -2
- package/src/sap/m/SuggestionsList.js +1 -1
- package/src/sap/m/SuggestionsListRenderer.js +1 -1
- package/src/sap/m/SuggestionsPopover.js +2 -2
- package/src/sap/m/Support.js +1 -1
- package/src/sap/m/Switch.js +2 -2
- package/src/sap/m/SwitchRenderer.js +1 -1
- package/src/sap/m/TabContainer.js +2 -2
- package/src/sap/m/TabContainerItem.js +2 -2
- package/src/sap/m/TabContainerRenderer.js +1 -1
- package/src/sap/m/TabStrip.js +2 -2
- package/src/sap/m/TabStripItem.js +2 -2
- package/src/sap/m/TabStripRenderer.js +1 -1
- package/src/sap/m/Table.js +2 -2
- package/src/sap/m/TablePersoController.js +2 -2
- package/src/sap/m/TablePersoDialog.js +2 -2
- package/src/sap/m/TablePersoProvider.js +2 -2
- package/src/sap/m/TableRenderer.js +1 -1
- package/src/sap/m/TableSelectDialog.js +2 -2
- package/src/sap/m/Text.js +2 -2
- package/src/sap/m/TextArea.js +2 -2
- package/src/sap/m/TextAreaRenderer.js +1 -1
- package/src/sap/m/TextRenderer.js +1 -1
- package/src/sap/m/Tile.js +2 -2
- package/src/sap/m/TileContainer.js +2 -2
- package/src/sap/m/TileContainerRenderer.js +1 -1
- package/src/sap/m/TileContent.js +2 -2
- package/src/sap/m/TileContentRenderer.js +1 -1
- package/src/sap/m/TileRenderer.js +1 -1
- package/src/sap/m/TimePicker.js +2 -2
- package/src/sap/m/TimePickerClock.js +2 -2
- package/src/sap/m/TimePickerClockRenderer.js +1 -1
- package/src/sap/m/TimePickerClocks.js +2 -2
- package/src/sap/m/TimePickerClocksRenderer.js +1 -1
- package/src/sap/m/TimePickerInputs.js +2 -2
- package/src/sap/m/TimePickerInputsRenderer.js +1 -1
- package/src/sap/m/TimePickerInternals.js +2 -2
- package/src/sap/m/TimePickerInternalsRenderer.js +1 -1
- package/src/sap/m/TimePickerRenderer.js +1 -1
- package/src/sap/m/TimePickerSlider.js +2 -2
- package/src/sap/m/TimePickerSliderRenderer.js +1 -1
- package/src/sap/m/TimePickerSliders.js +2 -2
- package/src/sap/m/TimePickerSlidersRenderer.js +1 -1
- package/src/sap/m/Title.js +2 -2
- package/src/sap/m/TitlePropagationSupport.js +2 -2
- package/src/sap/m/TitleRenderer.js +1 -1
- package/src/sap/m/ToDoCardRenderer.js +1 -1
- package/src/sap/m/ToggleButton.js +2 -2
- package/src/sap/m/ToggleButtonRenderer.js +1 -1
- package/src/sap/m/Token.js +2 -2
- package/src/sap/m/TokenRenderer.js +1 -1
- package/src/sap/m/Tokenizer.js +2 -2
- package/src/sap/m/TokenizerRenderer.js +1 -1
- package/src/sap/m/Toolbar.js +2 -2
- package/src/sap/m/ToolbarLayoutData.js +2 -2
- package/src/sap/m/ToolbarRenderer.js +1 -1
- package/src/sap/m/ToolbarSeparator.js +2 -2
- package/src/sap/m/ToolbarSeparatorRenderer.js +1 -1
- package/src/sap/m/ToolbarSpacer.js +2 -2
- package/src/sap/m/ToolbarSpacerRenderer.js +1 -1
- package/src/sap/m/Tree.js +2 -2
- package/src/sap/m/TreeItemBase.js +2 -2
- package/src/sap/m/TreeItemBaseRenderer.js +1 -1
- package/src/sap/m/TreeRenderer.js +1 -1
- package/src/sap/m/UploadCollection.js +2 -2
- package/src/sap/m/UploadCollectionItem.js +2 -2
- package/src/sap/m/UploadCollectionParameter.js +2 -2
- package/src/sap/m/UploadCollectionRenderer.js +1 -1
- package/src/sap/m/UploadCollectionToolbarPlaceholder.js +2 -2
- package/src/sap/m/VBox.js +2 -2
- package/src/sap/m/VBoxRenderer.js +1 -1
- package/src/sap/m/ValueStateHeader.js +2 -2
- package/src/sap/m/VariantItem.js +1 -1
- package/src/sap/m/VariantManagement.js +1 -1
- package/src/sap/m/ViewSettingsCustomItem.js +2 -2
- package/src/sap/m/ViewSettingsCustomTab.js +2 -2
- package/src/sap/m/ViewSettingsDialog.js +2 -2
- package/src/sap/m/ViewSettingsDialogRenderer.js +1 -1
- package/src/sap/m/ViewSettingsFilterItem.js +2 -2
- package/src/sap/m/ViewSettingsItem.js +2 -2
- package/src/sap/m/VisibleItem.js +2 -2
- package/src/sap/m/WheelSlider.js +2 -2
- package/src/sap/m/WheelSliderContainer.js +2 -2
- package/src/sap/m/WheelSliderContainerRenderer.js +1 -1
- package/src/sap/m/WheelSliderRenderer.js +1 -1
- package/src/sap/m/Wizard.js +2 -2
- package/src/sap/m/WizardProgressNavigator.js +2 -2
- package/src/sap/m/WizardProgressNavigatorRenderer.js +1 -1
- package/src/sap/m/WizardRenderer.js +1 -1
- package/src/sap/m/WizardStep.js +2 -2
- package/src/sap/m/WizardStepRenderer.js +1 -1
- package/src/sap/m/_thirdparty/purify.js +632 -697
- package/src/sap/m/changeHandler/AddTableColumn.js +2 -2
- package/src/sap/m/changeHandler/ChangeLinkTarget.js +2 -2
- package/src/sap/m/changeHandler/CombineButtons.js +2 -2
- package/src/sap/m/changeHandler/MoveTableColumns.js +2 -2
- package/src/sap/m/changeHandler/SelectIconTabBarFilter.js +2 -2
- package/src/sap/m/changeHandler/SplitMenuButton.js +2 -2
- package/src/sap/m/delegate/DateNavigation.js +1 -1
- package/src/sap/m/delegate/ValueStateMessage.js +1 -1
- package/src/sap/m/designtime/ActionSheet.designtime.js +1 -1
- package/src/sap/m/designtime/Avatar.designtime.js +1 -1
- package/src/sap/m/designtime/Bar.designtime.js +1 -1
- package/src/sap/m/designtime/Breadcrumbs.designtime.js +1 -1
- package/src/sap/m/designtime/BusyDialog.designtime.js +1 -1
- package/src/sap/m/designtime/Button.designtime.js +1 -1
- package/src/sap/m/designtime/Carousel.designtime.js +1 -1
- package/src/sap/m/designtime/CheckBox.designtime.js +1 -1
- package/src/sap/m/designtime/Column.designtime.js +1 -1
- package/src/sap/m/designtime/ComboBox.designtime.js +1 -1
- package/src/sap/m/designtime/CustomListItem.designtime.js +1 -1
- package/src/sap/m/designtime/CustomTile.designtime.js +1 -1
- package/src/sap/m/designtime/DatePicker.designtime.js +1 -1
- package/src/sap/m/designtime/DateRangeSelection.designtime.js +1 -1
- package/src/sap/m/designtime/DateTimeInput.designtime.js +1 -1
- package/src/sap/m/designtime/DateTimePicker.designtime.js +1 -1
- package/src/sap/m/designtime/Dialog.designtime.js +1 -1
- package/src/sap/m/designtime/DraftIndicator.designtime.js +1 -1
- package/src/sap/m/designtime/ExpandableText.designtime.js +1 -1
- package/src/sap/m/designtime/FeedInput.designtime.js +1 -1
- package/src/sap/m/designtime/FeedListItem.designtime.js +1 -1
- package/src/sap/m/designtime/FlexBox.designtime.js +1 -1
- package/src/sap/m/designtime/HBox.designtime.js +1 -1
- package/src/sap/m/designtime/IconTabBar.designtime.js +1 -1
- package/src/sap/m/designtime/IconTabFilter.designtime.js +1 -1
- package/src/sap/m/designtime/IconTabSeparator.designtime.js +1 -1
- package/src/sap/m/designtime/Image.designtime.js +1 -1
- package/src/sap/m/designtime/Input.designtime.js +1 -1
- package/src/sap/m/designtime/InputBase.designtime.js +1 -1
- package/src/sap/m/designtime/InputListItem.designtime.js +1 -1
- package/src/sap/m/designtime/Label.designtime.js +1 -1
- package/src/sap/m/designtime/LightBox.designtime.js +1 -1
- package/src/sap/m/designtime/Link.designtime.js +1 -1
- package/src/sap/m/designtime/ListBase.designtime.js +1 -1
- package/src/sap/m/designtime/ListItemBase.designtime.js +1 -1
- package/src/sap/m/designtime/MenuButton.designtime.js +1 -1
- package/src/sap/m/designtime/MessagePage.designtime.js +1 -1
- package/src/sap/m/designtime/MessageStrip.designtime.js +1 -1
- package/src/sap/m/designtime/MultiComboBox.designtime.js +1 -1
- package/src/sap/m/designtime/MultiInput.designtime.js +1 -1
- package/src/sap/m/designtime/NewsContent.designtime.js +1 -1
- package/src/sap/m/designtime/ObjectAttribute.designtime.js +1 -1
- package/src/sap/m/designtime/ObjectHeader.designtime.js +1 -1
- package/src/sap/m/designtime/ObjectIdentifier.designtime.js +1 -1
- package/src/sap/m/designtime/ObjectListItem.designtime.js +1 -1
- package/src/sap/m/designtime/ObjectMarker.designtime.js +1 -1
- package/src/sap/m/designtime/ObjectNumber.designtime.js +1 -1
- package/src/sap/m/designtime/ObjectStatus.designtime.js +1 -1
- package/src/sap/m/designtime/OverflowToolbar.designtime.js +1 -1
- package/src/sap/m/designtime/OverflowToolbarButton.designtime.js +1 -1
- package/src/sap/m/designtime/Page.designtime.js +1 -1
- package/src/sap/m/designtime/Panel.designtime.js +1 -1
- package/src/sap/m/designtime/PlanningCalendar.designtime.js +1 -1
- package/src/sap/m/designtime/PlanningCalendarLegend.designtime.js +1 -1
- package/src/sap/m/designtime/Popover.designtime.js +1 -1
- package/src/sap/m/designtime/ProgressIndicator.designtime.js +1 -1
- package/src/sap/m/designtime/QuickView.designtime.js +1 -1
- package/src/sap/m/designtime/QuickViewCard.designtime.js +1 -1
- package/src/sap/m/designtime/RadioButton.designtime.js +1 -1
- package/src/sap/m/designtime/RadioButtonGroup.designtime.js +1 -1
- package/src/sap/m/designtime/RangeSlider.designtime.js +1 -1
- package/src/sap/m/designtime/RatingIndicator.designtime.js +1 -1
- package/src/sap/m/designtime/ScrollContainer.designtime.js +1 -1
- package/src/sap/m/designtime/SearchField.designtime.js +1 -1
- package/src/sap/m/designtime/SegmentedButton.designtime.js +1 -1
- package/src/sap/m/designtime/Select.designtime.js +1 -1
- package/src/sap/m/designtime/Slider.designtime.js +1 -1
- package/src/sap/m/designtime/SplitApp.designtime.js +1 -1
- package/src/sap/m/designtime/SplitContainer.designtime.js +1 -1
- package/src/sap/m/designtime/StandardListItem.designtime.js +1 -1
- package/src/sap/m/designtime/StepInput.designtime.js +1 -1
- package/src/sap/m/designtime/Switch.designtime.js +1 -1
- package/src/sap/m/designtime/TabContainer.designtime.js +1 -1
- package/src/sap/m/designtime/Table.designtime.js +1 -1
- package/src/sap/m/designtime/Text.designtime.js +1 -1
- package/src/sap/m/designtime/TextArea.designtime.js +1 -1
- package/src/sap/m/designtime/TimePicker.designtime.js +1 -1
- package/src/sap/m/designtime/Title.designtime.js +1 -1
- package/src/sap/m/designtime/ToggleButton.designtime.js +1 -1
- package/src/sap/m/designtime/Toolbar.designtime.js +1 -1
- package/src/sap/m/designtime/VBox.designtime.js +1 -1
- package/src/sap/m/designtime/VariantManagement.designtime.js +1 -1
- package/src/sap/m/designtime/Wizard.designtime.js +1 -1
- package/src/sap/m/designtime/library.designtime.js +1 -1
- package/src/sap/m/designtime/semantic/DetailPage.designtime.js +1 -1
- package/src/sap/m/designtime/semantic/SemanticPage.designtime.js +1 -1
- package/src/sap/m/designtime/semantic/ShareMenuPage.designtime.js +1 -1
- package/src/sap/m/flexibility/Avatar.flexibility.js +1 -1
- package/src/sap/m/flexibility/Bar.flexibility.js +1 -1
- package/src/sap/m/flexibility/Button.flexibility.js +1 -1
- package/src/sap/m/flexibility/CheckBox.flexibility.js +1 -1
- package/src/sap/m/flexibility/Dialog.flexibility.js +1 -1
- package/src/sap/m/flexibility/EngineFlex.js +1 -1
- package/src/sap/m/flexibility/ExpandableText.flexibility.js +1 -1
- package/src/sap/m/flexibility/IconTabBar.flexibility.js +1 -1
- package/src/sap/m/flexibility/IconTabFilter.flexibility.js +1 -1
- package/src/sap/m/flexibility/InputListItem.flexibility.js +1 -1
- package/src/sap/m/flexibility/Label.flexibility.js +1 -1
- package/src/sap/m/flexibility/Link.flexibility.js +1 -1
- package/src/sap/m/flexibility/MenuButton.flexibility.js +1 -1
- package/src/sap/m/flexibility/OverflowToolbar.flexibility.js +1 -1
- package/src/sap/m/flexibility/OverflowToolbarButton.flexibility.js +1 -1
- package/src/sap/m/flexibility/Page.flexibility.js +1 -1
- package/src/sap/m/flexibility/Panel.flexibility.js +1 -1
- package/src/sap/m/flexibility/Popover.flexibility.js +1 -1
- package/src/sap/m/flexibility/RadioButton.flexibility.js +1 -1
- package/src/sap/m/flexibility/StandardListItem.flexibility.js +1 -1
- package/src/sap/m/flexibility/Table.flexibility.js +1 -1
- package/src/sap/m/flexibility/Text.flexibility.js +1 -1
- package/src/sap/m/flexibility/Title.flexibility.js +1 -1
- package/src/sap/m/flexibility/Toolbar.flexibility.js +1 -1
- package/src/sap/m/inputUtils/ListHelpers.js +1 -1
- package/src/sap/m/inputUtils/SuggestionsPopoverDialogMixin.js +1 -1
- package/src/sap/m/inputUtils/SuggestionsPopoverPopoverMixin.js +1 -1
- package/src/sap/m/inputUtils/calculateSelectionStart.js +1 -1
- package/src/sap/m/inputUtils/completeTextSelected.js +1 -1
- package/src/sap/m/inputUtils/filterItems.js +1 -1
- package/src/sap/m/inputUtils/forwardItemProperties.js +1 -1
- package/src/sap/m/inputUtils/forwardItemPropertiesToToken.js +1 -1
- package/src/sap/m/inputUtils/getTokenByItem.js +1 -1
- package/src/sap/m/inputUtils/highlightDOMElements.js +1 -1
- package/src/sap/m/inputUtils/inputsDefaultFilter.js +1 -1
- package/src/sap/m/inputUtils/itemsVisibilityHandler.js +1 -1
- package/src/sap/m/inputUtils/scrollToItem.js +1 -1
- package/src/sap/m/inputUtils/selectionRange.js +1 -1
- package/src/sap/m/inputUtils/typeAhead.js +1 -1
- package/src/sap/m/inputUtils/wordStartsWithValue.js +1 -1
- package/src/sap/m/library.js +3 -3
- package/src/sap/m/library.support.js +1 -1
- package/src/sap/m/messagebundle_ar.properties +1 -1
- package/src/sap/m/p13n/AbstractContainer.js +3 -3
- package/src/sap/m/p13n/AbstractContainerItem.js +3 -3
- package/src/sap/m/p13n/BasePanel.js +2 -2
- package/src/sap/m/p13n/Container.js +2 -2
- package/src/sap/m/p13n/Engine.js +2 -2
- package/src/sap/m/p13n/FlexUtil.js +1 -1
- package/src/sap/m/p13n/GroupController.js +2 -2
- package/src/sap/m/p13n/GroupPanel.js +2 -2
- package/src/sap/m/p13n/MetadataHelper.js +1 -1
- package/src/sap/m/p13n/PersistenceProvider.js +1 -1
- package/src/sap/m/p13n/Popup.js +2 -2
- package/src/sap/m/p13n/QueryPanel.js +2 -2
- package/src/sap/m/p13n/SelectionController.js +2 -2
- package/src/sap/m/p13n/SelectionPanel.js +2 -2
- package/src/sap/m/p13n/SortController.js +2 -2
- package/src/sap/m/p13n/SortPanel.js +2 -2
- package/src/sap/m/p13n/enum/PersistenceMode.js +1 -1
- package/src/sap/m/p13n/handler/xConfigHandler.js +1 -1
- package/src/sap/m/p13n/modification/FlexModificationHandler.js +1 -1
- package/src/sap/m/p13n/modification/LocalStorageModificationHandler.js +1 -1
- package/src/sap/m/p13n/modification/ModificationHandler.js +1 -1
- package/src/sap/m/p13n/modules/AdaptationProvider.js +1 -1
- package/src/sap/m/p13n/modules/DefaultProviderRegistry.js +2 -2
- package/src/sap/m/p13n/modules/StateHandlerRegistry.js +2 -2
- package/src/sap/m/p13n/modules/UIManager.js +2 -2
- package/src/sap/m/p13n/modules/xConfigAPI.js +1 -1
- package/src/sap/m/plugins/CellSelector.js +2 -2
- package/src/sap/m/plugins/ColumnResizer.js +2 -2
- package/src/sap/m/plugins/DataStateIndicator.js +2 -2
- package/src/sap/m/plugins/PasteProvider.js +2 -2
- package/src/sap/m/plugins/PluginBase.js +2 -2
- package/src/sap/m/routing/RouteMatchedHandler.js +1 -1
- package/src/sap/m/routing/Router.js +1 -1
- package/src/sap/m/routing/Target.js +1 -1
- package/src/sap/m/routing/TargetHandler.js +1 -1
- package/src/sap/m/routing/Targets.js +1 -1
- package/src/sap/m/routing/async/Target.js +1 -1
- package/src/sap/m/routing/async/Targets.js +1 -1
- package/src/sap/m/routing/sync/Target.js +1 -1
- package/src/sap/m/routing/sync/Targets.js +1 -1
- package/src/sap/m/rules/Breadcrumbs.support.js +1 -1
- package/src/sap/m/rules/Button.support.js +1 -1
- package/src/sap/m/rules/CheckBox.support.js +1 -1
- package/src/sap/m/rules/DatePicker.support.js +1 -1
- package/src/sap/m/rules/DateRangeSelection.support.js +1 -1
- package/src/sap/m/rules/Dialog.support.js +1 -1
- package/src/sap/m/rules/FacetFilter.support.js +1 -1
- package/src/sap/m/rules/IconTabBar.support.js +1 -1
- package/src/sap/m/rules/Image.support.js +1 -1
- package/src/sap/m/rules/Input.support.js +1 -1
- package/src/sap/m/rules/Link.support.js +1 -1
- package/src/sap/m/rules/MaskInput.support.js +1 -1
- package/src/sap/m/rules/MessagePage.support.js +1 -1
- package/src/sap/m/rules/ObjectHeader.support.js +1 -1
- package/src/sap/m/rules/ObjectListItem.support.js +1 -1
- package/src/sap/m/rules/ObjectMarker.support.js +1 -1
- package/src/sap/m/rules/ObjectStatus.support.js +1 -1
- package/src/sap/m/rules/Panel.support.js +1 -1
- package/src/sap/m/rules/Select.support.js +1 -1
- package/src/sap/m/rules/SelectDialog.support.js +1 -1
- package/src/sap/m/rules/StepInput.support.js +1 -1
- package/src/sap/m/rules/Table.support.js +1 -1
- package/src/sap/m/rules/Title.support.js +1 -1
- package/src/sap/m/rules/Tokenizer.support.js +1 -1
- package/src/sap/m/rules/ViewSettingsDialog.support.js +1 -1
- package/src/sap/m/semantic/AddAction.js +2 -2
- package/src/sap/m/semantic/CancelAction.js +2 -2
- package/src/sap/m/semantic/DeleteAction.js +2 -2
- package/src/sap/m/semantic/DetailPage.js +2 -2
- package/src/sap/m/semantic/DiscussInJamAction.js +2 -2
- package/src/sap/m/semantic/EditAction.js +2 -2
- package/src/sap/m/semantic/FavoriteAction.js +2 -2
- package/src/sap/m/semantic/FilterAction.js +2 -2
- package/src/sap/m/semantic/FilterSelect.js +2 -2
- package/src/sap/m/semantic/FlagAction.js +2 -2
- package/src/sap/m/semantic/ForwardAction.js +2 -2
- package/src/sap/m/semantic/FullscreenPage.js +2 -2
- package/src/sap/m/semantic/GroupAction.js +2 -2
- package/src/sap/m/semantic/GroupSelect.js +2 -2
- package/src/sap/m/semantic/MainAction.js +2 -2
- package/src/sap/m/semantic/MasterPage.js +2 -2
- package/src/sap/m/semantic/MessagesIndicator.js +2 -2
- package/src/sap/m/semantic/MultiSelectAction.js +2 -2
- package/src/sap/m/semantic/NegativeAction.js +2 -2
- package/src/sap/m/semantic/OpenInAction.js +2 -2
- package/src/sap/m/semantic/PositiveAction.js +2 -2
- package/src/sap/m/semantic/PrintAction.js +2 -2
- package/src/sap/m/semantic/SaveAction.js +2 -2
- package/src/sap/m/semantic/Segment.js +2 -2
- package/src/sap/m/semantic/SegmentedContainer.js +2 -2
- package/src/sap/m/semantic/SemanticButton.js +2 -2
- package/src/sap/m/semantic/SemanticConfiguration.js +2 -2
- package/src/sap/m/semantic/SemanticControl.js +2 -2
- package/src/sap/m/semantic/SemanticOverflowToolbarButton.js +2 -2
- package/src/sap/m/semantic/SemanticOverflowToolbarToggleButton.js +2 -2
- package/src/sap/m/semantic/SemanticPage.js +2 -2
- package/src/sap/m/semantic/SemanticPageRenderer.js +1 -1
- package/src/sap/m/semantic/SemanticSelect.js +2 -2
- package/src/sap/m/semantic/SemanticToggleButton.js +2 -2
- package/src/sap/m/semantic/SendEmailAction.js +2 -2
- package/src/sap/m/semantic/SendMessageAction.js +2 -2
- package/src/sap/m/semantic/ShareInJamAction.js +2 -2
- package/src/sap/m/semantic/ShareMenu.js +2 -2
- package/src/sap/m/semantic/ShareMenuPage.js +2 -2
- package/src/sap/m/semantic/SortAction.js +2 -2
- package/src/sap/m/semantic/SortSelect.js +2 -2
- package/src/sap/m/table/Util.js +2 -2
- package/src/sap/m/table/columnmenu/ActionItem.js +2 -2
- package/src/sap/m/table/columnmenu/Entry.js +2 -2
- package/src/sap/m/table/columnmenu/Item.js +2 -2
- package/src/sap/m/table/columnmenu/ItemBase.js +2 -2
- package/src/sap/m/table/columnmenu/ItemContainer.js +1 -1
- package/src/sap/m/table/columnmenu/Menu.js +2 -2
- package/src/sap/m/table/columnmenu/MenuRenderer.js +1 -1
- package/src/sap/m/table/columnmenu/QuickAction.js +2 -2
- package/src/sap/m/table/columnmenu/QuickActionBase.js +2 -2
- package/src/sap/m/table/columnmenu/QuickActionContainer.js +1 -1
- package/src/sap/m/table/columnmenu/QuickActionItem.js +2 -2
- package/src/sap/m/table/columnmenu/QuickGroup.js +2 -2
- package/src/sap/m/table/columnmenu/QuickGroupItem.js +2 -2
- package/src/sap/m/table/columnmenu/QuickSort.js +2 -2
- package/src/sap/m/table/columnmenu/QuickSortItem.js +2 -2
- package/src/sap/m/table/columnmenu/QuickTotal.js +2 -2
- package/src/sap/m/table/columnmenu/QuickTotalItem.js +2 -2
- package/src/sap/m/themes/base/FeedListItem.less +2 -2
- package/src/sap/m/themes/base/library.source.less +1 -1
- package/src/sap/m/themes/sap_hcb/library.source.less +1 -1
- package/src/sap/m/upload/UploadSet.js +37 -2
- package/src/sap/m/upload/UploadSetItem.js +4 -3
- package/src/sap/m/upload/UploadSetRenderer.js +1 -1
- package/src/sap/m/upload/UploadSetToolbarPlaceholder.js +2 -2
- package/src/sap/m/upload/Uploader.js +1 -1
- package/src/sap/m/upload/UploaderHttpRequestMethod.js +1 -1
|
@@ -1,301 +1,286 @@
|
|
|
1
|
-
/*! @license DOMPurify
|
|
1
|
+
/*! @license DOMPurify 3.1.7 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.1.7/LICENSE */
|
|
2
2
|
|
|
3
3
|
sap.ui.define([], function () { 'use strict';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return _setPrototypeOf(o, p);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function _isNativeReflectConstruct() {
|
|
25
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
26
|
-
if (Reflect.construct.sham) return false;
|
|
27
|
-
if (typeof Proxy === "function") return true;
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
31
|
-
return true;
|
|
32
|
-
} catch (e) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function _construct(Parent, args, Class) {
|
|
38
|
-
if (_isNativeReflectConstruct()) {
|
|
39
|
-
_construct = Reflect.construct;
|
|
40
|
-
} else {
|
|
41
|
-
_construct = function _construct(Parent, args, Class) {
|
|
42
|
-
var a = [null];
|
|
43
|
-
a.push.apply(a, args);
|
|
44
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
45
|
-
var instance = new Constructor();
|
|
46
|
-
if (Class) _setPrototypeOf(instance, Class.prototype);
|
|
47
|
-
return instance;
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return _construct.apply(null, arguments);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _toConsumableArray(arr) {
|
|
55
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function _arrayWithoutHoles(arr) {
|
|
59
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function _iterableToArray(iter) {
|
|
63
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
67
|
-
if (!o) return;
|
|
68
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
69
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
70
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
71
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
72
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function _arrayLikeToArray(arr, len) {
|
|
76
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
77
|
-
|
|
78
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
79
|
-
|
|
80
|
-
return arr2;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function _nonIterableSpread() {
|
|
84
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
var hasOwnProperty = Object.hasOwnProperty,
|
|
88
|
-
setPrototypeOf = Object.setPrototypeOf,
|
|
89
|
-
isFrozen = Object.isFrozen,
|
|
90
|
-
getPrototypeOf = Object.getPrototypeOf,
|
|
91
|
-
getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
92
|
-
var freeze = Object.freeze,
|
|
93
|
-
seal = Object.seal,
|
|
94
|
-
create = Object.create; // eslint-disable-line import/no-mutable-exports
|
|
95
|
-
|
|
96
|
-
var _ref = typeof Reflect !== 'undefined' && Reflect,
|
|
97
|
-
apply = _ref.apply,
|
|
98
|
-
construct = _ref.construct;
|
|
99
|
-
|
|
100
|
-
if (!apply) {
|
|
101
|
-
apply = function apply(fun, thisValue, args) {
|
|
102
|
-
return fun.apply(thisValue, args);
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
5
|
+
const {
|
|
6
|
+
entries,
|
|
7
|
+
setPrototypeOf,
|
|
8
|
+
isFrozen,
|
|
9
|
+
getPrototypeOf,
|
|
10
|
+
getOwnPropertyDescriptor
|
|
11
|
+
} = Object;
|
|
12
|
+
let {
|
|
13
|
+
freeze,
|
|
14
|
+
seal,
|
|
15
|
+
create
|
|
16
|
+
} = Object; // eslint-disable-line import/no-mutable-exports
|
|
17
|
+
let {
|
|
18
|
+
apply,
|
|
19
|
+
construct
|
|
20
|
+
} = typeof Reflect !== 'undefined' && Reflect;
|
|
106
21
|
if (!freeze) {
|
|
107
22
|
freeze = function freeze(x) {
|
|
108
23
|
return x;
|
|
109
24
|
};
|
|
110
25
|
}
|
|
111
|
-
|
|
112
26
|
if (!seal) {
|
|
113
27
|
seal = function seal(x) {
|
|
114
28
|
return x;
|
|
115
29
|
};
|
|
116
30
|
}
|
|
117
|
-
|
|
31
|
+
if (!apply) {
|
|
32
|
+
apply = function apply(fun, thisValue, args) {
|
|
33
|
+
return fun.apply(thisValue, args);
|
|
34
|
+
};
|
|
35
|
+
}
|
|
118
36
|
if (!construct) {
|
|
119
37
|
construct = function construct(Func, args) {
|
|
120
|
-
return
|
|
38
|
+
return new Func(...args);
|
|
121
39
|
};
|
|
122
40
|
}
|
|
41
|
+
const arrayForEach = unapply(Array.prototype.forEach);
|
|
42
|
+
const arrayPop = unapply(Array.prototype.pop);
|
|
43
|
+
const arrayPush = unapply(Array.prototype.push);
|
|
44
|
+
const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
45
|
+
const stringToString = unapply(String.prototype.toString);
|
|
46
|
+
const stringMatch = unapply(String.prototype.match);
|
|
47
|
+
const stringReplace = unapply(String.prototype.replace);
|
|
48
|
+
const stringIndexOf = unapply(String.prototype.indexOf);
|
|
49
|
+
const stringTrim = unapply(String.prototype.trim);
|
|
50
|
+
const objectHasOwnProperty = unapply(Object.prototype.hasOwnProperty);
|
|
51
|
+
const regExpTest = unapply(RegExp.prototype.test);
|
|
52
|
+
const typeErrorCreate = unconstruct(TypeError);
|
|
123
53
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
var stringIndexOf = unapply(String.prototype.indexOf);
|
|
131
|
-
var stringTrim = unapply(String.prototype.trim);
|
|
132
|
-
var regExpTest = unapply(RegExp.prototype.test);
|
|
133
|
-
var typeErrorCreate = unconstruct(TypeError);
|
|
54
|
+
/**
|
|
55
|
+
* Creates a new function that calls the given function with a specified thisArg and arguments.
|
|
56
|
+
*
|
|
57
|
+
* @param {Function} func - The function to be wrapped and called.
|
|
58
|
+
* @returns {Function} A new function that calls the given function with a specified thisArg and arguments.
|
|
59
|
+
*/
|
|
134
60
|
function unapply(func) {
|
|
135
61
|
return function (thisArg) {
|
|
136
62
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
137
63
|
args[_key - 1] = arguments[_key];
|
|
138
64
|
}
|
|
139
|
-
|
|
140
65
|
return apply(func, thisArg, args);
|
|
141
66
|
};
|
|
142
67
|
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Creates a new function that constructs an instance of the given constructor function with the provided arguments.
|
|
71
|
+
*
|
|
72
|
+
* @param {Function} func - The constructor function to be wrapped and called.
|
|
73
|
+
* @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.
|
|
74
|
+
*/
|
|
143
75
|
function unconstruct(func) {
|
|
144
76
|
return function () {
|
|
145
77
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
146
78
|
args[_key2] = arguments[_key2];
|
|
147
79
|
}
|
|
148
|
-
|
|
149
80
|
return construct(func, args);
|
|
150
81
|
};
|
|
151
82
|
}
|
|
152
|
-
/* Add properties to a lookup table */
|
|
153
|
-
|
|
154
|
-
function addToSet(set, array, transformCaseFunc) {
|
|
155
|
-
transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase;
|
|
156
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Add properties to a lookup table
|
|
86
|
+
*
|
|
87
|
+
* @param {Object} set - The set to which elements will be added.
|
|
88
|
+
* @param {Array} array - The array containing elements to be added to the set.
|
|
89
|
+
* @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.
|
|
90
|
+
* @returns {Object} The modified set with added elements.
|
|
91
|
+
*/
|
|
92
|
+
function addToSet(set, array) {
|
|
93
|
+
let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
|
|
157
94
|
if (setPrototypeOf) {
|
|
158
95
|
// Make 'in' and truthy checks like Boolean(set.constructor)
|
|
159
96
|
// independent of any properties defined on Object.prototype.
|
|
160
97
|
// Prevent prototype setters from intercepting set as a this value.
|
|
161
98
|
setPrototypeOf(set, null);
|
|
162
99
|
}
|
|
163
|
-
|
|
164
|
-
var l = array.length;
|
|
165
|
-
|
|
100
|
+
let l = array.length;
|
|
166
101
|
while (l--) {
|
|
167
|
-
|
|
168
|
-
|
|
102
|
+
let element = array[l];
|
|
169
103
|
if (typeof element === 'string') {
|
|
170
|
-
|
|
171
|
-
|
|
104
|
+
const lcElement = transformCaseFunc(element);
|
|
172
105
|
if (lcElement !== element) {
|
|
173
106
|
// Config presets (e.g. tags.js, attrs.js) are immutable.
|
|
174
107
|
if (!isFrozen(array)) {
|
|
175
108
|
array[l] = lcElement;
|
|
176
109
|
}
|
|
177
|
-
|
|
178
110
|
element = lcElement;
|
|
179
111
|
}
|
|
180
112
|
}
|
|
181
|
-
|
|
182
113
|
set[element] = true;
|
|
183
114
|
}
|
|
184
|
-
|
|
185
115
|
return set;
|
|
186
116
|
}
|
|
187
|
-
/* Shallow clone an object */
|
|
188
|
-
|
|
189
|
-
function clone(object) {
|
|
190
|
-
var newObject = create(null);
|
|
191
|
-
var property;
|
|
192
117
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Clean up an array to harden against CSPP
|
|
120
|
+
*
|
|
121
|
+
* @param {Array} array - The array to be cleaned.
|
|
122
|
+
* @returns {Array} The cleaned version of the array
|
|
123
|
+
*/
|
|
124
|
+
function cleanArray(array) {
|
|
125
|
+
for (let index = 0; index < array.length; index++) {
|
|
126
|
+
const isPropertyExist = objectHasOwnProperty(array, index);
|
|
127
|
+
if (!isPropertyExist) {
|
|
128
|
+
array[index] = null;
|
|
196
129
|
}
|
|
197
130
|
}
|
|
131
|
+
return array;
|
|
132
|
+
}
|
|
198
133
|
|
|
134
|
+
/**
|
|
135
|
+
* Shallow clone an object
|
|
136
|
+
*
|
|
137
|
+
* @param {Object} object - The object to be cloned.
|
|
138
|
+
* @returns {Object} A new object that copies the original.
|
|
139
|
+
*/
|
|
140
|
+
function clone(object) {
|
|
141
|
+
const newObject = create(null);
|
|
142
|
+
for (const [property, value] of entries(object)) {
|
|
143
|
+
const isPropertyExist = objectHasOwnProperty(object, property);
|
|
144
|
+
if (isPropertyExist) {
|
|
145
|
+
if (Array.isArray(value)) {
|
|
146
|
+
newObject[property] = cleanArray(value);
|
|
147
|
+
} else if (value && typeof value === 'object' && value.constructor === Object) {
|
|
148
|
+
newObject[property] = clone(value);
|
|
149
|
+
} else {
|
|
150
|
+
newObject[property] = value;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
199
154
|
return newObject;
|
|
200
155
|
}
|
|
201
|
-
/* IE10 doesn't support __lookupGetter__ so lets'
|
|
202
|
-
* simulate it. It also automatically checks
|
|
203
|
-
* if the prop is function or getter and behaves
|
|
204
|
-
* accordingly. */
|
|
205
156
|
|
|
157
|
+
/**
|
|
158
|
+
* This method automatically checks if the prop is function or getter and behaves accordingly.
|
|
159
|
+
*
|
|
160
|
+
* @param {Object} object - The object to look up the getter function in its prototype chain.
|
|
161
|
+
* @param {String} prop - The property name for which to find the getter function.
|
|
162
|
+
* @returns {Function} The getter function found in the prototype chain or a fallback function.
|
|
163
|
+
*/
|
|
206
164
|
function lookupGetter(object, prop) {
|
|
207
165
|
while (object !== null) {
|
|
208
|
-
|
|
209
|
-
|
|
166
|
+
const desc = getOwnPropertyDescriptor(object, prop);
|
|
210
167
|
if (desc) {
|
|
211
168
|
if (desc.get) {
|
|
212
169
|
return unapply(desc.get);
|
|
213
170
|
}
|
|
214
|
-
|
|
215
171
|
if (typeof desc.value === 'function') {
|
|
216
172
|
return unapply(desc.value);
|
|
217
173
|
}
|
|
218
174
|
}
|
|
219
|
-
|
|
220
175
|
object = getPrototypeOf(object);
|
|
221
176
|
}
|
|
222
|
-
|
|
223
|
-
function fallbackValue(element) {
|
|
224
|
-
console.warn('fallback value for', element);
|
|
177
|
+
function fallbackValue() {
|
|
225
178
|
return null;
|
|
226
179
|
}
|
|
227
|
-
|
|
228
180
|
return fallbackValue;
|
|
229
181
|
}
|
|
230
182
|
|
|
231
|
-
|
|
183
|
+
const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
|
|
232
184
|
|
|
233
|
-
|
|
234
|
-
|
|
185
|
+
// SVG
|
|
186
|
+
const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
187
|
+
const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
|
|
188
|
+
|
|
189
|
+
// List of SVG elements that are disallowed by default.
|
|
235
190
|
// We still need to know them so that we can do namespace
|
|
236
191
|
// checks properly in case one wants to add them to
|
|
237
192
|
// allow-list.
|
|
193
|
+
const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
|
|
194
|
+
const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);
|
|
238
195
|
|
|
239
|
-
|
|
240
|
-
var mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); // Similarly to SVG, we want to know all MathML elements,
|
|
196
|
+
// Similarly to SVG, we want to know all MathML elements,
|
|
241
197
|
// even those that we disallow by default.
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
198
|
+
const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
|
|
199
|
+
const text = freeze(['#text']);
|
|
200
|
+
|
|
201
|
+
const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'popover', 'popovertarget', 'popovertargetaction', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'wrap', 'xmlns', 'slot']);
|
|
202
|
+
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'amplitude', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'exponent', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'intercept', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'slope', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'tablevalues', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
203
|
+
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
|
204
|
+
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
205
|
+
|
|
206
|
+
// eslint-disable-next-line unicorn/better-regex
|
|
207
|
+
const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
|
|
208
|
+
const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
|
209
|
+
const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
|
|
210
|
+
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
|
|
211
|
+
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
|
212
|
+
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
259
213
|
);
|
|
260
|
-
|
|
261
|
-
|
|
214
|
+
const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
215
|
+
const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
|
|
262
216
|
);
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
217
|
+
const DOCTYPE_NAME = seal(/^html$/i);
|
|
218
|
+
const CUSTOM_ELEMENT = seal(/^[a-z][.\w]*(-[.\w]+)+$/i);
|
|
219
|
+
|
|
220
|
+
var EXPRESSIONS = /*#__PURE__*/Object.freeze({
|
|
221
|
+
__proto__: null,
|
|
222
|
+
MUSTACHE_EXPR: MUSTACHE_EXPR,
|
|
223
|
+
ERB_EXPR: ERB_EXPR,
|
|
224
|
+
TMPLIT_EXPR: TMPLIT_EXPR,
|
|
225
|
+
DATA_ATTR: DATA_ATTR,
|
|
226
|
+
ARIA_ATTR: ARIA_ATTR,
|
|
227
|
+
IS_ALLOWED_URI: IS_ALLOWED_URI,
|
|
228
|
+
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
|
|
229
|
+
ATTR_WHITESPACE: ATTR_WHITESPACE,
|
|
230
|
+
DOCTYPE_NAME: DOCTYPE_NAME,
|
|
231
|
+
CUSTOM_ELEMENT: CUSTOM_ELEMENT
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
|
|
235
|
+
const NODE_TYPE = {
|
|
236
|
+
element: 1,
|
|
237
|
+
attribute: 2,
|
|
238
|
+
text: 3,
|
|
239
|
+
cdataSection: 4,
|
|
240
|
+
entityReference: 5,
|
|
241
|
+
// Deprecated
|
|
242
|
+
entityNode: 6,
|
|
243
|
+
// Deprecated
|
|
244
|
+
progressingInstruction: 7,
|
|
245
|
+
comment: 8,
|
|
246
|
+
document: 9,
|
|
247
|
+
documentType: 10,
|
|
248
|
+
documentFragment: 11,
|
|
249
|
+
notation: 12 // Deprecated
|
|
250
|
+
};
|
|
251
|
+
const getGlobal = function getGlobal() {
|
|
266
252
|
return typeof window === 'undefined' ? null : window;
|
|
267
253
|
};
|
|
254
|
+
|
|
268
255
|
/**
|
|
269
256
|
* Creates a no-op policy for internal use only.
|
|
270
257
|
* Don't export this function outside this module!
|
|
271
|
-
* @param {
|
|
272
|
-
* @param {
|
|
273
|
-
* @return {
|
|
274
|
-
* are not supported).
|
|
258
|
+
* @param {TrustedTypePolicyFactory} trustedTypes The policy factory.
|
|
259
|
+
* @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
|
|
260
|
+
* @return {TrustedTypePolicy} The policy created (or null, if Trusted Types
|
|
261
|
+
* are not supported or creating the policy failed).
|
|
275
262
|
*/
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
|
|
279
|
-
if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
|
|
263
|
+
const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
|
|
264
|
+
if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
|
|
280
265
|
return null;
|
|
281
|
-
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// Allow the callers to control the unique policy name
|
|
282
269
|
// by adding a data-tt-policy-suffix to the script element with the DOMPurify.
|
|
283
270
|
// Policy creation with duplicate names throws in Trusted Types.
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {
|
|
290
|
-
suffix = document.currentScript.getAttribute(ATTR_NAME);
|
|
271
|
+
let suffix = null;
|
|
272
|
+
const ATTR_NAME = 'data-tt-policy-suffix';
|
|
273
|
+
if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
|
|
274
|
+
suffix = purifyHostElement.getAttribute(ATTR_NAME);
|
|
291
275
|
}
|
|
292
|
-
|
|
293
|
-
var policyName = 'dompurify' + (suffix ? '#' + suffix : '');
|
|
294
|
-
|
|
276
|
+
const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
|
|
295
277
|
try {
|
|
296
278
|
return trustedTypes.createPolicy(policyName, {
|
|
297
|
-
createHTML
|
|
279
|
+
createHTML(html) {
|
|
298
280
|
return html;
|
|
281
|
+
},
|
|
282
|
+
createScriptURL(scriptUrl) {
|
|
283
|
+
return scriptUrl;
|
|
299
284
|
}
|
|
300
285
|
});
|
|
301
286
|
} catch (_) {
|
|
@@ -306,114 +291,113 @@ sap.ui.define([], function () { 'use strict';
|
|
|
306
291
|
return null;
|
|
307
292
|
}
|
|
308
293
|
};
|
|
309
|
-
|
|
310
294
|
function createDOMPurify() {
|
|
311
|
-
|
|
295
|
+
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
296
|
+
const DOMPurify = root => createDOMPurify(root);
|
|
312
297
|
|
|
313
|
-
var DOMPurify = function DOMPurify(root) {
|
|
314
|
-
return createDOMPurify(root);
|
|
315
|
-
};
|
|
316
298
|
/**
|
|
317
299
|
* Version label, exposed for easier checks
|
|
318
300
|
* if DOMPurify is up to date or not
|
|
319
301
|
*/
|
|
302
|
+
DOMPurify.version = '3.1.7';
|
|
320
303
|
|
|
321
|
-
|
|
322
|
-
DOMPurify.version = '2.3.8';
|
|
323
304
|
/**
|
|
324
305
|
* Array of elements that DOMPurify removed during sanitation.
|
|
325
306
|
* Empty if nothing was removed.
|
|
326
307
|
*/
|
|
327
|
-
|
|
328
308
|
DOMPurify.removed = [];
|
|
329
|
-
|
|
330
|
-
if (!window || !window.document || window.document.nodeType !== 9) {
|
|
309
|
+
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) {
|
|
331
310
|
// Not running in a browser, provide a factory function
|
|
332
311
|
// so that you can pass your own Window
|
|
333
312
|
DOMPurify.isSupported = false;
|
|
334
313
|
return DOMPurify;
|
|
335
314
|
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
315
|
+
let {
|
|
316
|
+
document
|
|
317
|
+
} = window;
|
|
318
|
+
const originalDocument = document;
|
|
319
|
+
const currentScript = originalDocument.currentScript;
|
|
320
|
+
const {
|
|
321
|
+
DocumentFragment,
|
|
322
|
+
HTMLTemplateElement,
|
|
323
|
+
Node,
|
|
324
|
+
Element,
|
|
325
|
+
NodeFilter,
|
|
326
|
+
NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
|
|
327
|
+
HTMLFormElement,
|
|
328
|
+
DOMParser,
|
|
329
|
+
trustedTypes
|
|
330
|
+
} = window;
|
|
331
|
+
const ElementPrototype = Element.prototype;
|
|
332
|
+
const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
|
|
333
|
+
const remove = lookupGetter(ElementPrototype, 'remove');
|
|
334
|
+
const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
|
|
335
|
+
const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
|
|
336
|
+
const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
|
|
337
|
+
|
|
338
|
+
// As per issue #47, the web-components registry is inherited by a
|
|
354
339
|
// new document created via createHTMLDocument. As per the spec
|
|
355
340
|
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
|
|
356
341
|
// a new empty registry is used when creating a template contents owner
|
|
357
342
|
// document, so we use that as our parent document to ensure nothing
|
|
358
343
|
// is inherited.
|
|
359
|
-
|
|
360
344
|
if (typeof HTMLTemplateElement === 'function') {
|
|
361
|
-
|
|
362
|
-
|
|
345
|
+
const template = document.createElement('template');
|
|
363
346
|
if (template.content && template.content.ownerDocument) {
|
|
364
347
|
document = template.content.ownerDocument;
|
|
365
348
|
}
|
|
366
349
|
}
|
|
350
|
+
let trustedTypesPolicy;
|
|
351
|
+
let emptyHTML = '';
|
|
352
|
+
const {
|
|
353
|
+
implementation,
|
|
354
|
+
createNodeIterator,
|
|
355
|
+
createDocumentFragment,
|
|
356
|
+
getElementsByTagName
|
|
357
|
+
} = document;
|
|
358
|
+
const {
|
|
359
|
+
importNode
|
|
360
|
+
} = originalDocument;
|
|
361
|
+
let hooks = {};
|
|
367
362
|
|
|
368
|
-
var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);
|
|
369
|
-
|
|
370
|
-
var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';
|
|
371
|
-
var _document = document,
|
|
372
|
-
implementation = _document.implementation,
|
|
373
|
-
createNodeIterator = _document.createNodeIterator,
|
|
374
|
-
createDocumentFragment = _document.createDocumentFragment,
|
|
375
|
-
getElementsByTagName = _document.getElementsByTagName;
|
|
376
|
-
var importNode = originalDocument.importNode;
|
|
377
|
-
var documentMode = {};
|
|
378
|
-
|
|
379
|
-
try {
|
|
380
|
-
documentMode = clone(document).documentMode ? document.documentMode : {};
|
|
381
|
-
} catch (_) {}
|
|
382
|
-
|
|
383
|
-
var hooks = {};
|
|
384
363
|
/**
|
|
385
364
|
* Expose whether this browser supports running the full DOMPurify.
|
|
386
365
|
*/
|
|
366
|
+
DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
|
|
367
|
+
const {
|
|
368
|
+
MUSTACHE_EXPR,
|
|
369
|
+
ERB_EXPR,
|
|
370
|
+
TMPLIT_EXPR,
|
|
371
|
+
DATA_ATTR,
|
|
372
|
+
ARIA_ATTR,
|
|
373
|
+
IS_SCRIPT_OR_DATA,
|
|
374
|
+
ATTR_WHITESPACE,
|
|
375
|
+
CUSTOM_ELEMENT
|
|
376
|
+
} = EXPRESSIONS;
|
|
377
|
+
let {
|
|
378
|
+
IS_ALLOWED_URI: IS_ALLOWED_URI$1
|
|
379
|
+
} = EXPRESSIONS;
|
|
387
380
|
|
|
388
|
-
DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9;
|
|
389
|
-
var MUSTACHE_EXPR$1 = MUSTACHE_EXPR,
|
|
390
|
-
ERB_EXPR$1 = ERB_EXPR,
|
|
391
|
-
DATA_ATTR$1 = DATA_ATTR,
|
|
392
|
-
ARIA_ATTR$1 = ARIA_ATTR,
|
|
393
|
-
IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA,
|
|
394
|
-
ATTR_WHITESPACE$1 = ATTR_WHITESPACE;
|
|
395
|
-
var IS_ALLOWED_URI$1 = IS_ALLOWED_URI;
|
|
396
381
|
/**
|
|
397
382
|
* We consider the elements and attributes below to be safe. Ideally
|
|
398
383
|
* don't add any new ones but feel free to remove unwanted ones.
|
|
399
384
|
*/
|
|
400
385
|
|
|
401
386
|
/* allowed element names */
|
|
387
|
+
let ALLOWED_TAGS = null;
|
|
388
|
+
const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
|
|
402
389
|
|
|
403
|
-
var ALLOWED_TAGS = null;
|
|
404
|
-
var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text)));
|
|
405
390
|
/* Allowed attribute names */
|
|
391
|
+
let ALLOWED_ATTR = null;
|
|
392
|
+
const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
|
|
406
393
|
|
|
407
|
-
var ALLOWED_ATTR = null;
|
|
408
|
-
var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml)));
|
|
409
394
|
/*
|
|
410
395
|
* Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
|
|
411
396
|
* @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
|
|
412
397
|
* @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
|
|
413
398
|
* @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
|
|
414
399
|
*/
|
|
415
|
-
|
|
416
|
-
var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
|
|
400
|
+
let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
|
|
417
401
|
tagNameCheck: {
|
|
418
402
|
writable: true,
|
|
419
403
|
configurable: false,
|
|
@@ -433,359 +417,381 @@ sap.ui.define([], function () { 'use strict';
|
|
|
433
417
|
value: false
|
|
434
418
|
}
|
|
435
419
|
}));
|
|
420
|
+
|
|
436
421
|
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
|
|
422
|
+
let FORBID_TAGS = null;
|
|
437
423
|
|
|
438
|
-
var FORBID_TAGS = null;
|
|
439
424
|
/* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
|
|
425
|
+
let FORBID_ATTR = null;
|
|
440
426
|
|
|
441
|
-
var FORBID_ATTR = null;
|
|
442
427
|
/* Decide if ARIA attributes are okay */
|
|
428
|
+
let ALLOW_ARIA_ATTR = true;
|
|
443
429
|
|
|
444
|
-
var ALLOW_ARIA_ATTR = true;
|
|
445
430
|
/* Decide if custom data attributes are okay */
|
|
431
|
+
let ALLOW_DATA_ATTR = true;
|
|
446
432
|
|
|
447
|
-
var ALLOW_DATA_ATTR = true;
|
|
448
433
|
/* Decide if unknown protocols are okay */
|
|
434
|
+
let ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
435
|
+
|
|
436
|
+
/* Decide if self-closing tags in attributes are allowed.
|
|
437
|
+
* Usually removed due to a mXSS issue in jQuery 3.0 */
|
|
438
|
+
let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
|
449
439
|
|
|
450
|
-
var ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
451
440
|
/* Output should be safe for common template engines.
|
|
452
441
|
* This means, DOMPurify removes data attributes, mustaches and ERB
|
|
453
442
|
*/
|
|
443
|
+
let SAFE_FOR_TEMPLATES = false;
|
|
444
|
+
|
|
445
|
+
/* Output should be safe even for XML used within HTML and alike.
|
|
446
|
+
* This means, DOMPurify removes comments when containing risky content.
|
|
447
|
+
*/
|
|
448
|
+
let SAFE_FOR_XML = true;
|
|
454
449
|
|
|
455
|
-
var SAFE_FOR_TEMPLATES = false;
|
|
456
450
|
/* Decide if document with <html>... should be returned */
|
|
451
|
+
let WHOLE_DOCUMENT = false;
|
|
457
452
|
|
|
458
|
-
var WHOLE_DOCUMENT = false;
|
|
459
453
|
/* Track whether config is already set on this instance of DOMPurify. */
|
|
454
|
+
let SET_CONFIG = false;
|
|
460
455
|
|
|
461
|
-
var SET_CONFIG = false;
|
|
462
456
|
/* Decide if all elements (e.g. style, script) must be children of
|
|
463
457
|
* document.body. By default, browsers might move them to document.head */
|
|
458
|
+
let FORCE_BODY = false;
|
|
464
459
|
|
|
465
|
-
var FORCE_BODY = false;
|
|
466
460
|
/* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
|
|
467
461
|
* string (or a TrustedHTML object if Trusted Types are supported).
|
|
468
462
|
* If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
|
|
469
463
|
*/
|
|
464
|
+
let RETURN_DOM = false;
|
|
470
465
|
|
|
471
|
-
var RETURN_DOM = false;
|
|
472
466
|
/* Decide if a DOM `DocumentFragment` should be returned, instead of a html
|
|
473
467
|
* string (or a TrustedHTML object if Trusted Types are supported) */
|
|
468
|
+
let RETURN_DOM_FRAGMENT = false;
|
|
474
469
|
|
|
475
|
-
var RETURN_DOM_FRAGMENT = false;
|
|
476
470
|
/* Try to return a Trusted Type object instead of a string, return a string in
|
|
477
471
|
* case Trusted Types are not supported */
|
|
472
|
+
let RETURN_TRUSTED_TYPE = false;
|
|
478
473
|
|
|
479
|
-
|
|
480
|
-
|
|
474
|
+
/* Output should be free from DOM clobbering attacks?
|
|
475
|
+
* This sanitizes markups named with colliding, clobberable built-in DOM APIs.
|
|
476
|
+
*/
|
|
477
|
+
let SANITIZE_DOM = true;
|
|
478
|
+
|
|
479
|
+
/* Achieve full DOM Clobbering protection by isolating the namespace of named
|
|
480
|
+
* properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
|
|
481
|
+
*
|
|
482
|
+
* HTML/DOM spec rules that enable DOM Clobbering:
|
|
483
|
+
* - Named Access on Window (�7.3.3)
|
|
484
|
+
* - DOM Tree Accessors (�3.1.5)
|
|
485
|
+
* - Form Element Parent-Child Relations (�4.10.3)
|
|
486
|
+
* - Iframe srcdoc / Nested WindowProxies (�4.8.5)
|
|
487
|
+
* - HTMLCollection (�4.2.10.2)
|
|
488
|
+
*
|
|
489
|
+
* Namespace isolation is implemented by prefixing `id` and `name` attributes
|
|
490
|
+
* with a constant string, i.e., `user-content-`
|
|
491
|
+
*/
|
|
492
|
+
let SANITIZE_NAMED_PROPS = false;
|
|
493
|
+
const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
|
|
481
494
|
|
|
482
|
-
var SANITIZE_DOM = true;
|
|
483
495
|
/* Keep element content when removing element? */
|
|
496
|
+
let KEEP_CONTENT = true;
|
|
484
497
|
|
|
485
|
-
var KEEP_CONTENT = true;
|
|
486
498
|
/* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
|
|
487
499
|
* of importing it into a new Document and returning a sanitized copy */
|
|
500
|
+
let IN_PLACE = false;
|
|
488
501
|
|
|
489
|
-
var IN_PLACE = false;
|
|
490
502
|
/* Allow usage of profiles like html, svg and mathMl */
|
|
503
|
+
let USE_PROFILES = {};
|
|
491
504
|
|
|
492
|
-
var USE_PROFILES = {};
|
|
493
505
|
/* Tags to ignore content of when KEEP_CONTENT is true */
|
|
506
|
+
let FORBID_CONTENTS = null;
|
|
507
|
+
const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
|
|
494
508
|
|
|
495
|
-
var FORBID_CONTENTS = null;
|
|
496
|
-
var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
|
|
497
509
|
/* Tags that are safe for data: URIs */
|
|
510
|
+
let DATA_URI_TAGS = null;
|
|
511
|
+
const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
|
|
498
512
|
|
|
499
|
-
var DATA_URI_TAGS = null;
|
|
500
|
-
var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
|
|
501
513
|
/* Attributes safe for values like "javascript:" */
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
514
|
+
let URI_SAFE_ATTRIBUTES = null;
|
|
515
|
+
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
|
|
516
|
+
const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
|
|
517
|
+
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
518
|
+
const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
508
519
|
/* Document namespace */
|
|
520
|
+
let NAMESPACE = HTML_NAMESPACE;
|
|
521
|
+
let IS_EMPTY_INPUT = false;
|
|
522
|
+
|
|
523
|
+
/* Allowed XHTML+XML namespaces */
|
|
524
|
+
let ALLOWED_NAMESPACES = null;
|
|
525
|
+
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
|
|
509
526
|
|
|
510
|
-
var NAMESPACE = HTML_NAMESPACE;
|
|
511
|
-
var IS_EMPTY_INPUT = false;
|
|
512
527
|
/* Parsing of strict XHTML documents */
|
|
528
|
+
let PARSER_MEDIA_TYPE = null;
|
|
529
|
+
const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
|
|
530
|
+
const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
|
|
531
|
+
let transformCaseFunc = null;
|
|
513
532
|
|
|
514
|
-
var PARSER_MEDIA_TYPE;
|
|
515
|
-
var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
|
|
516
|
-
var DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
|
|
517
|
-
var transformCaseFunc;
|
|
518
533
|
/* Keep a reference to config to pass to hooks */
|
|
534
|
+
let CONFIG = null;
|
|
519
535
|
|
|
520
|
-
var CONFIG = null;
|
|
521
536
|
/* Ideally, do not touch anything below this line */
|
|
522
|
-
|
|
523
537
|
/* ______________________________________________ */
|
|
524
538
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
var isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
539
|
+
const formElement = document.createElement('form');
|
|
540
|
+
const isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
528
541
|
return testValue instanceof RegExp || testValue instanceof Function;
|
|
529
542
|
};
|
|
543
|
+
|
|
530
544
|
/**
|
|
531
545
|
* _parseConfig
|
|
532
546
|
*
|
|
533
547
|
* @param {Object} cfg optional config literal
|
|
534
548
|
*/
|
|
535
549
|
// eslint-disable-next-line complexity
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
var _parseConfig = function _parseConfig(cfg) {
|
|
550
|
+
const _parseConfig = function _parseConfig() {
|
|
551
|
+
let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
539
552
|
if (CONFIG && CONFIG === cfg) {
|
|
540
553
|
return;
|
|
541
554
|
}
|
|
542
|
-
/* Shield configuration object from tampering */
|
|
543
555
|
|
|
544
|
-
|
|
545
|
-
if (!cfg ||
|
|
556
|
+
/* Shield configuration object from tampering */
|
|
557
|
+
if (!cfg || typeof cfg !== 'object') {
|
|
546
558
|
cfg = {};
|
|
547
559
|
}
|
|
548
|
-
/* Shield configuration object from prototype pollution */
|
|
549
|
-
|
|
550
560
|
|
|
561
|
+
/* Shield configuration object from prototype pollution */
|
|
551
562
|
cfg = clone(cfg);
|
|
552
|
-
PARSER_MEDIA_TYPE =
|
|
553
|
-
|
|
563
|
+
PARSER_MEDIA_TYPE =
|
|
564
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
565
|
+
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
|
|
554
566
|
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
} : stringToLowerCase;
|
|
558
|
-
/* Set configuration parameters */
|
|
567
|
+
// HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
568
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
|
|
559
569
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
cfg.
|
|
570
|
+
/* Set configuration parameters */
|
|
571
|
+
ALLOWED_TAGS = objectHasOwnProperty(cfg, 'ALLOWED_TAGS') ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
572
|
+
ALLOWED_ATTR = objectHasOwnProperty(cfg, 'ALLOWED_ATTR') ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
573
|
+
ALLOWED_NAMESPACES = objectHasOwnProperty(cfg, 'ALLOWED_NAMESPACES') ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
|
574
|
+
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),
|
|
575
|
+
// eslint-disable-line indent
|
|
576
|
+
cfg.ADD_URI_SAFE_ATTR,
|
|
577
|
+
// eslint-disable-line indent
|
|
564
578
|
transformCaseFunc // eslint-disable-line indent
|
|
565
579
|
) // eslint-disable-line indent
|
|
566
580
|
: DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
567
|
-
DATA_URI_TAGS = 'ADD_DATA_URI_TAGS'
|
|
568
|
-
|
|
581
|
+
DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS),
|
|
582
|
+
// eslint-disable-line indent
|
|
583
|
+
cfg.ADD_DATA_URI_TAGS,
|
|
584
|
+
// eslint-disable-line indent
|
|
569
585
|
transformCaseFunc // eslint-disable-line indent
|
|
570
586
|
) // eslint-disable-line indent
|
|
571
587
|
: DEFAULT_DATA_URI_TAGS;
|
|
572
|
-
FORBID_CONTENTS = 'FORBID_CONTENTS'
|
|
573
|
-
FORBID_TAGS = 'FORBID_TAGS'
|
|
574
|
-
FORBID_ATTR = 'FORBID_ATTR'
|
|
575
|
-
USE_PROFILES = 'USE_PROFILES'
|
|
588
|
+
FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
589
|
+
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
|
590
|
+
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
|
591
|
+
USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
|
|
576
592
|
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
577
|
-
|
|
578
593
|
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
|
579
|
-
|
|
580
594
|
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
|
|
581
|
-
|
|
595
|
+
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
|
|
582
596
|
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
|
|
583
|
-
|
|
597
|
+
SAFE_FOR_XML = cfg.SAFE_FOR_XML !== false; // Default true
|
|
584
598
|
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
|
|
585
|
-
|
|
586
599
|
RETURN_DOM = cfg.RETURN_DOM || false; // Default false
|
|
587
|
-
|
|
588
600
|
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
|
|
589
|
-
|
|
590
601
|
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
|
|
591
|
-
|
|
592
602
|
FORCE_BODY = cfg.FORCE_BODY || false; // Default false
|
|
593
|
-
|
|
594
603
|
SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
|
|
595
|
-
|
|
604
|
+
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
|
|
596
605
|
KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
|
|
597
|
-
|
|
598
606
|
IN_PLACE = cfg.IN_PLACE || false; // Default false
|
|
599
|
-
|
|
600
|
-
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1;
|
|
607
|
+
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
|
|
601
608
|
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
602
|
-
|
|
609
|
+
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
|
|
603
610
|
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
|
|
604
611
|
CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
|
605
612
|
}
|
|
606
|
-
|
|
607
613
|
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
|
|
608
614
|
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
|
|
609
615
|
}
|
|
610
|
-
|
|
611
616
|
if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
|
|
612
617
|
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
|
|
613
618
|
}
|
|
614
|
-
|
|
615
619
|
if (SAFE_FOR_TEMPLATES) {
|
|
616
620
|
ALLOW_DATA_ATTR = false;
|
|
617
621
|
}
|
|
618
|
-
|
|
619
622
|
if (RETURN_DOM_FRAGMENT) {
|
|
620
623
|
RETURN_DOM = true;
|
|
621
624
|
}
|
|
622
|
-
/* Parse profile info */
|
|
623
|
-
|
|
624
625
|
|
|
626
|
+
/* Parse profile info */
|
|
625
627
|
if (USE_PROFILES) {
|
|
626
|
-
ALLOWED_TAGS = addToSet({},
|
|
628
|
+
ALLOWED_TAGS = addToSet({}, text);
|
|
627
629
|
ALLOWED_ATTR = [];
|
|
628
|
-
|
|
629
630
|
if (USE_PROFILES.html === true) {
|
|
630
631
|
addToSet(ALLOWED_TAGS, html$1);
|
|
631
632
|
addToSet(ALLOWED_ATTR, html);
|
|
632
633
|
}
|
|
633
|
-
|
|
634
634
|
if (USE_PROFILES.svg === true) {
|
|
635
635
|
addToSet(ALLOWED_TAGS, svg$1);
|
|
636
636
|
addToSet(ALLOWED_ATTR, svg);
|
|
637
637
|
addToSet(ALLOWED_ATTR, xml);
|
|
638
638
|
}
|
|
639
|
-
|
|
640
639
|
if (USE_PROFILES.svgFilters === true) {
|
|
641
640
|
addToSet(ALLOWED_TAGS, svgFilters);
|
|
642
641
|
addToSet(ALLOWED_ATTR, svg);
|
|
643
642
|
addToSet(ALLOWED_ATTR, xml);
|
|
644
643
|
}
|
|
645
|
-
|
|
646
644
|
if (USE_PROFILES.mathMl === true) {
|
|
647
645
|
addToSet(ALLOWED_TAGS, mathMl$1);
|
|
648
646
|
addToSet(ALLOWED_ATTR, mathMl);
|
|
649
647
|
addToSet(ALLOWED_ATTR, xml);
|
|
650
648
|
}
|
|
651
649
|
}
|
|
652
|
-
/* Merge configuration parameters */
|
|
653
|
-
|
|
654
650
|
|
|
651
|
+
/* Merge configuration parameters */
|
|
655
652
|
if (cfg.ADD_TAGS) {
|
|
656
653
|
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
657
654
|
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
658
655
|
}
|
|
659
|
-
|
|
660
656
|
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
661
657
|
}
|
|
662
|
-
|
|
663
658
|
if (cfg.ADD_ATTR) {
|
|
664
659
|
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
665
660
|
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
666
661
|
}
|
|
667
|
-
|
|
668
662
|
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
669
663
|
}
|
|
670
|
-
|
|
671
664
|
if (cfg.ADD_URI_SAFE_ATTR) {
|
|
672
665
|
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
673
666
|
}
|
|
674
|
-
|
|
675
667
|
if (cfg.FORBID_CONTENTS) {
|
|
676
668
|
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
677
669
|
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
678
670
|
}
|
|
679
|
-
|
|
680
671
|
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
681
672
|
}
|
|
682
|
-
/* Add #text in case KEEP_CONTENT is set to true */
|
|
683
|
-
|
|
684
673
|
|
|
674
|
+
/* Add #text in case KEEP_CONTENT is set to true */
|
|
685
675
|
if (KEEP_CONTENT) {
|
|
686
676
|
ALLOWED_TAGS['#text'] = true;
|
|
687
677
|
}
|
|
688
|
-
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
|
|
689
|
-
|
|
690
678
|
|
|
679
|
+
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
|
|
691
680
|
if (WHOLE_DOCUMENT) {
|
|
692
681
|
addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
|
|
693
682
|
}
|
|
694
|
-
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
|
|
695
|
-
|
|
696
683
|
|
|
684
|
+
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
|
|
697
685
|
if (ALLOWED_TAGS.table) {
|
|
698
686
|
addToSet(ALLOWED_TAGS, ['tbody']);
|
|
699
687
|
delete FORBID_TAGS.tbody;
|
|
700
|
-
}
|
|
701
|
-
|
|
688
|
+
}
|
|
689
|
+
if (cfg.TRUSTED_TYPES_POLICY) {
|
|
690
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
|
|
691
|
+
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
|
|
692
|
+
}
|
|
693
|
+
if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
|
|
694
|
+
throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
// Overwrite existing TrustedTypes policy.
|
|
698
|
+
trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
|
|
699
|
+
|
|
700
|
+
// Sign local variables required by `sanitize`.
|
|
701
|
+
emptyHTML = trustedTypesPolicy.createHTML('');
|
|
702
|
+
} else {
|
|
703
|
+
// Uninitialized policy, attempt to initialize the internal dompurify policy.
|
|
704
|
+
if (trustedTypesPolicy === undefined) {
|
|
705
|
+
trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
|
|
706
|
+
}
|
|
702
707
|
|
|
708
|
+
// If creating the internal policy succeeded sign internal variables.
|
|
709
|
+
if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
|
|
710
|
+
emptyHTML = trustedTypesPolicy.createHTML('');
|
|
711
|
+
}
|
|
712
|
+
}
|
|
703
713
|
|
|
714
|
+
// Prevent further manipulation of configuration.
|
|
715
|
+
// Not available in IE8, Safari 5, etc.
|
|
704
716
|
if (freeze) {
|
|
705
717
|
freeze(cfg);
|
|
706
718
|
}
|
|
707
|
-
|
|
708
719
|
CONFIG = cfg;
|
|
709
720
|
};
|
|
721
|
+
const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
|
|
722
|
+
const HTML_INTEGRATION_POINTS = addToSet({}, ['annotation-xml']);
|
|
710
723
|
|
|
711
|
-
|
|
712
|
-
var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML
|
|
724
|
+
// Certain elements are allowed in both SVG and HTML
|
|
713
725
|
// namespace. We need to specify them explicitly
|
|
714
726
|
// so that they don't get erroneously deleted from
|
|
715
727
|
// HTML namespace.
|
|
728
|
+
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
|
|
716
729
|
|
|
717
|
-
var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
|
|
718
730
|
/* Keep track of all possible SVG and MathML tags
|
|
719
731
|
* so that we can perform the namespace checks
|
|
720
732
|
* correctly. */
|
|
733
|
+
const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
|
|
734
|
+
const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
|
|
721
735
|
|
|
722
|
-
var ALL_SVG_TAGS = addToSet({}, svg$1);
|
|
723
|
-
addToSet(ALL_SVG_TAGS, svgFilters);
|
|
724
|
-
addToSet(ALL_SVG_TAGS, svgDisallowed);
|
|
725
|
-
var ALL_MATHML_TAGS = addToSet({}, mathMl$1);
|
|
726
|
-
addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
|
|
727
736
|
/**
|
|
728
|
-
*
|
|
729
|
-
*
|
|
730
737
|
* @param {Element} element a DOM element whose namespace is being checked
|
|
731
738
|
* @returns {boolean} Return false if the element has a
|
|
732
739
|
* namespace that a spec-compliant parser would never
|
|
733
740
|
* return. Return true otherwise.
|
|
734
741
|
*/
|
|
742
|
+
const _checkValidNamespace = function _checkValidNamespace(element) {
|
|
743
|
+
let parent = getParentNode(element);
|
|
735
744
|
|
|
736
|
-
|
|
737
|
-
var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode
|
|
745
|
+
// In JSDOM, if we're inside shadow DOM, then parentNode
|
|
738
746
|
// can be null. We just simulate parent in this case.
|
|
739
|
-
|
|
740
747
|
if (!parent || !parent.tagName) {
|
|
741
748
|
parent = {
|
|
742
|
-
namespaceURI:
|
|
749
|
+
namespaceURI: NAMESPACE,
|
|
743
750
|
tagName: 'template'
|
|
744
751
|
};
|
|
745
752
|
}
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
753
|
+
const tagName = stringToLowerCase(element.tagName);
|
|
754
|
+
const parentTagName = stringToLowerCase(parent.tagName);
|
|
755
|
+
if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
756
|
+
return false;
|
|
757
|
+
}
|
|
750
758
|
if (element.namespaceURI === SVG_NAMESPACE) {
|
|
751
759
|
// The only way to switch from HTML namespace to SVG
|
|
752
760
|
// is via <svg>. If it happens via any other tag, then
|
|
753
761
|
// it should be killed.
|
|
754
762
|
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
755
763
|
return tagName === 'svg';
|
|
756
|
-
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
// The only way to switch from MathML to SVG is via`
|
|
757
767
|
// svg if parent is either <annotation-xml> or MathML
|
|
758
768
|
// text integration points.
|
|
759
|
-
|
|
760
|
-
|
|
761
769
|
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
|
762
770
|
return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
763
|
-
}
|
|
764
|
-
// spec. All others are disallowed in SVG namespace.
|
|
765
|
-
|
|
771
|
+
}
|
|
766
772
|
|
|
773
|
+
// We only allow elements that are defined in SVG
|
|
774
|
+
// spec. All others are disallowed in SVG namespace.
|
|
767
775
|
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
768
776
|
}
|
|
769
|
-
|
|
770
777
|
if (element.namespaceURI === MATHML_NAMESPACE) {
|
|
771
778
|
// The only way to switch from HTML namespace to MathML
|
|
772
779
|
// is via <math>. If it happens via any other tag, then
|
|
773
780
|
// it should be killed.
|
|
774
781
|
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
775
782
|
return tagName === 'math';
|
|
776
|
-
}
|
|
777
|
-
// <math> and HTML integration points
|
|
778
|
-
|
|
783
|
+
}
|
|
779
784
|
|
|
785
|
+
// The only way to switch from SVG to MathML is via
|
|
786
|
+
// <math> and HTML integration points
|
|
780
787
|
if (parent.namespaceURI === SVG_NAMESPACE) {
|
|
781
788
|
return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
|
|
782
|
-
}
|
|
783
|
-
// spec. All others are disallowed in MathML namespace.
|
|
784
|
-
|
|
789
|
+
}
|
|
785
790
|
|
|
791
|
+
// We only allow elements that are defined in MathML
|
|
792
|
+
// spec. All others are disallowed in MathML namespace.
|
|
786
793
|
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
787
794
|
}
|
|
788
|
-
|
|
789
795
|
if (element.namespaceURI === HTML_NAMESPACE) {
|
|
790
796
|
// The only way to switch from SVG to HTML is via
|
|
791
797
|
// HTML integration points, and from MathML to HTML
|
|
@@ -793,53 +799,51 @@ sap.ui.define([], function () { 'use strict';
|
|
|
793
799
|
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
|
|
794
800
|
return false;
|
|
795
801
|
}
|
|
796
|
-
|
|
797
802
|
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
798
803
|
return false;
|
|
799
|
-
}
|
|
800
|
-
// or SVG and should never appear in HTML namespace
|
|
801
|
-
|
|
804
|
+
}
|
|
802
805
|
|
|
806
|
+
// We disallow tags that are specific for MathML
|
|
807
|
+
// or SVG and should never appear in HTML namespace
|
|
803
808
|
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
804
|
-
}
|
|
805
|
-
// that the element somehow got namespace that is not
|
|
806
|
-
// HTML, SVG or MathML). Return false just in case.
|
|
809
|
+
}
|
|
807
810
|
|
|
811
|
+
// For XHTML and XML documents that support custom namespaces
|
|
812
|
+
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
813
|
+
return true;
|
|
814
|
+
}
|
|
808
815
|
|
|
816
|
+
// The code should never reach this place (this means
|
|
817
|
+
// that the element somehow got namespace that is not
|
|
818
|
+
// HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
|
|
819
|
+
// Return false just in case.
|
|
809
820
|
return false;
|
|
810
821
|
};
|
|
822
|
+
|
|
811
823
|
/**
|
|
812
824
|
* _forceRemove
|
|
813
825
|
*
|
|
814
826
|
* @param {Node} node a DOM node
|
|
815
827
|
*/
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
var _forceRemove = function _forceRemove(node) {
|
|
828
|
+
const _forceRemove = function _forceRemove(node) {
|
|
819
829
|
arrayPush(DOMPurify.removed, {
|
|
820
830
|
element: node
|
|
821
831
|
});
|
|
822
|
-
|
|
823
832
|
try {
|
|
824
833
|
// eslint-disable-next-line unicorn/prefer-dom-node-remove
|
|
825
|
-
node.
|
|
834
|
+
getParentNode(node).removeChild(node);
|
|
826
835
|
} catch (_) {
|
|
827
|
-
|
|
828
|
-
node.outerHTML = emptyHTML;
|
|
829
|
-
} catch (_) {
|
|
830
|
-
node.remove();
|
|
831
|
-
}
|
|
836
|
+
remove(node);
|
|
832
837
|
}
|
|
833
838
|
};
|
|
839
|
+
|
|
834
840
|
/**
|
|
835
841
|
* _removeAttribute
|
|
836
842
|
*
|
|
837
843
|
* @param {String} name an Attribute name
|
|
838
844
|
* @param {Node} node a DOM node
|
|
839
845
|
*/
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
var _removeAttribute = function _removeAttribute(name, node) {
|
|
846
|
+
const _removeAttribute = function _removeAttribute(name, node) {
|
|
843
847
|
try {
|
|
844
848
|
arrayPush(DOMPurify.removed, {
|
|
845
849
|
attribute: node.getAttributeNode(name),
|
|
@@ -851,9 +855,9 @@ sap.ui.define([], function () { 'use strict';
|
|
|
851
855
|
from: node
|
|
852
856
|
});
|
|
853
857
|
}
|
|
858
|
+
node.removeAttribute(name);
|
|
854
859
|
|
|
855
|
-
|
|
856
|
-
|
|
860
|
+
// We void attribute values for unremovable "is"" attributes
|
|
857
861
|
if (name === 'is' && !ALLOWED_ATTR[name]) {
|
|
858
862
|
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
|
859
863
|
try {
|
|
@@ -866,103 +870,92 @@ sap.ui.define([], function () { 'use strict';
|
|
|
866
870
|
}
|
|
867
871
|
}
|
|
868
872
|
};
|
|
873
|
+
|
|
869
874
|
/**
|
|
870
875
|
* _initDocument
|
|
871
876
|
*
|
|
872
877
|
* @param {String} dirty a string of dirty markup
|
|
873
878
|
* @return {Document} a DOM, filled with the dirty markup
|
|
874
879
|
*/
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
var _initDocument = function _initDocument(dirty) {
|
|
880
|
+
const _initDocument = function _initDocument(dirty) {
|
|
878
881
|
/* Create a HTML document */
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
+
let doc = null;
|
|
883
|
+
let leadingWhitespace = null;
|
|
882
884
|
if (FORCE_BODY) {
|
|
883
885
|
dirty = '<remove></remove>' + dirty;
|
|
884
886
|
} else {
|
|
885
887
|
/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
|
|
886
|
-
|
|
888
|
+
const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
887
889
|
leadingWhitespace = matches && matches[0];
|
|
888
890
|
}
|
|
889
|
-
|
|
890
|
-
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') {
|
|
891
|
+
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
|
|
891
892
|
// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
|
|
892
893
|
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
|
|
893
894
|
}
|
|
894
|
-
|
|
895
|
-
var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
895
|
+
const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
896
896
|
/*
|
|
897
897
|
* Use the DOMParser API by default, fallback later if needs be
|
|
898
898
|
* DOMParser not work for svg when has multiple root element.
|
|
899
899
|
*/
|
|
900
|
-
|
|
901
900
|
if (NAMESPACE === HTML_NAMESPACE) {
|
|
902
901
|
try {
|
|
903
902
|
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
904
903
|
} catch (_) {}
|
|
905
904
|
}
|
|
906
|
-
/* Use createHTMLDocument in case DOMParser is not available */
|
|
907
|
-
|
|
908
905
|
|
|
906
|
+
/* Use createHTMLDocument in case DOMParser is not available */
|
|
909
907
|
if (!doc || !doc.documentElement) {
|
|
910
908
|
doc = implementation.createDocument(NAMESPACE, 'template', null);
|
|
911
|
-
|
|
912
909
|
try {
|
|
913
|
-
doc.documentElement.innerHTML = IS_EMPTY_INPUT ?
|
|
914
|
-
} catch (_) {
|
|
910
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
|
911
|
+
} catch (_) {
|
|
912
|
+
// Syntax error if dirtyPayload is invalid xml
|
|
915
913
|
}
|
|
916
914
|
}
|
|
917
|
-
|
|
918
|
-
var body = doc.body || doc.documentElement;
|
|
919
|
-
|
|
915
|
+
const body = doc.body || doc.documentElement;
|
|
920
916
|
if (dirty && leadingWhitespace) {
|
|
921
917
|
body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
922
918
|
}
|
|
923
|
-
/* Work on whole document or just its body */
|
|
924
|
-
|
|
925
919
|
|
|
920
|
+
/* Work on whole document or just its body */
|
|
926
921
|
if (NAMESPACE === HTML_NAMESPACE) {
|
|
927
922
|
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
|
|
928
923
|
}
|
|
929
|
-
|
|
930
924
|
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
931
925
|
};
|
|
926
|
+
|
|
932
927
|
/**
|
|
933
|
-
*
|
|
928
|
+
* Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
|
|
934
929
|
*
|
|
935
|
-
* @param {
|
|
936
|
-
* @return {
|
|
930
|
+
* @param {Node} root The root element or node to start traversing on.
|
|
931
|
+
* @return {NodeIterator} The created NodeIterator
|
|
937
932
|
*/
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);
|
|
933
|
+
const _createNodeIterator = function _createNodeIterator(root) {
|
|
934
|
+
return createNodeIterator.call(root.ownerDocument || root, root,
|
|
935
|
+
// eslint-disable-next-line no-bitwise
|
|
936
|
+
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT | NodeFilter.SHOW_PROCESSING_INSTRUCTION | NodeFilter.SHOW_CDATA_SECTION, null);
|
|
943
937
|
};
|
|
938
|
+
|
|
944
939
|
/**
|
|
945
940
|
* _isClobbered
|
|
946
941
|
*
|
|
947
942
|
* @param {Node} elm element to check for clobbering attacks
|
|
948
943
|
* @return {Boolean} true if clobbered, false if safe
|
|
949
944
|
*/
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
var _isClobbered = function _isClobbered(elm) {
|
|
953
|
-
return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function');
|
|
945
|
+
const _isClobbered = function _isClobbered(elm) {
|
|
946
|
+
return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
|
|
954
947
|
};
|
|
948
|
+
|
|
955
949
|
/**
|
|
956
|
-
*
|
|
950
|
+
* Checks whether the given object is a DOM node.
|
|
957
951
|
*
|
|
958
|
-
* @param {Node}
|
|
952
|
+
* @param {Node} object object to check whether it's a DOM node
|
|
959
953
|
* @return {Boolean} true is object is a DOM node
|
|
960
954
|
*/
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
var _isNode = function _isNode(object) {
|
|
964
|
-
return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';
|
|
955
|
+
const _isNode = function _isNode(object) {
|
|
956
|
+
return typeof Node === 'function' && object instanceof Node;
|
|
965
957
|
};
|
|
958
|
+
|
|
966
959
|
/**
|
|
967
960
|
* _executeHook
|
|
968
961
|
* Execute user configurable hooks
|
|
@@ -971,17 +964,15 @@ sap.ui.define([], function () { 'use strict';
|
|
|
971
964
|
* @param {Node} currentNode node to work on with the hook
|
|
972
965
|
* @param {Object} data additional hook parameters
|
|
973
966
|
*/
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
var _executeHook = function _executeHook(entryPoint, currentNode, data) {
|
|
967
|
+
const _executeHook = function _executeHook(entryPoint, currentNode, data) {
|
|
977
968
|
if (!hooks[entryPoint]) {
|
|
978
969
|
return;
|
|
979
970
|
}
|
|
980
|
-
|
|
981
|
-
arrayForEach(hooks[entryPoint], function (hook) {
|
|
971
|
+
arrayForEach(hooks[entryPoint], hook => {
|
|
982
972
|
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
983
973
|
});
|
|
984
974
|
};
|
|
975
|
+
|
|
985
976
|
/**
|
|
986
977
|
* _sanitizeElements
|
|
987
978
|
*
|
|
@@ -992,107 +983,93 @@ sap.ui.define([], function () { 'use strict';
|
|
|
992
983
|
* @param {Node} currentNode to check for permission to exist
|
|
993
984
|
* @return {Boolean} true if node was killed, false if left alive
|
|
994
985
|
*/
|
|
986
|
+
const _sanitizeElements = function _sanitizeElements(currentNode) {
|
|
987
|
+
let content = null;
|
|
995
988
|
|
|
996
|
-
|
|
997
|
-
var _sanitizeElements = function _sanitizeElements(currentNode) {
|
|
998
|
-
var content;
|
|
999
989
|
/* Execute a hook if present */
|
|
1000
|
-
|
|
1001
990
|
_executeHook('beforeSanitizeElements', currentNode, null);
|
|
1002
|
-
/* Check if element is clobbered or can clobber */
|
|
1003
|
-
|
|
1004
991
|
|
|
992
|
+
/* Check if element is clobbered or can clobber */
|
|
1005
993
|
if (_isClobbered(currentNode)) {
|
|
1006
994
|
_forceRemove(currentNode);
|
|
1007
|
-
|
|
1008
995
|
return true;
|
|
1009
996
|
}
|
|
1010
|
-
/* Check if tagname contains Unicode */
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) {
|
|
1014
|
-
_forceRemove(currentNode);
|
|
1015
997
|
|
|
1016
|
-
return true;
|
|
1017
|
-
}
|
|
1018
998
|
/* Now let's check the element's type and name */
|
|
999
|
+
const tagName = transformCaseFunc(currentNode.nodeName);
|
|
1019
1000
|
|
|
1020
|
-
|
|
1021
|
-
var tagName = transformCaseFunc(currentNode.nodeName);
|
|
1022
1001
|
/* Execute a hook if present */
|
|
1023
|
-
|
|
1024
1002
|
_executeHook('uponSanitizeElement', currentNode, {
|
|
1025
|
-
tagName
|
|
1003
|
+
tagName,
|
|
1026
1004
|
allowedTags: ALLOWED_TAGS
|
|
1027
1005
|
});
|
|
1028
|
-
/* Detect mXSS attempts abusing namespace confusion */
|
|
1029
|
-
|
|
1030
1006
|
|
|
1031
|
-
|
|
1007
|
+
/* Detect mXSS attempts abusing namespace confusion */
|
|
1008
|
+
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
|
|
1032
1009
|
_forceRemove(currentNode);
|
|
1033
|
-
|
|
1034
1010
|
return true;
|
|
1035
1011
|
}
|
|
1036
|
-
/* Mitigate a problem with templates inside select */
|
|
1037
1012
|
|
|
1038
|
-
|
|
1039
|
-
if (
|
|
1013
|
+
/* Remove any occurrence of processing instructions */
|
|
1014
|
+
if (currentNode.nodeType === NODE_TYPE.progressingInstruction) {
|
|
1040
1015
|
_forceRemove(currentNode);
|
|
1041
|
-
|
|
1042
1016
|
return true;
|
|
1043
1017
|
}
|
|
1044
|
-
/* Remove element if anything forbids its presence */
|
|
1045
1018
|
|
|
1019
|
+
/* Remove any kind of possibly harmful comments */
|
|
1020
|
+
if (SAFE_FOR_XML && currentNode.nodeType === NODE_TYPE.comment && regExpTest(/<[/\w]/g, currentNode.data)) {
|
|
1021
|
+
_forceRemove(currentNode);
|
|
1022
|
+
return true;
|
|
1023
|
+
}
|
|
1046
1024
|
|
|
1025
|
+
/* Remove element if anything forbids its presence */
|
|
1047
1026
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
1048
1027
|
/* Check if we have a custom element to handle */
|
|
1049
|
-
if (!FORBID_TAGS[tagName] &&
|
|
1050
|
-
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName))
|
|
1051
|
-
|
|
1028
|
+
if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
|
|
1029
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
|
|
1030
|
+
return false;
|
|
1031
|
+
}
|
|
1032
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
|
|
1033
|
+
return false;
|
|
1034
|
+
}
|
|
1052
1035
|
}
|
|
1053
|
-
/* Keep content except for bad-listed elements */
|
|
1054
|
-
|
|
1055
1036
|
|
|
1037
|
+
/* Keep content except for bad-listed elements */
|
|
1056
1038
|
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1039
|
+
const parentNode = getParentNode(currentNode) || currentNode.parentNode;
|
|
1040
|
+
const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
|
1060
1041
|
if (childNodes && parentNode) {
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1042
|
+
const childCount = childNodes.length;
|
|
1043
|
+
for (let i = childCount - 1; i >= 0; --i) {
|
|
1044
|
+
const childClone = cloneNode(childNodes[i], true);
|
|
1045
|
+
childClone.__removalCount = (currentNode.__removalCount || 0) + 1;
|
|
1046
|
+
parentNode.insertBefore(childClone, getNextSibling(currentNode));
|
|
1065
1047
|
}
|
|
1066
1048
|
}
|
|
1067
1049
|
}
|
|
1068
|
-
|
|
1069
1050
|
_forceRemove(currentNode);
|
|
1070
|
-
|
|
1071
1051
|
return true;
|
|
1072
1052
|
}
|
|
1073
|
-
/* Check whether element has a valid namespace */
|
|
1074
|
-
|
|
1075
1053
|
|
|
1054
|
+
/* Check whether element has a valid namespace */
|
|
1076
1055
|
if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
|
|
1077
1056
|
_forceRemove(currentNode);
|
|
1078
|
-
|
|
1079
1057
|
return true;
|
|
1080
1058
|
}
|
|
1081
1059
|
|
|
1082
|
-
|
|
1060
|
+
/* Make sure that older browsers don't get fallback-tag mXSS */
|
|
1061
|
+
if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
|
|
1083
1062
|
_forceRemove(currentNode);
|
|
1084
|
-
|
|
1085
1063
|
return true;
|
|
1086
1064
|
}
|
|
1087
|
-
/* Sanitize element content to be template-safe */
|
|
1088
|
-
|
|
1089
1065
|
|
|
1090
|
-
|
|
1066
|
+
/* Sanitize element content to be template-safe */
|
|
1067
|
+
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === NODE_TYPE.text) {
|
|
1091
1068
|
/* Get the element's text content */
|
|
1092
1069
|
content = currentNode.textContent;
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1070
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
1071
|
+
content = stringReplace(content, expr, ' ');
|
|
1072
|
+
});
|
|
1096
1073
|
if (currentNode.textContent !== content) {
|
|
1097
1074
|
arrayPush(DOMPurify.removed, {
|
|
1098
1075
|
element: currentNode.cloneNode()
|
|
@@ -1100,13 +1077,12 @@ sap.ui.define([], function () { 'use strict';
|
|
|
1100
1077
|
currentNode.textContent = content;
|
|
1101
1078
|
}
|
|
1102
1079
|
}
|
|
1103
|
-
/* Execute a hook if present */
|
|
1104
|
-
|
|
1105
1080
|
|
|
1081
|
+
/* Execute a hook if present */
|
|
1106
1082
|
_executeHook('afterSanitizeElements', currentNode, null);
|
|
1107
|
-
|
|
1108
1083
|
return false;
|
|
1109
1084
|
};
|
|
1085
|
+
|
|
1110
1086
|
/**
|
|
1111
1087
|
* _isValidAttribute
|
|
1112
1088
|
*
|
|
@@ -1116,47 +1092,46 @@ sap.ui.define([], function () { 'use strict';
|
|
|
1116
1092
|
* @return {Boolean} Returns true if `value` is valid, otherwise false.
|
|
1117
1093
|
*/
|
|
1118
1094
|
// eslint-disable-next-line complexity
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
var _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
1095
|
+
const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
1122
1096
|
/* Make sure attribute cannot clobber */
|
|
1123
1097
|
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
|
1124
1098
|
return false;
|
|
1125
1099
|
}
|
|
1100
|
+
|
|
1126
1101
|
/* Allow valid data-* attributes: At least one character after "-"
|
|
1127
1102
|
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
|
1128
1103
|
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
|
1129
1104
|
We don't need to check the value; it's always URI safe. */
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
1105
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
|
1106
|
+
if (
|
|
1107
|
+
// First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
1134
1108
|
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1135
1109
|
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
1136
|
-
|
|
1110
|
+
_isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
|
|
1111
|
+
// Alternative, second condition checks if it's an `is`-attribute, AND
|
|
1137
1112
|
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
1138
1113
|
lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
|
|
1139
1114
|
return false;
|
|
1140
1115
|
}
|
|
1141
1116
|
/* Check value is safe. First, is attr inert? If so, is safe */
|
|
1142
|
-
|
|
1143
|
-
} else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE$1, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA$1, stringReplace(value, ATTR_WHITESPACE$1, ''))) ; else if (!value) ; else {
|
|
1117
|
+
} else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
|
|
1144
1118
|
return false;
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1119
|
+
} else ;
|
|
1147
1120
|
return true;
|
|
1148
1121
|
};
|
|
1122
|
+
|
|
1149
1123
|
/**
|
|
1150
|
-
*
|
|
1124
|
+
* _isBasicCustomElement
|
|
1151
1125
|
* checks if at least one dash is included in tagName, and it's not the first char
|
|
1152
1126
|
* for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
|
|
1127
|
+
*
|
|
1153
1128
|
* @param {string} tagName name of the tag of the node to sanitize
|
|
1129
|
+
* @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
|
|
1154
1130
|
*/
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
var _basicCustomElementTest = function _basicCustomElementTest(tagName) {
|
|
1158
|
-
return tagName.indexOf('-') > 0;
|
|
1131
|
+
const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
|
|
1132
|
+
return tagName !== 'annotation-xml' && stringMatch(tagName, CUSTOM_ELEMENT);
|
|
1159
1133
|
};
|
|
1134
|
+
|
|
1160
1135
|
/**
|
|
1161
1136
|
* _sanitizeAttributes
|
|
1162
1137
|
*
|
|
@@ -1167,91 +1142,112 @@ sap.ui.define([], function () { 'use strict';
|
|
|
1167
1142
|
*
|
|
1168
1143
|
* @param {Node} currentNode to sanitize
|
|
1169
1144
|
*/
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
var _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
1173
|
-
var attr;
|
|
1174
|
-
var value;
|
|
1175
|
-
var lcName;
|
|
1176
|
-
var l;
|
|
1145
|
+
const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
1177
1146
|
/* Execute a hook if present */
|
|
1178
|
-
|
|
1179
1147
|
_executeHook('beforeSanitizeAttributes', currentNode, null);
|
|
1148
|
+
const {
|
|
1149
|
+
attributes
|
|
1150
|
+
} = currentNode;
|
|
1180
1151
|
|
|
1181
|
-
var attributes = currentNode.attributes;
|
|
1182
1152
|
/* Check if we have attributes; if not we might have a text node */
|
|
1183
|
-
|
|
1184
1153
|
if (!attributes) {
|
|
1185
1154
|
return;
|
|
1186
1155
|
}
|
|
1187
|
-
|
|
1188
|
-
var hookEvent = {
|
|
1156
|
+
const hookEvent = {
|
|
1189
1157
|
attrName: '',
|
|
1190
1158
|
attrValue: '',
|
|
1191
1159
|
keepAttr: true,
|
|
1192
1160
|
allowedAttributes: ALLOWED_ATTR
|
|
1193
1161
|
};
|
|
1194
|
-
l = attributes.length;
|
|
1195
|
-
/* Go backwards over all attributes; safely remove bad ones */
|
|
1162
|
+
let l = attributes.length;
|
|
1196
1163
|
|
|
1164
|
+
/* Go backwards over all attributes; safely remove bad ones */
|
|
1197
1165
|
while (l--) {
|
|
1198
|
-
attr = attributes[l];
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1166
|
+
const attr = attributes[l];
|
|
1167
|
+
const {
|
|
1168
|
+
name,
|
|
1169
|
+
namespaceURI,
|
|
1170
|
+
value: attrValue
|
|
1171
|
+
} = attr;
|
|
1172
|
+
const lcName = transformCaseFunc(name);
|
|
1173
|
+
let value = name === 'value' ? attrValue : stringTrim(attrValue);
|
|
1205
1174
|
|
|
1175
|
+
/* Execute a hook if present */
|
|
1206
1176
|
hookEvent.attrName = lcName;
|
|
1207
1177
|
hookEvent.attrValue = value;
|
|
1208
1178
|
hookEvent.keepAttr = true;
|
|
1209
1179
|
hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
|
|
1210
|
-
|
|
1211
1180
|
_executeHook('uponSanitizeAttribute', currentNode, hookEvent);
|
|
1212
|
-
|
|
1213
1181
|
value = hookEvent.attrValue;
|
|
1214
|
-
/* Did the hooks approve of the attribute? */
|
|
1215
1182
|
|
|
1183
|
+
/* Did the hooks approve of the attribute? */
|
|
1216
1184
|
if (hookEvent.forceKeepAttr) {
|
|
1217
1185
|
continue;
|
|
1218
1186
|
}
|
|
1219
|
-
/* Remove attribute */
|
|
1220
|
-
|
|
1221
1187
|
|
|
1188
|
+
/* Remove attribute */
|
|
1222
1189
|
_removeAttribute(name, currentNode);
|
|
1223
|
-
/* Did the hooks approve of the attribute? */
|
|
1224
|
-
|
|
1225
1190
|
|
|
1191
|
+
/* Did the hooks approve of the attribute? */
|
|
1226
1192
|
if (!hookEvent.keepAttr) {
|
|
1227
1193
|
continue;
|
|
1228
1194
|
}
|
|
1229
|
-
/* Work around a security issue in jQuery 3.0 */
|
|
1230
|
-
|
|
1231
1195
|
|
|
1232
|
-
|
|
1196
|
+
/* Work around a security issue in jQuery 3.0 */
|
|
1197
|
+
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
|
|
1233
1198
|
_removeAttribute(name, currentNode);
|
|
1234
|
-
|
|
1235
1199
|
continue;
|
|
1236
1200
|
}
|
|
1237
|
-
/* Sanitize attribute content to be template-safe */
|
|
1238
|
-
|
|
1239
1201
|
|
|
1202
|
+
/* Sanitize attribute content to be template-safe */
|
|
1240
1203
|
if (SAFE_FOR_TEMPLATES) {
|
|
1241
|
-
|
|
1242
|
-
|
|
1204
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
1205
|
+
value = stringReplace(value, expr, ' ');
|
|
1206
|
+
});
|
|
1243
1207
|
}
|
|
1208
|
+
|
|
1244
1209
|
/* Is `value` valid for this attribute? */
|
|
1210
|
+
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
1211
|
+
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
1212
|
+
continue;
|
|
1213
|
+
}
|
|
1245
1214
|
|
|
1215
|
+
/* Full DOM Clobbering protection via namespace isolation,
|
|
1216
|
+
* Prefix id and name attributes with `user-content-`
|
|
1217
|
+
*/
|
|
1218
|
+
if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
|
|
1219
|
+
// Remove the attribute with this value
|
|
1220
|
+
_removeAttribute(name, currentNode);
|
|
1246
1221
|
|
|
1247
|
-
|
|
1222
|
+
// Prefix the value and later re-create the attribute with the sanitized value
|
|
1223
|
+
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
1224
|
+
}
|
|
1248
1225
|
|
|
1249
|
-
|
|
1226
|
+
/* Work around a security issue with comments inside attributes */
|
|
1227
|
+
if (SAFE_FOR_XML && regExpTest(/((--!?|])>)|<\/(style|title)/i, value)) {
|
|
1228
|
+
_removeAttribute(name, currentNode);
|
|
1250
1229
|
continue;
|
|
1251
1230
|
}
|
|
1252
|
-
/* Handle invalid data-* attribute set by try-catching it */
|
|
1253
1231
|
|
|
1232
|
+
/* Handle attributes that require Trusted Types */
|
|
1233
|
+
if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
|
|
1234
|
+
if (namespaceURI) ; else {
|
|
1235
|
+
switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
1236
|
+
case 'TrustedHTML':
|
|
1237
|
+
{
|
|
1238
|
+
value = trustedTypesPolicy.createHTML(value);
|
|
1239
|
+
break;
|
|
1240
|
+
}
|
|
1241
|
+
case 'TrustedScriptURL':
|
|
1242
|
+
{
|
|
1243
|
+
value = trustedTypesPolicy.createScriptURL(value);
|
|
1244
|
+
break;
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1254
1249
|
|
|
1250
|
+
/* Handle invalid data-* attribute set by try-catching it */
|
|
1255
1251
|
try {
|
|
1256
1252
|
if (namespaceURI) {
|
|
1257
1253
|
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
@@ -1259,133 +1255,106 @@ sap.ui.define([], function () { 'use strict';
|
|
|
1259
1255
|
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
1260
1256
|
currentNode.setAttribute(name, value);
|
|
1261
1257
|
}
|
|
1262
|
-
|
|
1263
|
-
|
|
1258
|
+
if (_isClobbered(currentNode)) {
|
|
1259
|
+
_forceRemove(currentNode);
|
|
1260
|
+
} else {
|
|
1261
|
+
arrayPop(DOMPurify.removed);
|
|
1262
|
+
}
|
|
1264
1263
|
} catch (_) {}
|
|
1265
1264
|
}
|
|
1266
|
-
/* Execute a hook if present */
|
|
1267
|
-
|
|
1268
1265
|
|
|
1266
|
+
/* Execute a hook if present */
|
|
1269
1267
|
_executeHook('afterSanitizeAttributes', currentNode, null);
|
|
1270
1268
|
};
|
|
1269
|
+
|
|
1271
1270
|
/**
|
|
1272
1271
|
* _sanitizeShadowDOM
|
|
1273
1272
|
*
|
|
1274
1273
|
* @param {DocumentFragment} fragment to iterate over recursively
|
|
1275
1274
|
*/
|
|
1275
|
+
const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
|
|
1276
|
+
let shadowNode = null;
|
|
1277
|
+
const shadowIterator = _createNodeIterator(fragment);
|
|
1276
1278
|
|
|
1277
|
-
|
|
1278
|
-
var _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
|
|
1279
|
-
var shadowNode;
|
|
1280
|
-
|
|
1281
|
-
var shadowIterator = _createIterator(fragment);
|
|
1282
1279
|
/* Execute a hook if present */
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
1280
|
_executeHook('beforeSanitizeShadowDOM', fragment, null);
|
|
1286
|
-
|
|
1287
1281
|
while (shadowNode = shadowIterator.nextNode()) {
|
|
1288
1282
|
/* Execute a hook if present */
|
|
1289
1283
|
_executeHook('uponSanitizeShadowNode', shadowNode, null);
|
|
1290
|
-
/* Sanitize tags and elements */
|
|
1291
|
-
|
|
1292
1284
|
|
|
1285
|
+
/* Sanitize tags and elements */
|
|
1293
1286
|
if (_sanitizeElements(shadowNode)) {
|
|
1294
1287
|
continue;
|
|
1295
1288
|
}
|
|
1296
|
-
/* Deep shadow DOM detected */
|
|
1297
|
-
|
|
1298
1289
|
|
|
1290
|
+
/* Deep shadow DOM detected */
|
|
1299
1291
|
if (shadowNode.content instanceof DocumentFragment) {
|
|
1300
1292
|
_sanitizeShadowDOM(shadowNode.content);
|
|
1301
1293
|
}
|
|
1302
|
-
/* Check attributes, sanitize if necessary */
|
|
1303
|
-
|
|
1304
1294
|
|
|
1295
|
+
/* Check attributes, sanitize if necessary */
|
|
1305
1296
|
_sanitizeAttributes(shadowNode);
|
|
1306
1297
|
}
|
|
1307
|
-
/* Execute a hook if present */
|
|
1308
|
-
|
|
1309
1298
|
|
|
1299
|
+
/* Execute a hook if present */
|
|
1310
1300
|
_executeHook('afterSanitizeShadowDOM', fragment, null);
|
|
1311
1301
|
};
|
|
1302
|
+
|
|
1312
1303
|
/**
|
|
1313
1304
|
* Sanitize
|
|
1314
1305
|
* Public method providing core sanitation functionality
|
|
1315
1306
|
*
|
|
1316
1307
|
* @param {String|Node} dirty string or DOM node
|
|
1317
|
-
* @param {Object}
|
|
1308
|
+
* @param {Object} cfg object
|
|
1318
1309
|
*/
|
|
1319
1310
|
// eslint-disable-next-line complexity
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
var oldNode;
|
|
1327
|
-
var returnNode;
|
|
1311
|
+
DOMPurify.sanitize = function (dirty) {
|
|
1312
|
+
let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1313
|
+
let body = null;
|
|
1314
|
+
let importedNode = null;
|
|
1315
|
+
let currentNode = null;
|
|
1316
|
+
let returnNode = null;
|
|
1328
1317
|
/* Make sure we have a string to sanitize.
|
|
1329
1318
|
DO NOT return early, as this will return the wrong type if
|
|
1330
1319
|
the user has requested a DOM object rather than a string */
|
|
1331
|
-
|
|
1332
1320
|
IS_EMPTY_INPUT = !dirty;
|
|
1333
|
-
|
|
1334
1321
|
if (IS_EMPTY_INPUT) {
|
|
1335
1322
|
dirty = '<!-->';
|
|
1336
1323
|
}
|
|
1337
|
-
/* Stringify, in case dirty is an object */
|
|
1338
|
-
|
|
1339
1324
|
|
|
1325
|
+
/* Stringify, in case dirty is an object */
|
|
1340
1326
|
if (typeof dirty !== 'string' && !_isNode(dirty)) {
|
|
1341
|
-
|
|
1342
|
-
if (typeof dirty.toString !== 'function') {
|
|
1343
|
-
throw typeErrorCreate('toString is not a function');
|
|
1344
|
-
} else {
|
|
1327
|
+
if (typeof dirty.toString === 'function') {
|
|
1345
1328
|
dirty = dirty.toString();
|
|
1346
|
-
|
|
1347
1329
|
if (typeof dirty !== 'string') {
|
|
1348
1330
|
throw typeErrorCreate('dirty is not a string, aborting');
|
|
1349
1331
|
}
|
|
1332
|
+
} else {
|
|
1333
|
+
throw typeErrorCreate('toString is not a function');
|
|
1350
1334
|
}
|
|
1351
1335
|
}
|
|
1352
|
-
/* Check we can run. Otherwise fall back or ignore */
|
|
1353
|
-
|
|
1354
1336
|
|
|
1337
|
+
/* Return dirty HTML if DOMPurify cannot run */
|
|
1355
1338
|
if (!DOMPurify.isSupported) {
|
|
1356
|
-
if (_typeof(window.toStaticHTML) === 'object' || typeof window.toStaticHTML === 'function') {
|
|
1357
|
-
if (typeof dirty === 'string') {
|
|
1358
|
-
return window.toStaticHTML(dirty);
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
if (_isNode(dirty)) {
|
|
1362
|
-
return window.toStaticHTML(dirty.outerHTML);
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
1339
|
return dirty;
|
|
1367
1340
|
}
|
|
1368
|
-
/* Assign config vars */
|
|
1369
|
-
|
|
1370
1341
|
|
|
1342
|
+
/* Assign config vars */
|
|
1371
1343
|
if (!SET_CONFIG) {
|
|
1372
1344
|
_parseConfig(cfg);
|
|
1373
1345
|
}
|
|
1374
|
-
/* Clean up removed elements */
|
|
1375
|
-
|
|
1376
1346
|
|
|
1347
|
+
/* Clean up removed elements */
|
|
1377
1348
|
DOMPurify.removed = [];
|
|
1378
|
-
/* Check if dirty is correctly typed for IN_PLACE */
|
|
1379
1349
|
|
|
1350
|
+
/* Check if dirty is correctly typed for IN_PLACE */
|
|
1380
1351
|
if (typeof dirty === 'string') {
|
|
1381
1352
|
IN_PLACE = false;
|
|
1382
1353
|
}
|
|
1383
|
-
|
|
1384
1354
|
if (IN_PLACE) {
|
|
1385
1355
|
/* Do some early pre-sanitization to avoid unsafe root nodes */
|
|
1386
1356
|
if (dirty.nodeName) {
|
|
1387
|
-
|
|
1388
|
-
|
|
1357
|
+
const tagName = transformCaseFunc(dirty.nodeName);
|
|
1389
1358
|
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
1390
1359
|
throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
|
|
1391
1360
|
}
|
|
@@ -1395,8 +1364,7 @@ sap.ui.define([], function () { 'use strict';
|
|
|
1395
1364
|
elements being stripped by the parser */
|
|
1396
1365
|
body = _initDocument('<!---->');
|
|
1397
1366
|
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
1398
|
-
|
|
1399
|
-
if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
|
|
1367
|
+
if (importedNode.nodeType === NODE_TYPE.element && importedNode.nodeName === 'BODY') {
|
|
1400
1368
|
/* Node is already a body, use as is */
|
|
1401
1369
|
body = importedNode;
|
|
1402
1370
|
} else if (importedNode.nodeName === 'HTML') {
|
|
@@ -1407,71 +1375,54 @@ sap.ui.define([], function () { 'use strict';
|
|
|
1407
1375
|
}
|
|
1408
1376
|
} else {
|
|
1409
1377
|
/* Exit directly if we have nothing to do */
|
|
1410
|
-
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
|
|
1378
|
+
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
|
|
1379
|
+
// eslint-disable-next-line unicorn/prefer-includes
|
|
1411
1380
|
dirty.indexOf('<') === -1) {
|
|
1412
1381
|
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
1413
1382
|
}
|
|
1414
|
-
/* Initialize the document to work on */
|
|
1415
|
-
|
|
1416
1383
|
|
|
1384
|
+
/* Initialize the document to work on */
|
|
1417
1385
|
body = _initDocument(dirty);
|
|
1418
|
-
/* Check we have a DOM node from the data */
|
|
1419
1386
|
|
|
1387
|
+
/* Check we have a DOM node from the data */
|
|
1420
1388
|
if (!body) {
|
|
1421
1389
|
return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
|
|
1422
1390
|
}
|
|
1423
1391
|
}
|
|
1424
|
-
/* Remove first element node (ours) if FORCE_BODY is set */
|
|
1425
|
-
|
|
1426
1392
|
|
|
1393
|
+
/* Remove first element node (ours) if FORCE_BODY is set */
|
|
1427
1394
|
if (body && FORCE_BODY) {
|
|
1428
1395
|
_forceRemove(body.firstChild);
|
|
1429
1396
|
}
|
|
1430
|
-
/* Get node iterator */
|
|
1431
1397
|
|
|
1398
|
+
/* Get node iterator */
|
|
1399
|
+
const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
|
|
1432
1400
|
|
|
1433
|
-
var nodeIterator = _createIterator(IN_PLACE ? dirty : body);
|
|
1434
1401
|
/* Now start iterating over the created document */
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
1402
|
while (currentNode = nodeIterator.nextNode()) {
|
|
1438
|
-
/* Fix IE's strange behavior with manipulated textNodes #89 */
|
|
1439
|
-
if (currentNode.nodeType === 3 && currentNode === oldNode) {
|
|
1440
|
-
continue;
|
|
1441
|
-
}
|
|
1442
1403
|
/* Sanitize tags and elements */
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
1404
|
if (_sanitizeElements(currentNode)) {
|
|
1446
1405
|
continue;
|
|
1447
1406
|
}
|
|
1448
|
-
/* Shadow DOM detected, sanitize it */
|
|
1449
|
-
|
|
1450
1407
|
|
|
1408
|
+
/* Shadow DOM detected, sanitize it */
|
|
1451
1409
|
if (currentNode.content instanceof DocumentFragment) {
|
|
1452
1410
|
_sanitizeShadowDOM(currentNode.content);
|
|
1453
1411
|
}
|
|
1454
|
-
/* Check attributes, sanitize if necessary */
|
|
1455
|
-
|
|
1456
1412
|
|
|
1413
|
+
/* Check attributes, sanitize if necessary */
|
|
1457
1414
|
_sanitizeAttributes(currentNode);
|
|
1458
|
-
|
|
1459
|
-
oldNode = currentNode;
|
|
1460
1415
|
}
|
|
1461
1416
|
|
|
1462
|
-
oldNode = null;
|
|
1463
1417
|
/* If we sanitized `dirty` in-place, return it. */
|
|
1464
|
-
|
|
1465
1418
|
if (IN_PLACE) {
|
|
1466
1419
|
return dirty;
|
|
1467
1420
|
}
|
|
1468
|
-
/* Return sanitized string or DOM */
|
|
1469
|
-
|
|
1470
1421
|
|
|
1422
|
+
/* Return sanitized string or DOM */
|
|
1471
1423
|
if (RETURN_DOM) {
|
|
1472
1424
|
if (RETURN_DOM_FRAGMENT) {
|
|
1473
1425
|
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
1474
|
-
|
|
1475
1426
|
while (body.firstChild) {
|
|
1476
1427
|
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
1477
1428
|
returnNode.appendChild(body.firstChild);
|
|
@@ -1479,8 +1430,7 @@ sap.ui.define([], function () { 'use strict';
|
|
|
1479
1430
|
} else {
|
|
1480
1431
|
returnNode = body;
|
|
1481
1432
|
}
|
|
1482
|
-
|
|
1483
|
-
if (ALLOWED_ATTR.shadowroot) {
|
|
1433
|
+
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
|
|
1484
1434
|
/*
|
|
1485
1435
|
AdoptNode() is not used because internal state is not reset
|
|
1486
1436
|
(e.g. the past names map of a HTMLFormElement), this is safe
|
|
@@ -1490,72 +1440,66 @@ sap.ui.define([], function () { 'use strict';
|
|
|
1490
1440
|
*/
|
|
1491
1441
|
returnNode = importNode.call(originalDocument, returnNode, true);
|
|
1492
1442
|
}
|
|
1493
|
-
|
|
1494
1443
|
return returnNode;
|
|
1495
1444
|
}
|
|
1445
|
+
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
1496
1446
|
|
|
1497
|
-
var serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
1498
1447
|
/* Serialize doctype if allowed */
|
|
1499
|
-
|
|
1500
1448
|
if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
|
|
1501
1449
|
serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
|
|
1502
1450
|
}
|
|
1503
|
-
/* Sanitize final string template-safe */
|
|
1504
|
-
|
|
1505
1451
|
|
|
1452
|
+
/* Sanitize final string template-safe */
|
|
1506
1453
|
if (SAFE_FOR_TEMPLATES) {
|
|
1507
|
-
|
|
1508
|
-
|
|
1454
|
+
arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
|
|
1455
|
+
serializedHTML = stringReplace(serializedHTML, expr, ' ');
|
|
1456
|
+
});
|
|
1509
1457
|
}
|
|
1510
|
-
|
|
1511
1458
|
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
|
1512
1459
|
};
|
|
1460
|
+
|
|
1513
1461
|
/**
|
|
1514
1462
|
* Public method to set the configuration once
|
|
1515
1463
|
* setConfig
|
|
1516
1464
|
*
|
|
1517
1465
|
* @param {Object} cfg configuration object
|
|
1518
1466
|
*/
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
DOMPurify.setConfig = function (cfg) {
|
|
1467
|
+
DOMPurify.setConfig = function () {
|
|
1468
|
+
let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1522
1469
|
_parseConfig(cfg);
|
|
1523
|
-
|
|
1524
1470
|
SET_CONFIG = true;
|
|
1525
1471
|
};
|
|
1472
|
+
|
|
1526
1473
|
/**
|
|
1527
1474
|
* Public method to remove the configuration
|
|
1528
1475
|
* clearConfig
|
|
1529
1476
|
*
|
|
1530
1477
|
*/
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
1478
|
DOMPurify.clearConfig = function () {
|
|
1534
1479
|
CONFIG = null;
|
|
1535
1480
|
SET_CONFIG = false;
|
|
1536
1481
|
};
|
|
1482
|
+
|
|
1537
1483
|
/**
|
|
1538
1484
|
* Public method to check if an attribute value is valid.
|
|
1539
1485
|
* Uses last set config, if any. Otherwise, uses config defaults.
|
|
1540
1486
|
* isValidAttribute
|
|
1541
1487
|
*
|
|
1542
|
-
* @param {
|
|
1543
|
-
* @param {
|
|
1544
|
-
* @param {
|
|
1488
|
+
* @param {String} tag Tag name of containing element.
|
|
1489
|
+
* @param {String} attr Attribute name.
|
|
1490
|
+
* @param {String} value Attribute value.
|
|
1545
1491
|
* @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
|
|
1546
1492
|
*/
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
1493
|
DOMPurify.isValidAttribute = function (tag, attr, value) {
|
|
1550
1494
|
/* Initialize shared config vars if necessary. */
|
|
1551
1495
|
if (!CONFIG) {
|
|
1552
1496
|
_parseConfig({});
|
|
1553
1497
|
}
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
var lcName = transformCaseFunc(attr);
|
|
1498
|
+
const lcTag = transformCaseFunc(tag);
|
|
1499
|
+
const lcName = transformCaseFunc(attr);
|
|
1557
1500
|
return _isValidAttribute(lcTag, lcName, value);
|
|
1558
1501
|
};
|
|
1502
|
+
|
|
1559
1503
|
/**
|
|
1560
1504
|
* AddHook
|
|
1561
1505
|
* Public method to add DOMPurify hooks
|
|
@@ -1563,16 +1507,14 @@ sap.ui.define([], function () { 'use strict';
|
|
|
1563
1507
|
* @param {String} entryPoint entry point for the hook to add
|
|
1564
1508
|
* @param {Function} hookFunction function to execute
|
|
1565
1509
|
*/
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
1510
|
DOMPurify.addHook = function (entryPoint, hookFunction) {
|
|
1569
1511
|
if (typeof hookFunction !== 'function') {
|
|
1570
1512
|
return;
|
|
1571
1513
|
}
|
|
1572
|
-
|
|
1573
1514
|
hooks[entryPoint] = hooks[entryPoint] || [];
|
|
1574
1515
|
arrayPush(hooks[entryPoint], hookFunction);
|
|
1575
1516
|
};
|
|
1517
|
+
|
|
1576
1518
|
/**
|
|
1577
1519
|
* RemoveHook
|
|
1578
1520
|
* Public method to remove a DOMPurify hook at a given entryPoint
|
|
@@ -1581,40 +1523,33 @@ sap.ui.define([], function () { 'use strict';
|
|
|
1581
1523
|
* @param {String} entryPoint entry point for the hook to remove
|
|
1582
1524
|
* @return {Function} removed(popped) hook
|
|
1583
1525
|
*/
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
1526
|
DOMPurify.removeHook = function (entryPoint) {
|
|
1587
1527
|
if (hooks[entryPoint]) {
|
|
1588
1528
|
return arrayPop(hooks[entryPoint]);
|
|
1589
1529
|
}
|
|
1590
1530
|
};
|
|
1531
|
+
|
|
1591
1532
|
/**
|
|
1592
1533
|
* RemoveHooks
|
|
1593
1534
|
* Public method to remove all DOMPurify hooks at a given entryPoint
|
|
1594
1535
|
*
|
|
1595
1536
|
* @param {String} entryPoint entry point for the hooks to remove
|
|
1596
1537
|
*/
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
1538
|
DOMPurify.removeHooks = function (entryPoint) {
|
|
1600
1539
|
if (hooks[entryPoint]) {
|
|
1601
1540
|
hooks[entryPoint] = [];
|
|
1602
1541
|
}
|
|
1603
1542
|
};
|
|
1543
|
+
|
|
1604
1544
|
/**
|
|
1605
1545
|
* RemoveAllHooks
|
|
1606
1546
|
* Public method to remove all DOMPurify hooks
|
|
1607
|
-
*
|
|
1608
1547
|
*/
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
1548
|
DOMPurify.removeAllHooks = function () {
|
|
1612
1549
|
hooks = {};
|
|
1613
1550
|
};
|
|
1614
|
-
|
|
1615
1551
|
return DOMPurify;
|
|
1616
1552
|
}
|
|
1617
|
-
|
|
1618
1553
|
var purify = createDOMPurify();
|
|
1619
1554
|
|
|
1620
1555
|
return purify;
|