我有一个可以延迟加载图像的脚本,但是由于chrome 76出现了“本地”延迟加载。
我正在尝试检测浏览器是否支持本机延迟加载。但是我不知道该怎么做。
答案 0 :(得分:0)
您可以通过在var supportsLazyLoad = ('loading' in document.createElement('img'));
元素上使用特征检测来做到这一点:
//Create a mock object of the class Calculator
Calculator mockCalculator = Mockito.mock(Calculator.class);
//Return the value of 30 when the add method is called with the arguments 10 and 20
Mockito.when(mockCalculator.add(10, 20)).thenReturn(30);