Skip to content

Instantly share code, notes, and snippets.

@lsmith
Created January 21, 2012 01:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsmith/1650683 to your computer and use it in GitHub Desktop.
Save lsmith/1650683 to your computer and use it in GitHub Desktop.
Patch to make gallery-datatable-350-preview scrollable extension work
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