diff --git a/packages/ckeditor5-coremedia-richtext/src/rules/XLink.ts b/packages/ckeditor5-coremedia-richtext/src/rules/XLink.ts index 4fa5efac4..e041d33d2 100644 --- a/packages/ckeditor5-coremedia-richtext/src/rules/XLink.ts +++ b/packages/ckeditor5-coremedia-richtext/src/rules/XLink.ts @@ -72,7 +72,7 @@ export const extractXLinkDataSetEntries = (element: HTMLElement): XLinkAttribute * * ```typescript * setXLinkAttributes(element, { - * // empty: Ignored by default. + * // empty: Ignored, if allowEmpty=false * "title": "", * "href": "https://example.org/" * }); @@ -80,9 +80,9 @@ export const extractXLinkDataSetEntries = (element: HTMLElement): XLinkAttribute * * @param element - the elemant to set the attributes at * @param attributes - the key-value pairs of attributes to set - * @param allowEmpty - if to ignore entries with empty values or not + * @param allowEmpty - if to ignore entries with empty values or not; default: `true` */ -export const setXLinkAttributes = (element: Element, attributes: XLinkAttributes, allowEmpty = false): void => { +export const setXLinkAttributes = (element: Element, attributes: XLinkAttributes, allowEmpty = true): void => { const { ownerDocument } = element; Object.entries(attributes).forEach(([key, value]: [XLinkAttributeKey, string | undefined]) => { if (typeof value === "string" && (value || allowEmpty)) { @@ -110,7 +110,7 @@ export const setXLinkAttributes = (element: Element, attributes: XLinkAttributes * * ```typescript * setXLinkDataSetEntries(element, { - * // empty: Ignored by default. + * // empty: Ignored, if allowEmpty=false * "title": "", * "href": "https://example.org/" * }); @@ -118,9 +118,9 @@ export const setXLinkAttributes = (element: Element, attributes: XLinkAttributes * * @param element - the elemant to set the attributes at * @param attributes - the key-value pairs of attributes to set - * @param allowEmpty - if to ignore entries with empty values or not + * @param allowEmpty - if to ignore entries with empty values or not; default: `true` */ -export const setXLinkDataSetEntries = (element: HTMLElement, attributes: XLinkAttributes, allowEmpty = false): void => { +export const setXLinkDataSetEntries = (element: HTMLElement, attributes: XLinkAttributes, allowEmpty = true): void => { Object.entries(attributes).forEach(([localName, value]: [XLinkAttributeKey, string | undefined]) => { if (typeof value === "string" && (value || allowEmpty)) { const key: XLinkAttributeDataSetKey = `${xLinkPrefix}${capitalize(localName)}`;