(id, wrapperStyles, set)
| 252 | // Throws and returns if the required external elements don't exist, |
| 253 | // which means any external page animations won't be applied |
| 254 | function handleExternalWrapper(id, wrapperStyles, set) { |
| 255 | var wrapper = document.getElementById(id); |
| 256 | |
| 257 | if (!wrapper) { |
| 258 | console.error("Element with ID '" + id + "' not found"); |
| 259 | return; |
| 260 | } |
| 261 | |
| 262 | var builtStyles = getStyle(wrapperStyles); |
| 263 | |
| 264 | for (var prop in builtStyles) { |
| 265 | if (builtStyles.hasOwnProperty(prop)) { |
| 266 | wrapper.style[prop] = set ? builtStyles[prop] : ''; |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | // Prevent any horizontal scroll |
| 271 | // Only set overflow-x as an inline style if htmlClassName or |
| 272 | // bodyClassName is not passed in. Otherwise, it is up to the caller to |
| 273 | // decide if they want to set the overflow style in CSS using the custom |
| 274 | // class names |
| 275 | var applyOverflow = function applyOverflow(el) { |
| 276 | return el.style['overflow-x'] = set ? 'hidden' : ''; |
| 277 | }; |
| 278 | if (!props.htmlClassName) { |
| 279 | applyOverflow(document.querySelector('html')); |
| 280 | } |
| 281 | if (!props.bodyClassName) { |
| 282 | applyOverflow(document.querySelector('body')); |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | // Applies component-specific styles to external wrapper elements |
| 287 | function applyWrapperStyles() { |
no test coverage detected