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
// (C) new BSD license | |
// fix FF bug (delay pass to function) and add support of arguments | |
(function($G) | |
{ | |
var fnCache = {}; | |
var _fixNoArgs = function(_origFn, _arraySlice) | |
{ | |
return function(/*_fn, delay*/) // .length === 0 | |
{ |
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
(function($G) | |
{ | |
var _lengthGetter = function() | |
{ | |
var b = -1; | |
var i; | |
for( ;; ) | |
{ | |
i = 1; |
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
// known issues: | |
// 1) not cross frame (_fn.toString === Function.prototype.toString) | |
var _isFunction = function(_fn) | |
{ | |
return typeof(_fn) == 'function' || | |
( | |
typeof(_fn) != 'string' && | |
!(_fn instanceof String) && | |
String(_fn).replace(/^\s+/, '').slice(0, 8) == 'function' && | |
( |
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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | |
"http://www.w3.org/TR/html4/loose.dtd"> | |
<html> | |
<head> | |
<title>keycode scaner</title> | |
<meta name="keywords" content="jbasis, keycode ,javascript, tool, tools"> | |
<meta name="description" content="jbasis keycode scaner"> | |
<meta content="text/html; charset=UTF-8" http-equiv="content-type"> |
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 test shows independence loop structure of performance | |
internal asm code become same | |
*/ | |
var m = 1000 | |
, aL = new Array(m) | |
; | |
aL[aL.length - 1] = 1; |
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
/* | |
Copyright 2006 Emil A Eklund <[email protected]> & Erik Arvidsson <[email protected]> | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 | |
Unless required by applicable law or agreed to in writing, software |
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
// via me and @kangax | |
(function() | |
{ | |
var a = {}; | |
var someId = new Date(); | |
var proto = {}; | |
proto[someId] = someId; | |
return (a.__proto__ = proto, a[someId] === someId) && |
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
Array.prototype._shuffleSelf = function() | |
{ | |
var i = this.length; | |
if(i >= 2) | |
{ | |
var _rand = Math.random; | |
while(--i) | |
{ |
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
$jb._isFunction([].map) && | |
(function(){ | |
var n = 0 | |
, isFail = false | |
, a = [1, 2, 3] | |
, b = a.map( | |
function(v, i, vs) | |
{ | |
n |= 1 << i; | |
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
/* | |
es5 introduces new Object api. Object.keys returns array of own enumerable keys of object. | |
In es3 we have classic construction "for in hasOwnProperty" for this purposes. | |
Test try to find what is best - es3 enumeration or es5 | |
In es5 we have overhead of array making and allocation | |
In es3 we have overhead of enumeration extra properties from prototype chain and filter it(using hasOwnProperty - extra function call) | |
update 1 | |
according brilliant idea of @abozhilov (http://twitter.com/abozhilov/status/26758011447) there is 3rd way which | |
uses nonstandard __proto__ (presents in v8 and JagerMonkey) |