MCPcopy Create free account
hub / github.com/breck7/scroll / _fnBrowserDetect

Function _fnBrowserDetect

external/.datatables.js:1824–1875  ·  view source on GitHub ↗

* Browser feature detection for capabilities, quirks * @param {object} settings dataTables settings object * @memberof DataTable#oApi

(settings)

Source from the content-addressed store, hash-verified

1822 * @memberof DataTable#oApi
1823 */
1824 function _fnBrowserDetect(settings) {
1825 // We don't need to do this every time DataTables is constructed, the values
1826 // calculated are specific to the browser and OS configuration which we
1827 // don't expect to change between initialisations
1828 if (!DataTable.__browser) {
1829 var browser = {}
1830 DataTable.__browser = browser
1831
1832 // Scrolling feature / quirks detection
1833 var n = $("<div/>")
1834 .css({
1835 position: "fixed",
1836 top: 0,
1837 left: -1 * window.pageXOffset, // allow for scrolling
1838 height: 1,
1839 width: 1,
1840 overflow: "hidden"
1841 })
1842 .append(
1843 $("<div/>")
1844 .css({
1845 position: "absolute",
1846 top: 1,
1847 left: 1,
1848 width: 100,
1849 overflow: "scroll"
1850 })
1851 .append(
1852 $("<div/>").css({
1853 width: "100%",
1854 height: 10
1855 })
1856 )
1857 )
1858 .appendTo("body")
1859
1860 var outer = n.children()
1861 var inner = outer.children()
1862
1863 // Get scrollbar width
1864 browser.barWidth = outer[0].offsetWidth - outer[0].clientWidth
1865
1866 // In rtl text layout, some browsers (most, but not all) will place the
1867 // scrollbar on the left, rather than the right.
1868 browser.bScrollbarLeft = Math.round(inner.offset().left) !== 1
1869
1870 n.remove()
1871 }
1872
1873 $.extend(settings.oBrowser, DataTable.__browser)
1874 settings.oScroll.iBarWidth = DataTable.__browser.barWidth
1875 }
1876
1877 /**
1878 * Add a column to the list used for the table with default values

Callers 1

DataTableFunction · 0.85

Calls 3

removeMethod · 0.80
extendMethod · 0.80
$Function · 0.70

Tested by

no test coverage detected