ace-rails-ap 4.3 → 4.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -2
- data/ace-rails-ap.gemspec +0 -2
- data/lib/ace/rails/version.rb +1 -1
- data/vendor/assets/javascripts/ace/ace.js +659 -1137
- data/vendor/assets/javascripts/ace/ext-beautify.js +5 -2
- data/vendor/assets/javascripts/ace/ext-code_lens.js +238 -0
- data/vendor/assets/javascripts/ace/ext-emmet.js +36 -28
- data/vendor/assets/javascripts/ace/ext-language_tools.js +63 -48
- data/vendor/assets/javascripts/ace/ext-modelist.js +12 -6
- data/vendor/assets/javascripts/ace/ext-options.js +46 -19
- data/vendor/assets/javascripts/ace/ext-prompt.js +57 -38
- data/vendor/assets/javascripts/ace/ext-settings_menu.js +46 -19
- data/vendor/assets/javascripts/ace/ext-spellcheck.js +0 -1
- data/vendor/assets/javascripts/ace/ext-themelist.js +2 -1
- data/vendor/assets/javascripts/ace/keybinding-emacs.js +21 -22
- data/vendor/assets/javascripts/ace/keybinding-sublime.js +2 -5
- data/vendor/assets/javascripts/ace/keybinding-vim.js +45 -9
- data/vendor/assets/javascripts/ace/keybinding-vscode.js +262 -0
- data/vendor/assets/javascripts/ace/mode-abc.js +3 -0
- data/vendor/assets/javascripts/ace/mode-actionscript.js +1 -0
- data/vendor/assets/javascripts/ace/mode-alda.js +311 -0
- data/vendor/assets/javascripts/ace/mode-asl.js +17 -16
- data/vendor/assets/javascripts/ace/mode-c_cpp.js +1 -0
- data/vendor/assets/javascripts/ace/mode-clojure.js +1 -0
- data/vendor/assets/javascripts/ace/mode-coffee.js +1 -0
- data/vendor/assets/javascripts/ace/mode-coldfusion.js +3 -0
- data/vendor/assets/javascripts/ace/mode-csound_document.js +40 -5
- data/vendor/assets/javascripts/ace/mode-csound_orchestra.js +37 -5
- data/vendor/assets/javascripts/ace/mode-csound_score.js +1 -0
- data/vendor/assets/javascripts/ace/mode-css.js +1 -0
- data/vendor/assets/javascripts/ace/mode-curly.js +3 -0
- data/vendor/assets/javascripts/ace/mode-d.js +1 -1
- data/vendor/assets/javascripts/ace/mode-dart.js +2 -0
- data/vendor/assets/javascripts/ace/mode-diff.js +1 -0
- data/vendor/assets/javascripts/ace/mode-django.js +4 -0
- data/vendor/assets/javascripts/ace/mode-dockerfile.js +1 -0
- data/vendor/assets/javascripts/ace/mode-drools.js +1 -0
- data/vendor/assets/javascripts/ace/mode-edifact.js +1 -0
- data/vendor/assets/javascripts/ace/mode-ejs.js +673 -165
- data/vendor/assets/javascripts/ace/mode-erlang.js +1 -0
- data/vendor/assets/javascripts/ace/mode-fsl.js +1 -0
- data/vendor/assets/javascripts/ace/mode-glsl.js +1 -0
- data/vendor/assets/javascripts/ace/mode-gobstones.js +2 -0
- data/vendor/assets/javascripts/ace/mode-graphqlschema.js +1 -0
- data/vendor/assets/javascripts/ace/mode-groovy.js +1 -0
- data/vendor/assets/javascripts/ace/mode-haml.js +419 -104
- data/vendor/assets/javascripts/ace/mode-handlebars.js +3 -0
- data/vendor/assets/javascripts/ace/mode-haskell.js +1 -0
- data/vendor/assets/javascripts/ace/mode-html.js +3 -0
- data/vendor/assets/javascripts/ace/mode-html_elixir.js +3 -0
- data/vendor/assets/javascripts/ace/mode-html_ruby.js +673 -165
- data/vendor/assets/javascripts/ace/mode-io.js +1 -0
- data/vendor/assets/javascripts/ace/mode-java.js +2 -0
- data/vendor/assets/javascripts/ace/mode-javascript.js +1 -0
- data/vendor/assets/javascripts/ace/mode-json.js +3 -0
- data/vendor/assets/javascripts/ace/mode-json5.js +360 -0
- data/vendor/assets/javascripts/ace/mode-jsoniq.js +1 -0
- data/vendor/assets/javascripts/ace/mode-jsp.js +1 -0
- data/vendor/assets/javascripts/ace/mode-kotlin.js +2 -0
- data/vendor/assets/javascripts/ace/mode-liquid.js +4 -0
- data/vendor/assets/javascripts/ace/mode-lsl.js +1 -0
- data/vendor/assets/javascripts/ace/mode-lua.js +1 -0
- data/vendor/assets/javascripts/ace/mode-luapage.js +4 -0
- data/vendor/assets/javascripts/ace/mode-makefile.js +1 -0
- data/vendor/assets/javascripts/ace/mode-markdown.js +5 -0
- data/vendor/assets/javascripts/ace/mode-maze.js +1 -0
- data/vendor/assets/javascripts/ace/mode-mediawiki.js +592 -0
- data/vendor/assets/javascripts/ace/mode-nix.js +1 -0
- data/vendor/assets/javascripts/ace/mode-nsis.js +1 -1
- data/vendor/assets/javascripts/ace/mode-nunjucks.js +2698 -0
- data/vendor/assets/javascripts/ace/mode-perl.js +1 -0
- data/vendor/assets/javascripts/ace/mode-pgsql.js +2 -2
- data/vendor/assets/javascripts/ace/mode-php.js +4 -0
- data/vendor/assets/javascripts/ace/mode-php_laravel_blade.js +4 -0
- data/vendor/assets/javascripts/ace/mode-prisma.js +489 -0
- data/vendor/assets/javascripts/ace/mode-protobuf.js +1 -0
- data/vendor/assets/javascripts/ace/mode-puppet.js +5 -6
- data/vendor/assets/javascripts/ace/mode-python.js +3 -2
- data/vendor/assets/javascripts/ace/mode-qml.js +381 -0
- data/vendor/assets/javascripts/ace/mode-r.js +1 -0
- data/vendor/assets/javascripts/ace/mode-razor.js +4 -0
- data/vendor/assets/javascripts/ace/mode-rhtml.js +3 -0
- data/vendor/assets/javascripts/ace/mode-rst.js +1 -0
- data/vendor/assets/javascripts/ace/mode-ruby.js +670 -165
- data/vendor/assets/javascripts/ace/mode-rust.js +1 -1
- data/vendor/assets/javascripts/ace/mode-scala.js +1 -0
- data/vendor/assets/javascripts/ace/mode-sh.js +1 -0
- data/vendor/assets/javascripts/ace/mode-sjs.js +1 -0
- data/vendor/assets/javascripts/ace/mode-slim.js +708 -110
- data/vendor/assets/javascripts/ace/mode-smarty.js +3 -0
- data/vendor/assets/javascripts/ace/mode-snippets.js +1 -0
- data/vendor/assets/javascripts/ace/mode-soy_template.js +3 -0
- data/vendor/assets/javascripts/ace/mode-sql.js +1 -0
- data/vendor/assets/javascripts/ace/mode-sqlserver.js +2 -1
- data/vendor/assets/javascripts/ace/mode-svg.js +1 -0
- data/vendor/assets/javascripts/ace/mode-swift.js +6 -0
- data/vendor/assets/javascripts/ace/mode-tcl.js +1 -0
- data/vendor/assets/javascripts/ace/mode-terraform.js +10 -7
- data/vendor/assets/javascripts/ace/mode-tex.js +1 -0
- data/vendor/assets/javascripts/ace/mode-textile.js +1 -0
- data/vendor/assets/javascripts/ace/mode-tsx.js +1 -0
- data/vendor/assets/javascripts/ace/mode-twig.js +3 -0
- data/vendor/assets/javascripts/ace/mode-typescript.js +1 -0
- data/vendor/assets/javascripts/ace/mode-vala.js +1 -0
- data/vendor/assets/javascripts/ace/mode-vbscript.js +444 -15
- data/vendor/assets/javascripts/ace/mode-velocity.js +4 -0
- data/vendor/assets/javascripts/ace/mode-vhdl.js +5 -6
- data/vendor/assets/javascripts/ace/mode-visualforce.js +3 -0
- data/vendor/assets/javascripts/ace/mode-wollok.js +2 -0
- data/vendor/assets/javascripts/ace/mode-xquery.js +1 -0
- data/vendor/assets/javascripts/ace/snippets/abap.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/ada.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/alda.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/apache_conf.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/apex.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/applescript.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/aql.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/asciidoc.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/asl.js +1 -5
- data/vendor/assets/javascripts/ace/snippets/assembly_x86.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/autohotkey.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/batchfile.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/c9search.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/cirru.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/cobol.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/coldfusion.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/crystal.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/csharp.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/csound_score.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/csp.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/curly.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/d.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/dockerfile.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/dot.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/eiffel.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/ejs.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/elixir.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/elm.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/forth.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/fortran.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/fsharp.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/ftl.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/gcode.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/gherkin.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/gitignore.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/glsl.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/golang.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/groovy.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/handlebars.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/haskell_cabal.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/haxe.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/hjson.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/html_elixir.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/html_ruby.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/ini.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/jack.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/jade.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/json.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/json5.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/jssm.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/jsx.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/julia.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/kotlin.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/latex.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/less.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/lisp.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/livescript.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/logiql.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/logtalk.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/luapage.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/lucene.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/mask.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/matlab.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/mediawiki.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/mel.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/mixal.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/mushcode.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/mysql.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/nginx.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/nim.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/nix.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/nsis.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/nunjucks.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/objectivec.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/ocaml.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/pascal.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/perl6.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/pgsql.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/php_laravel_blade.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/pig.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/plain_text.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/powershell.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/praat.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/prisma.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/prolog.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/properties.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/protobuf.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/puppet.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/qml.js +9 -0
- data/vendor/assets/javascripts/ace/snippets/rdoc.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/red.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/redshift.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/rhtml.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/rust.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/sass.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/scad.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/scala.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/scheme.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/scss.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/sjs.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/slim.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/smarty.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/soy_template.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/space.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/sparql.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/stylus.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/svg.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/swift.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/terraform.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/text.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/toml.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/tsx.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/turtle.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/twig.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/typescript.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/vbscript.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/verilog.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/vhdl.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/visualforce.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/xml.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/yaml.js +1 -6
- data/vendor/assets/javascripts/ace/snippets/zeek.js +1 -6
- data/vendor/assets/javascripts/ace/theme-ambiance.js +3 -2
- data/vendor/assets/javascripts/ace/theme-chaos.js +1 -1
- data/vendor/assets/javascripts/ace/theme-nord_dark.js +102 -0
- data/vendor/assets/javascripts/ace/worker-base.js +1421 -0
- data/vendor/assets/javascripts/ace/worker-coffee.js +17 -703
- data/vendor/assets/javascripts/ace/worker-css.js +17 -703
- data/vendor/assets/javascripts/ace/worker-html.js +17 -703
- data/vendor/assets/javascripts/ace/worker-javascript.js +7833 -5352
- data/vendor/assets/javascripts/ace/worker-json.js +17 -703
- data/vendor/assets/javascripts/ace/worker-lua.js +17 -703
- data/vendor/assets/javascripts/ace/worker-php.js +857 -1475
- data/vendor/assets/javascripts/ace/worker-xml.js +26 -707
- data/vendor/assets/javascripts/ace/worker-xquery.js +17 -703
- metadata +18 -4
- data/vendor/assets/javascripts/ace/mode-bro.js +0 -334
- data/vendor/assets/javascripts/ace/snippets/bro.js +0 -14
@@ -209,7 +209,6 @@ window.onmessage = function(e) {
|
|
209
209
|
}
|
210
210
|
else if (msg.init) {
|
211
211
|
window.initBaseUrls(msg.tlns);
|
212
|
-
require("ace/lib/es5-shim");
|
213
212
|
sender = window.sender = window.initSender();
|
214
213
|
var clazz = require(msg.module)[msg.classname];
|
215
214
|
main = window.main = new clazz(sender);
|
@@ -787,8 +786,8 @@ EventEmitter._signal = function(eventName, e) {
|
|
787
786
|
|
788
787
|
EventEmitter.once = function(eventName, callback) {
|
789
788
|
var _self = this;
|
790
|
-
this.
|
791
|
-
_self.
|
789
|
+
this.on(eventName, function newCallback() {
|
790
|
+
_self.off(eventName, newCallback);
|
792
791
|
callback.apply(null, arguments);
|
793
792
|
});
|
794
793
|
if (!callback) {
|
@@ -860,7 +859,9 @@ EventEmitter.removeEventListener = function(eventName, callback) {
|
|
860
859
|
};
|
861
860
|
|
862
861
|
EventEmitter.removeAllListeners = function(eventName) {
|
863
|
-
if (this._eventRegistry
|
862
|
+
if (!eventName) this._eventRegistry = this._defaultHandlers = undefined;
|
863
|
+
if (this._eventRegistry) this._eventRegistry[eventName] = undefined;
|
864
|
+
if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined;
|
864
865
|
};
|
865
866
|
|
866
867
|
exports.EventEmitter = EventEmitter;
|
@@ -960,7 +961,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|
960
961
|
});
|
961
962
|
};
|
962
963
|
this.detach = function() {
|
963
|
-
this.document.
|
964
|
+
this.document.off("change", this.$onChange);
|
964
965
|
};
|
965
966
|
this.attach = function(doc) {
|
966
967
|
this.document = doc || this.document;
|
@@ -1292,6 +1293,16 @@ var Document = function(textOrLines) {
|
|
1292
1293
|
}
|
1293
1294
|
};
|
1294
1295
|
|
1296
|
+
this.$safeApplyDelta = function(delta) {
|
1297
|
+
var docLength = this.$lines.length;
|
1298
|
+
if (
|
1299
|
+
delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength
|
1300
|
+
|| delta.action == "insert" && delta.start.row <= docLength
|
1301
|
+
) {
|
1302
|
+
this.applyDelta(delta);
|
1303
|
+
}
|
1304
|
+
};
|
1305
|
+
|
1295
1306
|
this.$splitAndapplyLargeDelta = function(delta, MAX) {
|
1296
1307
|
var lines = delta.lines;
|
1297
1308
|
var l = lines.length - MAX + 1;
|
@@ -1314,7 +1325,7 @@ var Document = function(textOrLines) {
|
|
1314
1325
|
this.applyDelta(delta, true);
|
1315
1326
|
};
|
1316
1327
|
this.revertDelta = function(delta) {
|
1317
|
-
this
|
1328
|
+
this.$safeApplyDelta({
|
1318
1329
|
start: this.clonePos(delta.start),
|
1319
1330
|
end: this.clonePos(delta.end),
|
1320
1331
|
action: (delta.action == "insert" ? "remove" : "insert"),
|
@@ -1824,10 +1835,15 @@ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '<!'
|
|
1824
1835
|
default:
|
1825
1836
|
if(source.substr(start+3,6) == 'CDATA['){
|
1826
1837
|
var end = source.indexOf(']]>',start+9);
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1838
|
+
if (end > start) {
|
1839
|
+
domBuilder.startCDATA();
|
1840
|
+
domBuilder.characters(source,start+9,end-start-9);
|
1841
|
+
domBuilder.endCDATA()
|
1842
|
+
return end+3;
|
1843
|
+
} else {
|
1844
|
+
errorHandler.error("Unclosed CDATA");
|
1845
|
+
return -1;
|
1846
|
+
}
|
1831
1847
|
}
|
1832
1848
|
var matchs = split(source,start);
|
1833
1849
|
var len = matchs.length;
|
@@ -3190,700 +3206,3 @@ oop.inherits(Worker, Mirror);
|
|
3190
3206
|
}).call(Worker.prototype);
|
3191
3207
|
|
3192
3208
|
});
|
3193
|
-
|
3194
|
-
define("ace/lib/es5-shim",[], function(require, exports, module) {
|
3195
|
-
|
3196
|
-
function Empty() {}
|
3197
|
-
|
3198
|
-
if (!Function.prototype.bind) {
|
3199
|
-
Function.prototype.bind = function bind(that) { // .length is 1
|
3200
|
-
var target = this;
|
3201
|
-
if (typeof target != "function") {
|
3202
|
-
throw new TypeError("Function.prototype.bind called on incompatible " + target);
|
3203
|
-
}
|
3204
|
-
var args = slice.call(arguments, 1); // for normal call
|
3205
|
-
var bound = function () {
|
3206
|
-
|
3207
|
-
if (this instanceof bound) {
|
3208
|
-
|
3209
|
-
var result = target.apply(
|
3210
|
-
this,
|
3211
|
-
args.concat(slice.call(arguments))
|
3212
|
-
);
|
3213
|
-
if (Object(result) === result) {
|
3214
|
-
return result;
|
3215
|
-
}
|
3216
|
-
return this;
|
3217
|
-
|
3218
|
-
} else {
|
3219
|
-
return target.apply(
|
3220
|
-
that,
|
3221
|
-
args.concat(slice.call(arguments))
|
3222
|
-
);
|
3223
|
-
|
3224
|
-
}
|
3225
|
-
|
3226
|
-
};
|
3227
|
-
if(target.prototype) {
|
3228
|
-
Empty.prototype = target.prototype;
|
3229
|
-
bound.prototype = new Empty();
|
3230
|
-
Empty.prototype = null;
|
3231
|
-
}
|
3232
|
-
return bound;
|
3233
|
-
};
|
3234
|
-
}
|
3235
|
-
var call = Function.prototype.call;
|
3236
|
-
var prototypeOfArray = Array.prototype;
|
3237
|
-
var prototypeOfObject = Object.prototype;
|
3238
|
-
var slice = prototypeOfArray.slice;
|
3239
|
-
var _toString = call.bind(prototypeOfObject.toString);
|
3240
|
-
var owns = call.bind(prototypeOfObject.hasOwnProperty);
|
3241
|
-
var defineGetter;
|
3242
|
-
var defineSetter;
|
3243
|
-
var lookupGetter;
|
3244
|
-
var lookupSetter;
|
3245
|
-
var supportsAccessors;
|
3246
|
-
if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
|
3247
|
-
defineGetter = call.bind(prototypeOfObject.__defineGetter__);
|
3248
|
-
defineSetter = call.bind(prototypeOfObject.__defineSetter__);
|
3249
|
-
lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
|
3250
|
-
lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
|
3251
|
-
}
|
3252
|
-
if ([1,2].splice(0).length != 2) {
|
3253
|
-
if(function() { // test IE < 9 to splice bug - see issue #138
|
3254
|
-
function makeArray(l) {
|
3255
|
-
var a = new Array(l+2);
|
3256
|
-
a[0] = a[1] = 0;
|
3257
|
-
return a;
|
3258
|
-
}
|
3259
|
-
var array = [], lengthBefore;
|
3260
|
-
|
3261
|
-
array.splice.apply(array, makeArray(20));
|
3262
|
-
array.splice.apply(array, makeArray(26));
|
3263
|
-
|
3264
|
-
lengthBefore = array.length; //46
|
3265
|
-
array.splice(5, 0, "XXX"); // add one element
|
3266
|
-
|
3267
|
-
lengthBefore + 1 == array.length
|
3268
|
-
|
3269
|
-
if (lengthBefore + 1 == array.length) {
|
3270
|
-
return true;// has right splice implementation without bugs
|
3271
|
-
}
|
3272
|
-
}()) {//IE 6/7
|
3273
|
-
var array_splice = Array.prototype.splice;
|
3274
|
-
Array.prototype.splice = function(start, deleteCount) {
|
3275
|
-
if (!arguments.length) {
|
3276
|
-
return [];
|
3277
|
-
} else {
|
3278
|
-
return array_splice.apply(this, [
|
3279
|
-
start === void 0 ? 0 : start,
|
3280
|
-
deleteCount === void 0 ? (this.length - start) : deleteCount
|
3281
|
-
].concat(slice.call(arguments, 2)))
|
3282
|
-
}
|
3283
|
-
};
|
3284
|
-
} else {//IE8
|
3285
|
-
Array.prototype.splice = function(pos, removeCount){
|
3286
|
-
var length = this.length;
|
3287
|
-
if (pos > 0) {
|
3288
|
-
if (pos > length)
|
3289
|
-
pos = length;
|
3290
|
-
} else if (pos == void 0) {
|
3291
|
-
pos = 0;
|
3292
|
-
} else if (pos < 0) {
|
3293
|
-
pos = Math.max(length + pos, 0);
|
3294
|
-
}
|
3295
|
-
|
3296
|
-
if (!(pos+removeCount < length))
|
3297
|
-
removeCount = length - pos;
|
3298
|
-
|
3299
|
-
var removed = this.slice(pos, pos+removeCount);
|
3300
|
-
var insert = slice.call(arguments, 2);
|
3301
|
-
var add = insert.length;
|
3302
|
-
if (pos === length) {
|
3303
|
-
if (add) {
|
3304
|
-
this.push.apply(this, insert);
|
3305
|
-
}
|
3306
|
-
} else {
|
3307
|
-
var remove = Math.min(removeCount, length - pos);
|
3308
|
-
var tailOldPos = pos + remove;
|
3309
|
-
var tailNewPos = tailOldPos + add - remove;
|
3310
|
-
var tailCount = length - tailOldPos;
|
3311
|
-
var lengthAfterRemove = length - remove;
|
3312
|
-
|
3313
|
-
if (tailNewPos < tailOldPos) { // case A
|
3314
|
-
for (var i = 0; i < tailCount; ++i) {
|
3315
|
-
this[tailNewPos+i] = this[tailOldPos+i];
|
3316
|
-
}
|
3317
|
-
} else if (tailNewPos > tailOldPos) { // case B
|
3318
|
-
for (i = tailCount; i--; ) {
|
3319
|
-
this[tailNewPos+i] = this[tailOldPos+i];
|
3320
|
-
}
|
3321
|
-
} // else, add == remove (nothing to do)
|
3322
|
-
|
3323
|
-
if (add && pos === lengthAfterRemove) {
|
3324
|
-
this.length = lengthAfterRemove; // truncate array
|
3325
|
-
this.push.apply(this, insert);
|
3326
|
-
} else {
|
3327
|
-
this.length = lengthAfterRemove + add; // reserves space
|
3328
|
-
for (i = 0; i < add; ++i) {
|
3329
|
-
this[pos+i] = insert[i];
|
3330
|
-
}
|
3331
|
-
}
|
3332
|
-
}
|
3333
|
-
return removed;
|
3334
|
-
};
|
3335
|
-
}
|
3336
|
-
}
|
3337
|
-
if (!Array.isArray) {
|
3338
|
-
Array.isArray = function isArray(obj) {
|
3339
|
-
return _toString(obj) == "[object Array]";
|
3340
|
-
};
|
3341
|
-
}
|
3342
|
-
var boxedString = Object("a"),
|
3343
|
-
splitString = boxedString[0] != "a" || !(0 in boxedString);
|
3344
|
-
|
3345
|
-
if (!Array.prototype.forEach) {
|
3346
|
-
Array.prototype.forEach = function forEach(fun /*, thisp*/) {
|
3347
|
-
var object = toObject(this),
|
3348
|
-
self = splitString && _toString(this) == "[object String]" ?
|
3349
|
-
this.split("") :
|
3350
|
-
object,
|
3351
|
-
thisp = arguments[1],
|
3352
|
-
i = -1,
|
3353
|
-
length = self.length >>> 0;
|
3354
|
-
if (_toString(fun) != "[object Function]") {
|
3355
|
-
throw new TypeError(); // TODO message
|
3356
|
-
}
|
3357
|
-
|
3358
|
-
while (++i < length) {
|
3359
|
-
if (i in self) {
|
3360
|
-
fun.call(thisp, self[i], i, object);
|
3361
|
-
}
|
3362
|
-
}
|
3363
|
-
};
|
3364
|
-
}
|
3365
|
-
if (!Array.prototype.map) {
|
3366
|
-
Array.prototype.map = function map(fun /*, thisp*/) {
|
3367
|
-
var object = toObject(this),
|
3368
|
-
self = splitString && _toString(this) == "[object String]" ?
|
3369
|
-
this.split("") :
|
3370
|
-
object,
|
3371
|
-
length = self.length >>> 0,
|
3372
|
-
result = Array(length),
|
3373
|
-
thisp = arguments[1];
|
3374
|
-
if (_toString(fun) != "[object Function]") {
|
3375
|
-
throw new TypeError(fun + " is not a function");
|
3376
|
-
}
|
3377
|
-
|
3378
|
-
for (var i = 0; i < length; i++) {
|
3379
|
-
if (i in self)
|
3380
|
-
result[i] = fun.call(thisp, self[i], i, object);
|
3381
|
-
}
|
3382
|
-
return result;
|
3383
|
-
};
|
3384
|
-
}
|
3385
|
-
if (!Array.prototype.filter) {
|
3386
|
-
Array.prototype.filter = function filter(fun /*, thisp */) {
|
3387
|
-
var object = toObject(this),
|
3388
|
-
self = splitString && _toString(this) == "[object String]" ?
|
3389
|
-
this.split("") :
|
3390
|
-
object,
|
3391
|
-
length = self.length >>> 0,
|
3392
|
-
result = [],
|
3393
|
-
value,
|
3394
|
-
thisp = arguments[1];
|
3395
|
-
if (_toString(fun) != "[object Function]") {
|
3396
|
-
throw new TypeError(fun + " is not a function");
|
3397
|
-
}
|
3398
|
-
|
3399
|
-
for (var i = 0; i < length; i++) {
|
3400
|
-
if (i in self) {
|
3401
|
-
value = self[i];
|
3402
|
-
if (fun.call(thisp, value, i, object)) {
|
3403
|
-
result.push(value);
|
3404
|
-
}
|
3405
|
-
}
|
3406
|
-
}
|
3407
|
-
return result;
|
3408
|
-
};
|
3409
|
-
}
|
3410
|
-
if (!Array.prototype.every) {
|
3411
|
-
Array.prototype.every = function every(fun /*, thisp */) {
|
3412
|
-
var object = toObject(this),
|
3413
|
-
self = splitString && _toString(this) == "[object String]" ?
|
3414
|
-
this.split("") :
|
3415
|
-
object,
|
3416
|
-
length = self.length >>> 0,
|
3417
|
-
thisp = arguments[1];
|
3418
|
-
if (_toString(fun) != "[object Function]") {
|
3419
|
-
throw new TypeError(fun + " is not a function");
|
3420
|
-
}
|
3421
|
-
|
3422
|
-
for (var i = 0; i < length; i++) {
|
3423
|
-
if (i in self && !fun.call(thisp, self[i], i, object)) {
|
3424
|
-
return false;
|
3425
|
-
}
|
3426
|
-
}
|
3427
|
-
return true;
|
3428
|
-
};
|
3429
|
-
}
|
3430
|
-
if (!Array.prototype.some) {
|
3431
|
-
Array.prototype.some = function some(fun /*, thisp */) {
|
3432
|
-
var object = toObject(this),
|
3433
|
-
self = splitString && _toString(this) == "[object String]" ?
|
3434
|
-
this.split("") :
|
3435
|
-
object,
|
3436
|
-
length = self.length >>> 0,
|
3437
|
-
thisp = arguments[1];
|
3438
|
-
if (_toString(fun) != "[object Function]") {
|
3439
|
-
throw new TypeError(fun + " is not a function");
|
3440
|
-
}
|
3441
|
-
|
3442
|
-
for (var i = 0; i < length; i++) {
|
3443
|
-
if (i in self && fun.call(thisp, self[i], i, object)) {
|
3444
|
-
return true;
|
3445
|
-
}
|
3446
|
-
}
|
3447
|
-
return false;
|
3448
|
-
};
|
3449
|
-
}
|
3450
|
-
if (!Array.prototype.reduce) {
|
3451
|
-
Array.prototype.reduce = function reduce(fun /*, initial*/) {
|
3452
|
-
var object = toObject(this),
|
3453
|
-
self = splitString && _toString(this) == "[object String]" ?
|
3454
|
-
this.split("") :
|
3455
|
-
object,
|
3456
|
-
length = self.length >>> 0;
|
3457
|
-
if (_toString(fun) != "[object Function]") {
|
3458
|
-
throw new TypeError(fun + " is not a function");
|
3459
|
-
}
|
3460
|
-
if (!length && arguments.length == 1) {
|
3461
|
-
throw new TypeError("reduce of empty array with no initial value");
|
3462
|
-
}
|
3463
|
-
|
3464
|
-
var i = 0;
|
3465
|
-
var result;
|
3466
|
-
if (arguments.length >= 2) {
|
3467
|
-
result = arguments[1];
|
3468
|
-
} else {
|
3469
|
-
do {
|
3470
|
-
if (i in self) {
|
3471
|
-
result = self[i++];
|
3472
|
-
break;
|
3473
|
-
}
|
3474
|
-
if (++i >= length) {
|
3475
|
-
throw new TypeError("reduce of empty array with no initial value");
|
3476
|
-
}
|
3477
|
-
} while (true);
|
3478
|
-
}
|
3479
|
-
|
3480
|
-
for (; i < length; i++) {
|
3481
|
-
if (i in self) {
|
3482
|
-
result = fun.call(void 0, result, self[i], i, object);
|
3483
|
-
}
|
3484
|
-
}
|
3485
|
-
|
3486
|
-
return result;
|
3487
|
-
};
|
3488
|
-
}
|
3489
|
-
if (!Array.prototype.reduceRight) {
|
3490
|
-
Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
|
3491
|
-
var object = toObject(this),
|
3492
|
-
self = splitString && _toString(this) == "[object String]" ?
|
3493
|
-
this.split("") :
|
3494
|
-
object,
|
3495
|
-
length = self.length >>> 0;
|
3496
|
-
if (_toString(fun) != "[object Function]") {
|
3497
|
-
throw new TypeError(fun + " is not a function");
|
3498
|
-
}
|
3499
|
-
if (!length && arguments.length == 1) {
|
3500
|
-
throw new TypeError("reduceRight of empty array with no initial value");
|
3501
|
-
}
|
3502
|
-
|
3503
|
-
var result, i = length - 1;
|
3504
|
-
if (arguments.length >= 2) {
|
3505
|
-
result = arguments[1];
|
3506
|
-
} else {
|
3507
|
-
do {
|
3508
|
-
if (i in self) {
|
3509
|
-
result = self[i--];
|
3510
|
-
break;
|
3511
|
-
}
|
3512
|
-
if (--i < 0) {
|
3513
|
-
throw new TypeError("reduceRight of empty array with no initial value");
|
3514
|
-
}
|
3515
|
-
} while (true);
|
3516
|
-
}
|
3517
|
-
|
3518
|
-
do {
|
3519
|
-
if (i in this) {
|
3520
|
-
result = fun.call(void 0, result, self[i], i, object);
|
3521
|
-
}
|
3522
|
-
} while (i--);
|
3523
|
-
|
3524
|
-
return result;
|
3525
|
-
};
|
3526
|
-
}
|
3527
|
-
if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
|
3528
|
-
Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
|
3529
|
-
var self = splitString && _toString(this) == "[object String]" ?
|
3530
|
-
this.split("") :
|
3531
|
-
toObject(this),
|
3532
|
-
length = self.length >>> 0;
|
3533
|
-
|
3534
|
-
if (!length) {
|
3535
|
-
return -1;
|
3536
|
-
}
|
3537
|
-
|
3538
|
-
var i = 0;
|
3539
|
-
if (arguments.length > 1) {
|
3540
|
-
i = toInteger(arguments[1]);
|
3541
|
-
}
|
3542
|
-
i = i >= 0 ? i : Math.max(0, length + i);
|
3543
|
-
for (; i < length; i++) {
|
3544
|
-
if (i in self && self[i] === sought) {
|
3545
|
-
return i;
|
3546
|
-
}
|
3547
|
-
}
|
3548
|
-
return -1;
|
3549
|
-
};
|
3550
|
-
}
|
3551
|
-
if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
|
3552
|
-
Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
|
3553
|
-
var self = splitString && _toString(this) == "[object String]" ?
|
3554
|
-
this.split("") :
|
3555
|
-
toObject(this),
|
3556
|
-
length = self.length >>> 0;
|
3557
|
-
|
3558
|
-
if (!length) {
|
3559
|
-
return -1;
|
3560
|
-
}
|
3561
|
-
var i = length - 1;
|
3562
|
-
if (arguments.length > 1) {
|
3563
|
-
i = Math.min(i, toInteger(arguments[1]));
|
3564
|
-
}
|
3565
|
-
i = i >= 0 ? i : length - Math.abs(i);
|
3566
|
-
for (; i >= 0; i--) {
|
3567
|
-
if (i in self && sought === self[i]) {
|
3568
|
-
return i;
|
3569
|
-
}
|
3570
|
-
}
|
3571
|
-
return -1;
|
3572
|
-
};
|
3573
|
-
}
|
3574
|
-
if (!Object.getPrototypeOf) {
|
3575
|
-
Object.getPrototypeOf = function getPrototypeOf(object) {
|
3576
|
-
return object.__proto__ || (
|
3577
|
-
object.constructor ?
|
3578
|
-
object.constructor.prototype :
|
3579
|
-
prototypeOfObject
|
3580
|
-
);
|
3581
|
-
};
|
3582
|
-
}
|
3583
|
-
if (!Object.getOwnPropertyDescriptor) {
|
3584
|
-
var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
|
3585
|
-
"non-object: ";
|
3586
|
-
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
|
3587
|
-
if ((typeof object != "object" && typeof object != "function") || object === null)
|
3588
|
-
throw new TypeError(ERR_NON_OBJECT + object);
|
3589
|
-
if (!owns(object, property))
|
3590
|
-
return;
|
3591
|
-
|
3592
|
-
var descriptor, getter, setter;
|
3593
|
-
descriptor = { enumerable: true, configurable: true };
|
3594
|
-
if (supportsAccessors) {
|
3595
|
-
var prototype = object.__proto__;
|
3596
|
-
object.__proto__ = prototypeOfObject;
|
3597
|
-
|
3598
|
-
var getter = lookupGetter(object, property);
|
3599
|
-
var setter = lookupSetter(object, property);
|
3600
|
-
object.__proto__ = prototype;
|
3601
|
-
|
3602
|
-
if (getter || setter) {
|
3603
|
-
if (getter) descriptor.get = getter;
|
3604
|
-
if (setter) descriptor.set = setter;
|
3605
|
-
return descriptor;
|
3606
|
-
}
|
3607
|
-
}
|
3608
|
-
descriptor.value = object[property];
|
3609
|
-
return descriptor;
|
3610
|
-
};
|
3611
|
-
}
|
3612
|
-
if (!Object.getOwnPropertyNames) {
|
3613
|
-
Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
|
3614
|
-
return Object.keys(object);
|
3615
|
-
};
|
3616
|
-
}
|
3617
|
-
if (!Object.create) {
|
3618
|
-
var createEmpty;
|
3619
|
-
if (Object.prototype.__proto__ === null) {
|
3620
|
-
createEmpty = function () {
|
3621
|
-
return { "__proto__": null };
|
3622
|
-
};
|
3623
|
-
} else {
|
3624
|
-
createEmpty = function () {
|
3625
|
-
var empty = {};
|
3626
|
-
for (var i in empty)
|
3627
|
-
empty[i] = null;
|
3628
|
-
empty.constructor =
|
3629
|
-
empty.hasOwnProperty =
|
3630
|
-
empty.propertyIsEnumerable =
|
3631
|
-
empty.isPrototypeOf =
|
3632
|
-
empty.toLocaleString =
|
3633
|
-
empty.toString =
|
3634
|
-
empty.valueOf =
|
3635
|
-
empty.__proto__ = null;
|
3636
|
-
return empty;
|
3637
|
-
}
|
3638
|
-
}
|
3639
|
-
|
3640
|
-
Object.create = function create(prototype, properties) {
|
3641
|
-
var object;
|
3642
|
-
if (prototype === null) {
|
3643
|
-
object = createEmpty();
|
3644
|
-
} else {
|
3645
|
-
if (typeof prototype != "object")
|
3646
|
-
throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
|
3647
|
-
var Type = function () {};
|
3648
|
-
Type.prototype = prototype;
|
3649
|
-
object = new Type();
|
3650
|
-
object.__proto__ = prototype;
|
3651
|
-
}
|
3652
|
-
if (properties !== void 0)
|
3653
|
-
Object.defineProperties(object, properties);
|
3654
|
-
return object;
|
3655
|
-
};
|
3656
|
-
}
|
3657
|
-
|
3658
|
-
function doesDefinePropertyWork(object) {
|
3659
|
-
try {
|
3660
|
-
Object.defineProperty(object, "sentinel", {});
|
3661
|
-
return "sentinel" in object;
|
3662
|
-
} catch (exception) {
|
3663
|
-
}
|
3664
|
-
}
|
3665
|
-
if (Object.defineProperty) {
|
3666
|
-
var definePropertyWorksOnObject = doesDefinePropertyWork({});
|
3667
|
-
var definePropertyWorksOnDom = typeof document == "undefined" ||
|
3668
|
-
doesDefinePropertyWork(document.createElement("div"));
|
3669
|
-
if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
|
3670
|
-
var definePropertyFallback = Object.defineProperty;
|
3671
|
-
}
|
3672
|
-
}
|
3673
|
-
|
3674
|
-
if (!Object.defineProperty || definePropertyFallback) {
|
3675
|
-
var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
|
3676
|
-
var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
|
3677
|
-
var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
|
3678
|
-
"on this javascript engine";
|
3679
|
-
|
3680
|
-
Object.defineProperty = function defineProperty(object, property, descriptor) {
|
3681
|
-
if ((typeof object != "object" && typeof object != "function") || object === null)
|
3682
|
-
throw new TypeError(ERR_NON_OBJECT_TARGET + object);
|
3683
|
-
if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
|
3684
|
-
throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
|
3685
|
-
if (definePropertyFallback) {
|
3686
|
-
try {
|
3687
|
-
return definePropertyFallback.call(Object, object, property, descriptor);
|
3688
|
-
} catch (exception) {
|
3689
|
-
}
|
3690
|
-
}
|
3691
|
-
if (owns(descriptor, "value")) {
|
3692
|
-
|
3693
|
-
if (supportsAccessors && (lookupGetter(object, property) ||
|
3694
|
-
lookupSetter(object, property)))
|
3695
|
-
{
|
3696
|
-
var prototype = object.__proto__;
|
3697
|
-
object.__proto__ = prototypeOfObject;
|
3698
|
-
delete object[property];
|
3699
|
-
object[property] = descriptor.value;
|
3700
|
-
object.__proto__ = prototype;
|
3701
|
-
} else {
|
3702
|
-
object[property] = descriptor.value;
|
3703
|
-
}
|
3704
|
-
} else {
|
3705
|
-
if (!supportsAccessors)
|
3706
|
-
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
|
3707
|
-
if (owns(descriptor, "get"))
|
3708
|
-
defineGetter(object, property, descriptor.get);
|
3709
|
-
if (owns(descriptor, "set"))
|
3710
|
-
defineSetter(object, property, descriptor.set);
|
3711
|
-
}
|
3712
|
-
|
3713
|
-
return object;
|
3714
|
-
};
|
3715
|
-
}
|
3716
|
-
if (!Object.defineProperties) {
|
3717
|
-
Object.defineProperties = function defineProperties(object, properties) {
|
3718
|
-
for (var property in properties) {
|
3719
|
-
if (owns(properties, property))
|
3720
|
-
Object.defineProperty(object, property, properties[property]);
|
3721
|
-
}
|
3722
|
-
return object;
|
3723
|
-
};
|
3724
|
-
}
|
3725
|
-
if (!Object.seal) {
|
3726
|
-
Object.seal = function seal(object) {
|
3727
|
-
return object;
|
3728
|
-
};
|
3729
|
-
}
|
3730
|
-
if (!Object.freeze) {
|
3731
|
-
Object.freeze = function freeze(object) {
|
3732
|
-
return object;
|
3733
|
-
};
|
3734
|
-
}
|
3735
|
-
try {
|
3736
|
-
Object.freeze(function () {});
|
3737
|
-
} catch (exception) {
|
3738
|
-
Object.freeze = (function freeze(freezeObject) {
|
3739
|
-
return function freeze(object) {
|
3740
|
-
if (typeof object == "function") {
|
3741
|
-
return object;
|
3742
|
-
} else {
|
3743
|
-
return freezeObject(object);
|
3744
|
-
}
|
3745
|
-
};
|
3746
|
-
})(Object.freeze);
|
3747
|
-
}
|
3748
|
-
if (!Object.preventExtensions) {
|
3749
|
-
Object.preventExtensions = function preventExtensions(object) {
|
3750
|
-
return object;
|
3751
|
-
};
|
3752
|
-
}
|
3753
|
-
if (!Object.isSealed) {
|
3754
|
-
Object.isSealed = function isSealed(object) {
|
3755
|
-
return false;
|
3756
|
-
};
|
3757
|
-
}
|
3758
|
-
if (!Object.isFrozen) {
|
3759
|
-
Object.isFrozen = function isFrozen(object) {
|
3760
|
-
return false;
|
3761
|
-
};
|
3762
|
-
}
|
3763
|
-
if (!Object.isExtensible) {
|
3764
|
-
Object.isExtensible = function isExtensible(object) {
|
3765
|
-
if (Object(object) === object) {
|
3766
|
-
throw new TypeError(); // TODO message
|
3767
|
-
}
|
3768
|
-
var name = '';
|
3769
|
-
while (owns(object, name)) {
|
3770
|
-
name += '?';
|
3771
|
-
}
|
3772
|
-
object[name] = true;
|
3773
|
-
var returnValue = owns(object, name);
|
3774
|
-
delete object[name];
|
3775
|
-
return returnValue;
|
3776
|
-
};
|
3777
|
-
}
|
3778
|
-
if (!Object.keys) {
|
3779
|
-
var hasDontEnumBug = true,
|
3780
|
-
dontEnums = [
|
3781
|
-
"toString",
|
3782
|
-
"toLocaleString",
|
3783
|
-
"valueOf",
|
3784
|
-
"hasOwnProperty",
|
3785
|
-
"isPrototypeOf",
|
3786
|
-
"propertyIsEnumerable",
|
3787
|
-
"constructor"
|
3788
|
-
],
|
3789
|
-
dontEnumsLength = dontEnums.length;
|
3790
|
-
|
3791
|
-
for (var key in {"toString": null}) {
|
3792
|
-
hasDontEnumBug = false;
|
3793
|
-
}
|
3794
|
-
|
3795
|
-
Object.keys = function keys(object) {
|
3796
|
-
|
3797
|
-
if (
|
3798
|
-
(typeof object != "object" && typeof object != "function") ||
|
3799
|
-
object === null
|
3800
|
-
) {
|
3801
|
-
throw new TypeError("Object.keys called on a non-object");
|
3802
|
-
}
|
3803
|
-
|
3804
|
-
var keys = [];
|
3805
|
-
for (var name in object) {
|
3806
|
-
if (owns(object, name)) {
|
3807
|
-
keys.push(name);
|
3808
|
-
}
|
3809
|
-
}
|
3810
|
-
|
3811
|
-
if (hasDontEnumBug) {
|
3812
|
-
for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
|
3813
|
-
var dontEnum = dontEnums[i];
|
3814
|
-
if (owns(object, dontEnum)) {
|
3815
|
-
keys.push(dontEnum);
|
3816
|
-
}
|
3817
|
-
}
|
3818
|
-
}
|
3819
|
-
return keys;
|
3820
|
-
};
|
3821
|
-
|
3822
|
-
}
|
3823
|
-
if (!Date.now) {
|
3824
|
-
Date.now = function now() {
|
3825
|
-
return new Date().getTime();
|
3826
|
-
};
|
3827
|
-
}
|
3828
|
-
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
|
3829
|
-
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
|
3830
|
-
"\u2029\uFEFF";
|
3831
|
-
if (!String.prototype.trim) {
|
3832
|
-
ws = "[" + ws + "]";
|
3833
|
-
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
|
3834
|
-
trimEndRegexp = new RegExp(ws + ws + "*$");
|
3835
|
-
String.prototype.trim = function trim() {
|
3836
|
-
return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
|
3837
|
-
};
|
3838
|
-
}
|
3839
|
-
|
3840
|
-
function toInteger(n) {
|
3841
|
-
n = +n;
|
3842
|
-
if (n !== n) { // isNaN
|
3843
|
-
n = 0;
|
3844
|
-
} else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
|
3845
|
-
n = (n > 0 || -1) * Math.floor(Math.abs(n));
|
3846
|
-
}
|
3847
|
-
return n;
|
3848
|
-
}
|
3849
|
-
|
3850
|
-
function isPrimitive(input) {
|
3851
|
-
var type = typeof input;
|
3852
|
-
return (
|
3853
|
-
input === null ||
|
3854
|
-
type === "undefined" ||
|
3855
|
-
type === "boolean" ||
|
3856
|
-
type === "number" ||
|
3857
|
-
type === "string"
|
3858
|
-
);
|
3859
|
-
}
|
3860
|
-
|
3861
|
-
function toPrimitive(input) {
|
3862
|
-
var val, valueOf, toString;
|
3863
|
-
if (isPrimitive(input)) {
|
3864
|
-
return input;
|
3865
|
-
}
|
3866
|
-
valueOf = input.valueOf;
|
3867
|
-
if (typeof valueOf === "function") {
|
3868
|
-
val = valueOf.call(input);
|
3869
|
-
if (isPrimitive(val)) {
|
3870
|
-
return val;
|
3871
|
-
}
|
3872
|
-
}
|
3873
|
-
toString = input.toString;
|
3874
|
-
if (typeof toString === "function") {
|
3875
|
-
val = toString.call(input);
|
3876
|
-
if (isPrimitive(val)) {
|
3877
|
-
return val;
|
3878
|
-
}
|
3879
|
-
}
|
3880
|
-
throw new TypeError();
|
3881
|
-
}
|
3882
|
-
var toObject = function (o) {
|
3883
|
-
if (o == null) { // this matches both null and undefined
|
3884
|
-
throw new TypeError("can't convert "+o+" to object");
|
3885
|
-
}
|
3886
|
-
return Object(o);
|
3887
|
-
};
|
3888
|
-
|
3889
|
-
});
|