File tree Expand file tree Collapse file tree 5 files changed +25
-7
lines changed Expand file tree Collapse file tree 5 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 1717 "Int16Array": true,
1818 "Int32Array": true,
1919 "ArrayBuffer": true,
20+ "DataView": true,
2021 "SVGElement": false
2122 },
2223 "rules": {
Original file line number Diff line number Diff line change 88
99'use strict' ;
1010
11- // IE9 fallback
11+ // IE9 fallbacks
12+
1213var ab = ( typeof ArrayBuffer === 'undefined' || ! ArrayBuffer . isView ) ?
1314 { isView : function ( ) { return false ; } } :
1415 ArrayBuffer ;
1516
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+ } ;
1724
1825exports . isArrayOrTypedArray = function ( a ) {
19- return Array . isArray ( a ) || ab . isView ( a ) ;
26+ return Array . isArray ( a ) || exports . isTypedArray ( a ) ;
2027} ;
Original file line number Diff line number Diff line change @@ -6,3 +6,4 @@ delete window.Float32Array;
66delete window . Float64Array ;
77delete window . Int16Array ;
88delete 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');
1818var destroyGraphDiv = require ( '../assets/destroy_graph_div' ) ;
1919
2020describe ( 'Bundle with IE9 supported trace types:' , function ( ) {
21-
2221 afterEach ( destroyGraphDiv ) ;
2322
24- it ( ' check that ie9_mock.js did its job' , function ( ) {
23+ it ( 'check that ie9_mock.js did its job' , function ( ) {
2524 expect ( function ( ) { return ArrayBuffer ; } )
2625 . toThrow ( new ReferenceError ( 'ArrayBuffer is not defined' ) ) ;
26+ expect ( function ( ) { return DataView ; } )
27+ . toThrow ( new ReferenceError ( 'DataView is not defined' ) ) ;
2728 expect ( function ( ) { return Uint8Array ; } )
2829 . toThrow ( new ReferenceError ( 'Uint8Array is not defined' ) ) ;
2930 } ) ;
Original file line number Diff line number Diff line change @@ -3,6 +3,9 @@ var Lib = require('@src/lib');
33describe ( 'isArrayOrTypedArray' , function ( ) {
44 function A ( ) { }
55
6+ var buffer = new ArrayBuffer ( 2 ) ;
7+ var dv = new DataView ( buffer ) ;
8+
69 var shouldPass = [
710 [ ] ,
811 new Array ( 10 ) ,
@@ -26,7 +29,8 @@ describe('isArrayOrTypedArray', function() {
2629 '\n' ,
2730 new Date ( ) ,
2831 new RegExp ( 'foo' ) ,
29- new String ( 'string' )
32+ new String ( 'string' ) ,
33+ dv
3034 ] ;
3135
3236 shouldPass . forEach ( function ( obj ) {
@@ -45,6 +49,9 @@ describe('isArrayOrTypedArray', function() {
4549describe ( 'isTypedArray' , function ( ) {
4650 function A ( ) { }
4751
52+ var buffer = new ArrayBuffer ( 2 ) ;
53+ var dv = new DataView ( buffer ) ;
54+
4855 var shouldPass = [
4956 new Float32Array ( 1 ) ,
5057 new Int32Array ( [ 1 , 2 , 3 ] )
@@ -68,7 +75,8 @@ describe('isTypedArray', function() {
6875 '\n' ,
6976 new Date ( ) ,
7077 new RegExp ( 'foo' ) ,
71- new String ( 'string' )
78+ new String ( 'string' ) ,
79+ dv
7280 ] ;
7381
7482 shouldPass . forEach ( function ( obj ) {
You can’t perform that action at this time.
0 commit comments