JS lib: drop es5 shims.

This commit is contained in:
Zalim Bashorov
2014-02-05 14:19:05 +04:00
parent 0812dc8731
commit 2d31d62163
4 changed files with 25 additions and 82 deletions
+16 -75
View File
@@ -1,80 +1,23 @@
// TODO drop this:
(function () {
'use strict';
if (!Array.isArray) {
Array.isArray = function (vArg) {
return Object.prototype.toString.call(vArg) === "[object Array]";
};
}
if (!Function.prototype.bind) {
Function.prototype.bind = function (oThis) {
if (typeof this !== "function") {
// closest thing possible to the ECMAScript 5 internal IsCallable function
throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
}
var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
fNOP = function () {
},
fBound = function () {
return fToBind.apply(this instanceof fNOP && oThis
? this
: oThis,
aArgs.concat(Array.prototype.slice.call(arguments)));
};
fNOP.prototype = this.prototype;
fBound.prototype = new fNOP();
return fBound;
};
}
if (!Object.keys) {
Object.keys = function (o) {
var result = [];
var i = 0;
for (var p in o) {
if (o.hasOwnProperty(p)) {
result[i++] = p;
}
}
return result;
};
}
if (!Object.create) {
Object.create = function(proto) {
function F() {}
F.prototype = proto;
return new F();
}
}
// http://ejohn.org/blog/objectgetprototypeof/
if ( typeof Object.getPrototypeOf !== "function" ) {
if ( typeof "test".__proto__ === "object" ) {
Object.getPrototypeOf = function(object){
return object.__proto__;
};
} else {
Object.getPrototypeOf = function(object){
// May break if the constructor has been tampered with
return object.constructor.prototype;
};
}
}
})();
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*
* Copyright 2010-2014 JetBrains s.r.o.
*
* 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
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Kotlin = {};
(function () {
'use strict';
function toArray(obj) {
var array;
@@ -384,5 +327,3 @@ var Kotlin = {};
};
})();
+2 -2
View File
@@ -54,9 +54,9 @@
<maven.compiler.target>1.6</maven.compiler.target>
<maven-jar-plugin.version>2.4</maven-jar-plugin.version>
<pegdown.version>1.1.0</pegdown.version>
<surefire-version>2.5</surefire-version>
<surefire-version>2.16</surefire-version>
<exec-maven-plugin.version>1.2.1</exec-maven-plugin.version>
<selenium.version>2.25.0</selenium.version>
<selenium.version>2.37.1</selenium.version>
</properties>
<prerequisites>
@@ -24,6 +24,7 @@ import org.junit.runners.Parameterized;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import com.gargoylesoftware.htmlunit.BrowserVersion;
import java.io.File;
import java.io.IOException;
@@ -42,7 +43,7 @@ public class SeleniumTest {
protected static WebDriver driver = createDriver();
public static WebDriver createDriver() {
HtmlUnitDriver answer = new HtmlUnitDriver(true);
HtmlUnitDriver answer = new HtmlUnitDriver(BrowserVersion.FIREFOX_17);
answer.setJavascriptEnabled(true);
return answer;
}
@@ -1,10 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Kotlin Standard Library Test Suite</title>
<link rel="stylesheet" href="qunit.css">
<script src="qunit.js"></script>
<meta charset="UTF-8" />
<title>Kotlin Standard Library Test Suite</title>
<link rel="stylesheet" href="qunit.css">
<script src="qunit.js"></script>
<script src="../../../../../../dist/kotlinc/lib/kotlin.js"></script>
<script src="../../../target/js/kotlin-js-tests.js"></script>