MCPcopy
hub / github.com/nwjs/nw.js / tooltip_parseBindings

Function tooltip_parseBindings

test/sanity/issue7197-load/js/chunk-vendors.6e82bc79.js:36219–36345  ·  view source on GitHub ↗
(bindings, vnode)

Source from the content-addressed store, hash-verified

36217// Arguments and modifiers take precedence over passed value config object
36218
36219var tooltip_parseBindings = function parseBindings(bindings, vnode)
36220/* istanbul ignore next: not easy to test */
36221{
36222 // We start out with a basic config
36223 var NAME = 'BTooltip'; // Default config
36224
36225 var config = {
36226 title: undefined,
36227 trigger: '',
36228 // Default set below if needed
36229 placement: 'top',
36230 fallbackPlacement: 'flip',
36231 container: false,
36232 // Default of body
36233 animation: true,
36234 offset: 0,
36235 id: null,
36236 html: false,
36237 disabled: false,
36238 delay: getComponentConfig(NAME, 'delay'),
36239 boundary: String(getComponentConfig(NAME, 'boundary')),
36240 boundaryPadding: parseInt(getComponentConfig(NAME, 'boundaryPadding'), 10) || 0,
36241 variant: getComponentConfig(NAME, 'variant'),
36242 customClass: getComponentConfig(NAME, 'customClass')
36243 }; // Process `bindings.value`
36244
36245 if (isString(bindings.value) || isNumber(bindings.value)) {
36246 // Value is tooltip content (HTML optionally supported)
36247 config.title = bindings.value;
36248 } else if (isFunction(bindings.value)) {
36249 // Title generator function
36250 config.title = bindings.value;
36251 } else if (isPlainObject(bindings.value)) {
36252 // Value is config object, so merge
36253 config = tooltip_objectSpread({}, config, {}, bindings.value);
36254 } // If title is not provided, try title attribute
36255
36256
36257 if (isUndefined(config.title)) {
36258 // Try attribute
36259 var data = vnode.data || {};
36260 config.title = data.attrs && !isUndefinedOrNull(data.attrs.title) ? data.attrs.title : undefined;
36261 } // Normalize delay
36262
36263
36264 if (!isPlainObject(config.delay)) {
36265 config.delay = {
36266 show: parseInt(config.delay, 10) || 0,
36267 hide: parseInt(config.delay, 10) || 0
36268 };
36269 } // If argument, assume element ID of container element
36270
36271
36272 if (bindings.arg) {
36273 // Element ID specified as arg
36274 // We must prepend '#' to become a CSS selector
36275 config.container = "#".concat(bindings.arg);
36276 } // Process modifiers

Callers 1

tooltip_applyTooltipFunction · 0.85

Calls 9

getComponentConfigFunction · 0.85
isStringFunction · 0.85
isNumberFunction · 0.85
isFunctionFunction · 0.85
isPlainObjectFunction · 0.85
tooltip_objectSpreadFunction · 0.85
isUndefinedFunction · 0.85
isUndefinedOrNullFunction · 0.85
concatFunction · 0.85

Tested by

no test coverage detected