File tree 5 files changed +25
-7
lines changed
5 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 17
17
"Int16Array": true,
18
18
"Int32Array": true,
19
19
"ArrayBuffer": true,
20
+ "DataView": true,
20
21
"SVGElement": false
21
22
},
22
23
"rules": {
Original file line number Diff line number Diff line change 8
8
9
9
'use strict' ;
10
10
11
- // IE9 fallback
11
+ // IE9 fallbacks
12
+
12
13
var ab = ( typeof ArrayBuffer === 'undefined' || ! ArrayBuffer . isView ) ?
13
14
{ isView : function ( ) { return false ; } } :
14
15
ArrayBuffer ;
15
16
16
- exports . isTypedArray = ab . isView ;
17
+ var dv = ( typeof DataView === 'undefined' ) ?
18
+ function ( ) { } :
19
+ DataView ;
20
+
21
+ exports . isTypedArray = function ( a ) {
22
+ return ab . isView ( a ) && ! ( a instanceof dv ) ;
23
+ } ;
17
24
18
25
exports . isArrayOrTypedArray = function ( a ) {
19
- return Array . isArray ( a ) || ab . isView ( a ) ;
26
+ return Array . isArray ( a ) || exports . isTypedArray ( a ) ;
20
27
} ;
Original file line number Diff line number Diff line change @@ -6,3 +6,4 @@ delete window.Float32Array;
6
6
delete window . Float64Array ;
7
7
delete window . Int16Array ;
8
8
delete window . Int32Array ;
9
+ delete window . DataView ;
Original file line number Diff line number Diff line change @@ -18,12 +18,13 @@ var createGraphDiv = require('../assets/create_graph_div');
18
18
var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
19
19
20
20
describe ( 'Bundle with IE9 supported trace types:' , function ( ) {
21
-
22
21
afterEach ( destroyGraphDiv ) ;
23
22
24
- it ( ' check that ie9_mock.js did its job' , function ( ) {
23
+ it ( 'check that ie9_mock.js did its job' , function ( ) {
25
24
expect ( function ( ) { return ArrayBuffer ; } )
26
25
. toThrow ( new ReferenceError ( 'ArrayBuffer is not defined' ) ) ;
26
+ expect ( function ( ) { return DataView ; } )
27
+ . toThrow ( new ReferenceError ( 'DataView is not defined' ) ) ;
27
28
expect ( function ( ) { return Uint8Array ; } )
28
29
. toThrow ( new ReferenceError ( 'Uint8Array is not defined' ) ) ;
29
30
} ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ var Lib = require('@src/lib');
3
3
describe ( 'isArrayOrTypedArray' , function ( ) {
4
4
function A ( ) { }
5
5
6
+ var buffer = new ArrayBuffer ( 2 ) ;
7
+ var dv = new DataView ( buffer ) ;
8
+
6
9
var shouldPass = [
7
10
[ ] ,
8
11
new Array ( 10 ) ,
@@ -26,7 +29,8 @@ describe('isArrayOrTypedArray', function() {
26
29
'\n' ,
27
30
new Date ( ) ,
28
31
new RegExp ( 'foo' ) ,
29
- new String ( 'string' )
32
+ new String ( 'string' ) ,
33
+ dv
30
34
] ;
31
35
32
36
shouldPass . forEach ( function ( obj ) {
@@ -45,6 +49,9 @@ describe('isArrayOrTypedArray', function() {
45
49
describe ( 'isTypedArray' , function ( ) {
46
50
function A ( ) { }
47
51
52
+ var buffer = new ArrayBuffer ( 2 ) ;
53
+ var dv = new DataView ( buffer ) ;
54
+
48
55
var shouldPass = [
49
56
new Float32Array ( 1 ) ,
50
57
new Int32Array ( [ 1 , 2 , 3 ] )
@@ -68,7 +75,8 @@ describe('isTypedArray', function() {
68
75
'\n' ,
69
76
new Date ( ) ,
70
77
new RegExp ( 'foo' ) ,
71
- new String ( 'string' )
78
+ new String ( 'string' ) ,
79
+ dv
72
80
] ;
73
81
74
82
shouldPass . forEach ( function ( obj ) {
You can’t perform that action at this time.
0 commit comments