From d4bc7d3f396b6a490fd93187040760013cff3e16 Mon Sep 17 00:00:00 2001 From: Matthijs Bon Date: Mon, 11 Oct 2021 10:05:47 +0200 Subject: [PATCH 1/4] Update typeDefs for Attribution and Control For consistency with docs, update type for labels to {string|HTMLElement} --- src/ol/control/Attribution.js | 2 +- src/ol/control/FullScreen.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ol/control/Attribution.js b/src/ol/control/Attribution.js index 1ab49c7d36..b10b366259 100644 --- a/src/ol/control/Attribution.js +++ b/src/ol/control/Attribution.js @@ -20,7 +20,7 @@ import {removeChildren, replaceNode} from '../dom.js'; * @property {boolean} [collapsed=true] Specify if attributions should * be collapsed at startup. * @property {string} [tipLabel='Attributions'] Text label to use for the button tip. - * @property {string} [label='i'] Text label to use for the + * @property {string|HTMLElement} [label='i'] Text label to use for the * collapsed attributions button. * Instead of text, also an element (e.g. a `span` element) can be used. * @property {string} [expandClassName=className + '-expand'] CSS class name for the diff --git a/src/ol/control/FullScreen.js b/src/ol/control/FullScreen.js index 37e733f463..0875736a20 100644 --- a/src/ol/control/FullScreen.js +++ b/src/ol/control/FullScreen.js @@ -44,7 +44,7 @@ const FullScreenEventType = { /** * @typedef {Object} Options * @property {string} [className='ol-full-screen'] CSS class name. - * @property {string|Text} [label='\u2922'] Text label to use for the button. + * @property {string|HTMLElement} [label='\u2922'] Text label to use for the button. * Instead of text, also an element (e.g. a `span` element) can be used. * @property {string|Text} [labelActive='\u00d7'] Text label to use for the * button when full-screen is active. @@ -133,7 +133,7 @@ class FullScreen extends Control { /** * @private - * @type {Text} + * @type {Text|HTMLElement} */ this.labelNode_ = typeof label === 'string' ? document.createTextNode(label) : label; From 6bc8d0cd96bacfc13e7f712b38aeda60ea36e442 Mon Sep 17 00:00:00 2001 From: Matthijs Bon Date: Mon, 11 Oct 2021 10:11:44 +0200 Subject: [PATCH 2/4] Fix typeDef for label Allow string, Text and HTMLElement, instead of only string and HTMLElement --- src/ol/control/FullScreen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ol/control/FullScreen.js b/src/ol/control/FullScreen.js index 0875736a20..df8c22f72d 100644 --- a/src/ol/control/FullScreen.js +++ b/src/ol/control/FullScreen.js @@ -44,7 +44,7 @@ const FullScreenEventType = { /** * @typedef {Object} Options * @property {string} [className='ol-full-screen'] CSS class name. - * @property {string|HTMLElement} [label='\u2922'] Text label to use for the button. + * @property {string|Text|HTMLElement} [label='\u2922'] Text label to use for the button. * Instead of text, also an element (e.g. a `span` element) can be used. * @property {string|Text} [labelActive='\u00d7'] Text label to use for the * button when full-screen is active. From 4cbf04d029c3c478313c1ce3613523475c473b4c Mon Sep 17 00:00:00 2001 From: Matthijs Bon Date: Mon, 11 Oct 2021 14:48:04 +0200 Subject: [PATCH 3/4] Update typeDefs for Fullscreen Options Remove line stating that a 'span' is also a valid inactiveClassName value. --- src/ol/control/FullScreen.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ol/control/FullScreen.js b/src/ol/control/FullScreen.js index df8c22f72d..ee76f15be7 100644 --- a/src/ol/control/FullScreen.js +++ b/src/ol/control/FullScreen.js @@ -52,7 +52,6 @@ const FullScreenEventType = { * when full-screen is active. * @property {string} [inactiveClassName=className + '-false'] CSS class name for the button * when full-screen is inactive. - * Instead of text, also an element (e.g. a `span` element) can be used. * @property {string} [tipLabel='Toggle full-screen'] Text label to use for the button tip. * @property {boolean} [keys=false] Full keyboard access. * @property {HTMLElement|string} [target] Specify a target if you want the From 72cb135aff564c36bb7bc7277a9481a77af4b607 Mon Sep 17 00:00:00 2001 From: Matthijs Bon Date: Tue, 12 Oct 2021 11:29:35 +0200 Subject: [PATCH 4/4] Update typeDefs for labelActive Add description that 'span' element can be used and add HTMLElement as type --- src/ol/control/FullScreen.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ol/control/FullScreen.js b/src/ol/control/FullScreen.js index ee76f15be7..3c21dcd079 100644 --- a/src/ol/control/FullScreen.js +++ b/src/ol/control/FullScreen.js @@ -46,8 +46,9 @@ const FullScreenEventType = { * @property {string} [className='ol-full-screen'] CSS class name. * @property {string|Text|HTMLElement} [label='\u2922'] Text label to use for the button. * Instead of text, also an element (e.g. a `span` element) can be used. - * @property {string|Text} [labelActive='\u00d7'] Text label to use for the + * @property {string|Text|HTMLElement} [labelActive='\u00d7'] Text label to use for the * button when full-screen is active. + * Instead of text, also an element (e.g. a `span` element) can be used. * @property {string} [activeClassName=className + '-true'] CSS class name for the button * when full-screen is active. * @property {string} [inactiveClassName=className + '-false'] CSS class name for the button @@ -142,7 +143,7 @@ class FullScreen extends Control { /** * @private - * @type {Text} + * @type {Text|HTMLElement} */ this.labelActiveNode_ = typeof labelActive === 'string'