Created
January 21, 2012 01:38
-
-
Save lsmith/1650683 to your computer and use it in GitHub Desktop.
Patch to make gallery-datatable-350-preview scrollable extension work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUI.add('gallery-getscrollbarwidth', function (Y) { | |
Y.DOM.getScrollbarWidth = Y.cached(function () { | |
var doc = Y.config.doc, | |
testNode = doc.createElement('div'), | |
body = doc.getElementsByTagName('body')[0], | |
// 0.1 because cached doesn't support falsy refetch values | |
width = 0.1; | |
if (body) { | |
testNode.style.cssText = "position:absolute;visibility:hidden;overflow:scroll;width:20px;"; | |
testNode.appendChild(doc.createElement('p')).style.height = '1px'; | |
body.insertBefore(testNode, body.firstChild); | |
width = testNode.offsetWidth - testNode.clientWidth; | |
body.removeChild(testNode); | |
} | |
return width; | |
}, null, 0.1); | |
}, '0.1', { requires: ['dom-screen'] }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment