{"record":{"id":"a9d48c9a5bfad876","repo":"Dogfalo/materialize","slug":"nouislider-userequestanimationframe-option-shou","errorCode":null,"errorMessage":"noUiSlider: 'useRequestAnimationFrame' option should be true (default) or false.","messagePattern":"noUiSlider: 'useRequestAnimationFrame' option should be true \\(default\\) or false\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extras/noUiSlider/nouislider.js","lineNumber":775,"sourceCode":"\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];\n            }\n        } else {\n            parsed.cssClasses = entry;\n        }\n    }\n\n    function testUseRaf ( parsed, entry ) {\n        if ( entry === true || entry === false ) {\n            parsed.useRequestAnimationFrame = entry;\n        } else {\n            throw new Error(\"noUiSlider: 'useRequestAnimationFrame' option should be true (default) or false.\");\n        }\n    }\n\n    // Test all developer settings and parse to assumption-safe values.\n    function testOptions ( options ) {\n\n        // To prove a fix for #537, freeze options here.\n        // If the object is modified, an error will be thrown.\n        // Object.freeze(options);\n\n        var parsed = {\n            margin: 0,\n            limit: 0,\n            padding: 0,\n            animate: true,\n            animationDuration: 300,\n            format: defaultFormatter\n        };","sourceCodeStart":757,"sourceCodeEnd":793,"githubUrl":"https://github.com/Dogfalo/materialize/blob/824e78248b3de81e383445e76ffb04cc3264fe7d/extras/noUiSlider/nouislider.js#L757-L793","documentation":"The 'useRequestAnimationFrame' option toggles whether noUiSlider animates handle movement via requestAnimationFrame. It is a strict boolean switch; any other type (string 'true', number 1, undefined-as-not-allowed) is rejected because the animation scheduler does a strict comparison.","triggerScenarios":"Pass options.useRequestAnimationFrame as anything other than the literal true or false: a string ('true'), a number (0/1), null, or 'default'.","commonSituations":"Loading options from JSON where booleans became strings ('false'), passing 0/1 from a checkbox/toggle library, or copy-pasting the string 'true' from documentation examples.","solutions":["Pass a literal boolean: useRequestAnimationFrame: true or false.","If the value comes from JSON or input, coerce explicitly: Boolean(raw) or raw === 'true' for string sources.","Omit the option to keep the default true."],"exampleFix":"// before\nnoUiSlider.create(el, { start: 0, range:{min:0,max:100}, useRequestAnimationFrame: 'false' });\n// after\nnoUiSlider.create(el, { start: 0, range:{min:0,max:100}, useRequestAnimationFrame: false });","handlingStrategy":"type-guard","validationCode":"function normalizeUseRaf(raw) {\n  if (raw === undefined) return true;\n  if (raw === true || raw === false) return raw;\n  if (typeof raw === 'string') return raw === 'true';\n  throw new TypeError('useRequestAnimationFrame must be boolean');\n}","typeGuard":"function isStrictBoolean(v) { return v === true || v === false; }","tryCatchPattern":null,"preventionTips":["Always use literal true/false, not 0/1 or 'true'/'false'.","Coerce values from JSON or forms with Boolean() or === 'true'.","Type the option as boolean in TypeScript."],"tags":["nouislider","validation","configuration","boolean","animation"],"backgroundTag":null,"analyzedSha":"824e78248b3de81e383445e76ffb04cc3264fe7d","analyzedAt":"2026-08-13T04:14:22.506Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}