{"ScriptPreparationCode":"var regex = /(auto|scroll)/;\r\n\r\nfunction parents(node, ps) {\r\n if (node.parentNode === null) {\r\n return ps;\r\n }\r\n\r\n return parents(node.parentNode, ps.concat([node]));\r\n};\r\n\r\n/** batched */\r\nfunction scroll_batched(element) {\r\n var style = window.getComputedStyle(element, null);\r\n return regex.test(style.getPropertyValue(\u0022overflow\u0022) \u002B style.getPropertyValue(\u0022overflow-y\u0022) \u002B style.getPropertyValue(\u0022overflow-x\u0022));\r\n}\r\n\r\nfunction scrollparent_batched(element) {\r\n var ps = parents(element.parentNode, []);\r\n\r\n for (var i = 0; i \u003C ps.length; i \u002B= 1) {\r\n if (scroll_batched(ps[i])) {\r\n return ps[i];\r\n }\r\n }\r\n}\r\n\r\n/** inline */\r\n\r\nfunction scroll_inline(element) {\r\n return regex.test(window.getComputedStyle(element, null).getPropertyValue(\u0022overflow\u0022) \u002B window.getComputedStyle(element, null).getPropertyValue(\u0022overflow-y\u0022) \u002B window.getComputedStyle(element, null).getPropertyValue(\u0022overflow-x\u0022));\r\n}\r\n\r\nfunction scrollparent_inline(element) {\r\n var ps = parents(element.parentNode, []);\r\n\r\n for (var i = 0; i \u003C ps.length; i \u002B= 1) {\r\n if (scroll_inline(ps[i])) {\r\n return ps[i];\r\n }\r\n }\r\n\r\n}","TestCases":[{"Name":"inline getComputedStyle","Code":"var scrollparentElement = scrollparent_inline(document.getElementById(\u0022bar\u0022));\r\nconsole.assert(scrollparentElement === document.getElementById(\u0022foo\u0022), \u0022foo should be the scroll parent, instead got %0\u0022, scrollparentElement);","IsDeferred":false},{"Name":"batched getComputedStyle","Code":"var scrollparentElement = scrollparent_batched(document.getElementById(\u0022bar\u0022));\r\nconsole.assert(scrollparentElement === document.getElementById(\u0022foo\u0022), \u0022foo should be the scroll parent, instead got %0\u0022, scrollparentElement);\r\n","IsDeferred":false}]}