-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2986 from colingm/native-data-view
Add nativeDataView check to isDataView
- Loading branch information
Showing
15 changed files
with
80 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
import tagTester from './_tagTester.js'; | ||
import isFunction from './isFunction.js'; | ||
import isArrayBuffer from './isArrayBuffer.js'; | ||
import { hasStringTagBug } from './_stringTagBug.js'; | ||
import { hasDataViewBug } from './_stringTagBug.js'; | ||
|
||
var isDataView = tagTester('DataView'); | ||
|
||
// In IE 10 - Edge 13, we need a different heuristic | ||
// to determine whether an object is a `DataView`. | ||
function ie10IsDataView(obj) { | ||
// Also, in cases where the native `DataView` is | ||
// overriden we can't rely on the tag itself. | ||
function alternateIsDataView(obj) { | ||
return obj != null && isFunction(obj.getInt8) && isArrayBuffer(obj.buffer); | ||
} | ||
|
||
export default (hasStringTagBug ? ie10IsDataView : isDataView); | ||
export default (hasDataViewBug ? alternateIsDataView : isDataView); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(function() { | ||
function overrideDataView() { | ||
NativeDataView = DataView; | ||
DataView = {}; | ||
} | ||
|
||
// Only override browser functions roughly 1/3rd of the time | ||
var runOverrides = Math.floor(Math.random() * 3) === 0; | ||
if (runOverrides) { | ||
overrideDataView(); | ||
} | ||
})(); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.