{"record":{"id":"6ce1a7b76a76da20","repo":"Dogfalo/materialize","slug":"nouislider-cssprefix-must-be-a-string-or-false","errorCode":null,"errorMessage":"noUiSlider: 'cssPrefix' must be a string or `false`.","messagePattern":"noUiSlider: 'cssPrefix' must be a string or `false`\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extras/noUiSlider/nouislider.js","lineNumber":746,"sourceCode":"        }\n    }\n\n    function testFormat ( parsed, entry ) {\n\n        parsed.format = entry;\n\n        // Any object with a to and from method is supported.\n        if ( typeof entry.to === 'function' && typeof entry.from === 'function' ) {\n            return true;\n        }\n\n        throw new Error(\"noUiSlider: 'format' requires 'to' and 'from' methods.\");\n    }\n\n    function testCssPrefix ( parsed, entry ) {\n\n        if ( entry !== undefined && typeof entry !== 'string' && entry !== false ) {\n            throw new Error(\"noUiSlider: 'cssPrefix' must be a string or `false`.\");\n        }\n\n        parsed.cssPrefix = entry;\n    }\n\n    function testCssClasses ( parsed, entry ) {\n\n        if ( entry !== undefined && typeof entry !== 'object' ) {\n            throw new Error(\"noUiSlider: 'cssClasses' must be an object.\");\n        }\n\n        if ( typeof parsed.cssPrefix === 'string' ) {\n            parsed.cssClasses = {};\n\n            for ( var key in entry ) {\n                if ( !entry.hasOwnProperty(key) ) { continue; }\n\n                parsed.cssClasses[key] = parsed.cssPrefix + entry[key];","sourceCodeStart":728,"sourceCodeEnd":764,"githubUrl":"https://github.com/Dogfalo/materialize/blob/824e78248b3de81e383445e76ffb04cc3264fe7d/extras/noUiSlider/nouislider.js#L728-L764","documentation":"The 'cssPrefix' option prepends a string to every CSS class noUiSlider generates, or when set to false disables prefixing entirely. The library rejects any other type (number, object, array, null) because string concatenation in testCssClasses would otherwise produce garbage class names.","triggerScenarios":"Pass options.cssPrefix as a non-string, non-false, non-undefined value: a number (e.g. 0 to 'disable'), null, an object, or an array.","commonSituations":"Developers pass cssPrefix: 0 or null intending to disable prefixing (must be false), pass a numeric token, or reuse a config object where cssPrefix accidentally became another type.","solutions":["Pass a string prefix, e.g. cssPrefix: 'no-ui-'.","To disable prefixing, pass cssPrefix: false (not 0 or null).","Omit cssPrefix entirely to keep the default 'noUi-'."],"exampleFix":"// before\nnoUiSlider.create(el, { start: 0, range:{min:0,max:100}, cssPrefix: null });\n// after\nnoUiSlider.create(el, { start: 0, range:{min:0,max:100}, cssPrefix: false });","handlingStrategy":"type-guard","validationCode":"function normalizeCssPrefix(opts) {\n  const p = opts.cssPrefix;\n  if (p === undefined || typeof p === 'string' || p === false) return p;\n  throw new TypeError(\"cssPrefix must be a string or false\");\n}","typeGuard":"function isValidCssPrefix(v) {\n  return v === undefined || typeof v === 'string' || v === false;\n}","tryCatchPattern":null,"preventionTips":["Use false to disable prefixing, never 0 or null.","Treat cssPrefix as a TypeScript union: string | false | undefined.","Audit config objects deserialized from JSON for null where false is expected."],"tags":["nouislider","validation","configuration","css"],"backgroundTag":null,"analyzedSha":"824e78248b3de81e383445e76ffb04cc3264fe7d","analyzedAt":"2026-08-13T04:14:22.506Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}