Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
jio
Commits
cadb268e
Commit
cadb268e
authored
Jan 03, 2014
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Function.prototype.bind added to html5.js
parent
fcaa08e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
test/html5.js
test/html5.js
+37
-0
No files found.
test/html5.js
View file @
cadb268e
...
...
@@ -263,6 +263,43 @@
(
/
\b
PhantomJS
\b
/i
).
test
(
navigator
.
userAgent
))
{
window
.
Blob
=
Blob
;
window
.
FileReader
=
FileReader
;
//console.warn("Blob and FileReader have been replaced!");
}
if
(
!
Function
.
prototype
.
bind
)
{
//////////////////////////////////////////////////////////////////////
// https://github.com/TristanCavelier/notesntools/blob/master/javascript/\
// bind.js
/**
* Creates a new function that, when called, has its `this` keyword set to
* the provided value, with a given sequence of arguments preceding any
* provided when the new function is called. See Mozilla Developer Network:
* Function.prototype.bind
*
* In PhantomJS, their is a bug with `Function.prototype.bind`. You can
* reproduce this bug by testing this code:
*
* function a(str) { console.log(this, str); }
* var b = a.bind({"a": "b"}, "test");
* b();
*
* @param {Object} thisArg The value to be passed as the `this` parameter to
* the target function when the bound function is called. The value is
* ignored if the bound function is constructed using the `new` operator.
*
* @param {Any} [arg]* Arguments to prepend to arguments provided to the
* bound function when invoking the target function.
*
* @return {Function} The bound function.
*/
Function
.
prototype
.
bind
=
function
(
thisArg
)
{
var
fun
=
this
,
args
=
[].
slice
.
call
(
arguments
,
1
);
return
function
()
{
args
.
push
.
apply
(
args
,
arguments
);
return
fun
.
apply
(
thisArg
,
args
);
};
};
//console.warn("Function.prototype.bind has been replaced!");
}
}());
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment