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"),
|
@@ -10909,700 +10920,3 @@ oop.inherits(Worker, Mirror);
|
|
10909
10920
|
}).call(Worker.prototype);
|
10910
10921
|
|
10911
10922
|
});
|
10912
|
-
|
10913
|
-
define("ace/lib/es5-shim",[], function(require, exports, module) {
|
10914
|
-
|
10915
|
-
function Empty() {}
|
10916
|
-
|
10917
|
-
if (!Function.prototype.bind) {
|
10918
|
-
Function.prototype.bind = function bind(that) { // .length is 1
|
10919
|
-
var target = this;
|
10920
|
-
if (typeof target != "function") {
|
10921
|
-
throw new TypeError("Function.prototype.bind called on incompatible " + target);
|
10922
|
-
}
|
10923
|
-
var args = slice.call(arguments, 1); // for normal call
|
10924
|
-
var bound = function () {
|
10925
|
-
|
10926
|
-
if (this instanceof bound) {
|
10927
|
-
|
10928
|
-
var result = target.apply(
|
10929
|
-
this,
|
10930
|
-
args.concat(slice.call(arguments))
|
10931
|
-
);
|
10932
|
-
if (Object(result) === result) {
|
10933
|
-
return result;
|
10934
|
-
}
|
10935
|
-
return this;
|
10936
|
-
|
10937
|
-
} else {
|
10938
|
-
return target.apply(
|
10939
|
-
that,
|
10940
|
-
args.concat(slice.call(arguments))
|
10941
|
-
);
|
10942
|
-
|
10943
|
-
}
|
10944
|
-
|
10945
|
-
};
|
10946
|
-
if(target.prototype) {
|
10947
|
-
Empty.prototype = target.prototype;
|
10948
|
-
bound.prototype = new Empty();
|
10949
|
-
Empty.prototype = null;
|
10950
|
-
}
|
10951
|
-
return bound;
|
10952
|
-
};
|
10953
|
-
}
|
10954
|
-
var call = Function.prototype.call;
|
10955
|
-
var prototypeOfArray = Array.prototype;
|
10956
|
-
var prototypeOfObject = Object.prototype;
|
10957
|
-
var slice = prototypeOfArray.slice;
|
10958
|
-
var _toString = call.bind(prototypeOfObject.toString);
|
10959
|
-
var owns = call.bind(prototypeOfObject.hasOwnProperty);
|
10960
|
-
var defineGetter;
|
10961
|
-
var defineSetter;
|
10962
|
-
var lookupGetter;
|
10963
|
-
var lookupSetter;
|
10964
|
-
var supportsAccessors;
|
10965
|
-
if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
|
10966
|
-
defineGetter = call.bind(prototypeOfObject.__defineGetter__);
|
10967
|
-
defineSetter = call.bind(prototypeOfObject.__defineSetter__);
|
10968
|
-
lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
|
10969
|
-
lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
|
10970
|
-
}
|
10971
|
-
if ([1,2].splice(0).length != 2) {
|
10972
|
-
if(function() { // test IE < 9 to splice bug - see issue #138
|
10973
|
-
function makeArray(l) {
|
10974
|
-
var a = new Array(l+2);
|
10975
|
-
a[0] = a[1] = 0;
|
10976
|
-
return a;
|
10977
|
-
}
|
10978
|
-
var array = [], lengthBefore;
|
10979
|
-
|
10980
|
-
array.splice.apply(array, makeArray(20));
|
10981
|
-
array.splice.apply(array, makeArray(26));
|
10982
|
-
|
10983
|
-
lengthBefore = array.length; //46
|
10984
|
-
array.splice(5, 0, "XXX"); // add one element
|
10985
|
-
|
10986
|
-
lengthBefore + 1 == array.length
|
10987
|
-
|
10988
|
-
if (lengthBefore + 1 == array.length) {
|
10989
|
-
return true;// has right splice implementation without bugs
|
10990
|
-
}
|
10991
|
-
}()) {//IE 6/7
|
10992
|
-
var array_splice = Array.prototype.splice;
|
10993
|
-
Array.prototype.splice = function(start, deleteCount) {
|
10994
|
-
if (!arguments.length) {
|
10995
|
-
return [];
|
10996
|
-
} else {
|
10997
|
-
return array_splice.apply(this, [
|
10998
|
-
start === void 0 ? 0 : start,
|
10999
|
-
deleteCount === void 0 ? (this.length - start) : deleteCount
|
11000
|
-
].concat(slice.call(arguments, 2)))
|
11001
|
-
}
|
11002
|
-
};
|
11003
|
-
} else {//IE8
|
11004
|
-
Array.prototype.splice = function(pos, removeCount){
|
11005
|
-
var length = this.length;
|
11006
|
-
if (pos > 0) {
|
11007
|
-
if (pos > length)
|
11008
|
-
pos = length;
|
11009
|
-
} else if (pos == void 0) {
|
11010
|
-
pos = 0;
|
11011
|
-
} else if (pos < 0) {
|
11012
|
-
pos = Math.max(length + pos, 0);
|
11013
|
-
}
|
11014
|
-
|
11015
|
-
if (!(pos+removeCount < length))
|
11016
|
-
removeCount = length - pos;
|
11017
|
-
|
11018
|
-
var removed = this.slice(pos, pos+removeCount);
|
11019
|
-
var insert = slice.call(arguments, 2);
|
11020
|
-
var add = insert.length;
|
11021
|
-
if (pos === length) {
|
11022
|
-
if (add) {
|
11023
|
-
this.push.apply(this, insert);
|
11024
|
-
}
|
11025
|
-
} else {
|
11026
|
-
var remove = Math.min(removeCount, length - pos);
|
11027
|
-
var tailOldPos = pos + remove;
|
11028
|
-
var tailNewPos = tailOldPos + add - remove;
|
11029
|
-
var tailCount = length - tailOldPos;
|
11030
|
-
var lengthAfterRemove = length - remove;
|
11031
|
-
|
11032
|
-
if (tailNewPos < tailOldPos) { // case A
|
11033
|
-
for (var i = 0; i < tailCount; ++i) {
|
11034
|
-
this[tailNewPos+i] = this[tailOldPos+i];
|
11035
|
-
}
|
11036
|
-
} else if (tailNewPos > tailOldPos) { // case B
|
11037
|
-
for (i = tailCount; i--; ) {
|
11038
|
-
this[tailNewPos+i] = this[tailOldPos+i];
|
11039
|
-
}
|
11040
|
-
} // else, add == remove (nothing to do)
|
11041
|
-
|
11042
|
-
if (add && pos === lengthAfterRemove) {
|
11043
|
-
this.length = lengthAfterRemove; // truncate array
|
11044
|
-
this.push.apply(this, insert);
|
11045
|
-
} else {
|
11046
|
-
this.length = lengthAfterRemove + add; // reserves space
|
11047
|
-
for (i = 0; i < add; ++i) {
|
11048
|
-
this[pos+i] = insert[i];
|
11049
|
-
}
|
11050
|
-
}
|
11051
|
-
}
|
11052
|
-
return removed;
|
11053
|
-
};
|
11054
|
-
}
|
11055
|
-
}
|
11056
|
-
if (!Array.isArray) {
|
11057
|
-
Array.isArray = function isArray(obj) {
|
11058
|
-
return _toString(obj) == "[object Array]";
|
11059
|
-
};
|
11060
|
-
}
|
11061
|
-
var boxedString = Object("a"),
|
11062
|
-
splitString = boxedString[0] != "a" || !(0 in boxedString);
|
11063
|
-
|
11064
|
-
if (!Array.prototype.forEach) {
|
11065
|
-
Array.prototype.forEach = function forEach(fun /*, thisp*/) {
|
11066
|
-
var object = toObject(this),
|
11067
|
-
self = splitString && _toString(this) == "[object String]" ?
|
11068
|
-
this.split("") :
|
11069
|
-
object,
|
11070
|
-
thisp = arguments[1],
|
11071
|
-
i = -1,
|
11072
|
-
length = self.length >>> 0;
|
11073
|
-
if (_toString(fun) != "[object Function]") {
|
11074
|
-
throw new TypeError(); // TODO message
|
11075
|
-
}
|
11076
|
-
|
11077
|
-
while (++i < length) {
|
11078
|
-
if (i in self) {
|
11079
|
-
fun.call(thisp, self[i], i, object);
|
11080
|
-
}
|
11081
|
-
}
|
11082
|
-
};
|
11083
|
-
}
|
11084
|
-
if (!Array.prototype.map) {
|
11085
|
-
Array.prototype.map = function map(fun /*, thisp*/) {
|
11086
|
-
var object = toObject(this),
|
11087
|
-
self = splitString && _toString(this) == "[object String]" ?
|
11088
|
-
this.split("") :
|
11089
|
-
object,
|
11090
|
-
length = self.length >>> 0,
|
11091
|
-
result = Array(length),
|
11092
|
-
thisp = arguments[1];
|
11093
|
-
if (_toString(fun) != "[object Function]") {
|
11094
|
-
throw new TypeError(fun + " is not a function");
|
11095
|
-
}
|
11096
|
-
|
11097
|
-
for (var i = 0; i < length; i++) {
|
11098
|
-
if (i in self)
|
11099
|
-
result[i] = fun.call(thisp, self[i], i, object);
|
11100
|
-
}
|
11101
|
-
return result;
|
11102
|
-
};
|
11103
|
-
}
|
11104
|
-
if (!Array.prototype.filter) {
|
11105
|
-
Array.prototype.filter = function filter(fun /*, thisp */) {
|
11106
|
-
var object = toObject(this),
|
11107
|
-
self = splitString && _toString(this) == "[object String]" ?
|
11108
|
-
this.split("") :
|
11109
|
-
object,
|
11110
|
-
length = self.length >>> 0,
|
11111
|
-
result = [],
|
11112
|
-
value,
|
11113
|
-
thisp = arguments[1];
|
11114
|
-
if (_toString(fun) != "[object Function]") {
|
11115
|
-
throw new TypeError(fun + " is not a function");
|
11116
|
-
}
|
11117
|
-
|
11118
|
-
for (var i = 0; i < length; i++) {
|
11119
|
-
if (i in self) {
|
11120
|
-
value = self[i];
|
11121
|
-
if (fun.call(thisp, value, i, object)) {
|
11122
|
-
result.push(value);
|
11123
|
-
}
|
11124
|
-
}
|
11125
|
-
}
|
11126
|
-
return result;
|
11127
|
-
};
|
11128
|
-
}
|
11129
|
-
if (!Array.prototype.every) {
|
11130
|
-
Array.prototype.every = function every(fun /*, thisp */) {
|
11131
|
-
var object = toObject(this),
|
11132
|
-
self = splitString && _toString(this) == "[object String]" ?
|
11133
|
-
this.split("") :
|
11134
|
-
object,
|
11135
|
-
length = self.length >>> 0,
|
11136
|
-
thisp = arguments[1];
|
11137
|
-
if (_toString(fun) != "[object Function]") {
|
11138
|
-
throw new TypeError(fun + " is not a function");
|
11139
|
-
}
|
11140
|
-
|
11141
|
-
for (var i = 0; i < length; i++) {
|
11142
|
-
if (i in self && !fun.call(thisp, self[i], i, object)) {
|
11143
|
-
return false;
|
11144
|
-
}
|
11145
|
-
}
|
11146
|
-
return true;
|
11147
|
-
};
|
11148
|
-
}
|
11149
|
-
if (!Array.prototype.some) {
|
11150
|
-
Array.prototype.some = function some(fun /*, thisp */) {
|
11151
|
-
var object = toObject(this),
|
11152
|
-
self = splitString && _toString(this) == "[object String]" ?
|
11153
|
-
this.split("") :
|
11154
|
-
object,
|
11155
|
-
length = self.length >>> 0,
|
11156
|
-
thisp = arguments[1];
|
11157
|
-
if (_toString(fun) != "[object Function]") {
|
11158
|
-
throw new TypeError(fun + " is not a function");
|
11159
|
-
}
|
11160
|
-
|
11161
|
-
for (var i = 0; i < length; i++) {
|
11162
|
-
if (i in self && fun.call(thisp, self[i], i, object)) {
|
11163
|
-
return true;
|
11164
|
-
}
|
11165
|
-
}
|
11166
|
-
return false;
|
11167
|
-
};
|
11168
|
-
}
|
11169
|
-
if (!Array.prototype.reduce) {
|
11170
|
-
Array.prototype.reduce = function reduce(fun /*, initial*/) {
|
11171
|
-
var object = toObject(this),
|
11172
|
-
self = splitString && _toString(this) == "[object String]" ?
|
11173
|
-
this.split("") :
|
11174
|
-
object,
|
11175
|
-
length = self.length >>> 0;
|
11176
|
-
if (_toString(fun) != "[object Function]") {
|
11177
|
-
throw new TypeError(fun + " is not a function");
|
11178
|
-
}
|
11179
|
-
if (!length && arguments.length == 1) {
|
11180
|
-
throw new TypeError("reduce of empty array with no initial value");
|
11181
|
-
}
|
11182
|
-
|
11183
|
-
var i = 0;
|
11184
|
-
var result;
|
11185
|
-
if (arguments.length >= 2) {
|
11186
|
-
result = arguments[1];
|
11187
|
-
} else {
|
11188
|
-
do {
|
11189
|
-
if (i in self) {
|
11190
|
-
result = self[i++];
|
11191
|
-
break;
|
11192
|
-
}
|
11193
|
-
if (++i >= length) {
|
11194
|
-
throw new TypeError("reduce of empty array with no initial value");
|
11195
|
-
}
|
11196
|
-
} while (true);
|
11197
|
-
}
|
11198
|
-
|
11199
|
-
for (; i < length; i++) {
|
11200
|
-
if (i in self) {
|
11201
|
-
result = fun.call(void 0, result, self[i], i, object);
|
11202
|
-
}
|
11203
|
-
}
|
11204
|
-
|
11205
|
-
return result;
|
11206
|
-
};
|
11207
|
-
}
|
11208
|
-
if (!Array.prototype.reduceRight) {
|
11209
|
-
Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
|
11210
|
-
var object = toObject(this),
|
11211
|
-
self = splitString && _toString(this) == "[object String]" ?
|
11212
|
-
this.split("") :
|
11213
|
-
object,
|
11214
|
-
length = self.length >>> 0;
|
11215
|
-
if (_toString(fun) != "[object Function]") {
|
11216
|
-
throw new TypeError(fun + " is not a function");
|
11217
|
-
}
|
11218
|
-
if (!length && arguments.length == 1) {
|
11219
|
-
throw new TypeError("reduceRight of empty array with no initial value");
|
11220
|
-
}
|
11221
|
-
|
11222
|
-
var result, i = length - 1;
|
11223
|
-
if (arguments.length >= 2) {
|
11224
|
-
result = arguments[1];
|
11225
|
-
} else {
|
11226
|
-
do {
|
11227
|
-
if (i in self) {
|
11228
|
-
result = self[i--];
|
11229
|
-
break;
|
11230
|
-
}
|
11231
|
-
if (--i < 0) {
|
11232
|
-
throw new TypeError("reduceRight of empty array with no initial value");
|
11233
|
-
}
|
11234
|
-
} while (true);
|
11235
|
-
}
|
11236
|
-
|
11237
|
-
do {
|
11238
|
-
if (i in this) {
|
11239
|
-
result = fun.call(void 0, result, self[i], i, object);
|
11240
|
-
}
|
11241
|
-
} while (i--);
|
11242
|
-
|
11243
|
-
return result;
|
11244
|
-
};
|
11245
|
-
}
|
11246
|
-
if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
|
11247
|
-
Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
|
11248
|
-
var self = splitString && _toString(this) == "[object String]" ?
|
11249
|
-
this.split("") :
|
11250
|
-
toObject(this),
|
11251
|
-
length = self.length >>> 0;
|
11252
|
-
|
11253
|
-
if (!length) {
|
11254
|
-
return -1;
|
11255
|
-
}
|
11256
|
-
|
11257
|
-
var i = 0;
|
11258
|
-
if (arguments.length > 1) {
|
11259
|
-
i = toInteger(arguments[1]);
|
11260
|
-
}
|
11261
|
-
i = i >= 0 ? i : Math.max(0, length + i);
|
11262
|
-
for (; i < length; i++) {
|
11263
|
-
if (i in self && self[i] === sought) {
|
11264
|
-
return i;
|
11265
|
-
}
|
11266
|
-
}
|
11267
|
-
return -1;
|
11268
|
-
};
|
11269
|
-
}
|
11270
|
-
if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
|
11271
|
-
Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
|
11272
|
-
var self = splitString && _toString(this) == "[object String]" ?
|
11273
|
-
this.split("") :
|
11274
|
-
toObject(this),
|
11275
|
-
length = self.length >>> 0;
|
11276
|
-
|
11277
|
-
if (!length) {
|
11278
|
-
return -1;
|
11279
|
-
}
|
11280
|
-
var i = length - 1;
|
11281
|
-
if (arguments.length > 1) {
|
11282
|
-
i = Math.min(i, toInteger(arguments[1]));
|
11283
|
-
}
|
11284
|
-
i = i >= 0 ? i : length - Math.abs(i);
|
11285
|
-
for (; i >= 0; i--) {
|
11286
|
-
if (i in self && sought === self[i]) {
|
11287
|
-
return i;
|
11288
|
-
}
|
11289
|
-
}
|
11290
|
-
return -1;
|
11291
|
-
};
|
11292
|
-
}
|
11293
|
-
if (!Object.getPrototypeOf) {
|
11294
|
-
Object.getPrototypeOf = function getPrototypeOf(object) {
|
11295
|
-
return object.__proto__ || (
|
11296
|
-
object.constructor ?
|
11297
|
-
object.constructor.prototype :
|
11298
|
-
prototypeOfObject
|
11299
|
-
);
|
11300
|
-
};
|
11301
|
-
}
|
11302
|
-
if (!Object.getOwnPropertyDescriptor) {
|
11303
|
-
var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
|
11304
|
-
"non-object: ";
|
11305
|
-
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
|
11306
|
-
if ((typeof object != "object" && typeof object != "function") || object === null)
|
11307
|
-
throw new TypeError(ERR_NON_OBJECT + object);
|
11308
|
-
if (!owns(object, property))
|
11309
|
-
return;
|
11310
|
-
|
11311
|
-
var descriptor, getter, setter;
|
11312
|
-
descriptor = { enumerable: true, configurable: true };
|
11313
|
-
if (supportsAccessors) {
|
11314
|
-
var prototype = object.__proto__;
|
11315
|
-
object.__proto__ = prototypeOfObject;
|
11316
|
-
|
11317
|
-
var getter = lookupGetter(object, property);
|
11318
|
-
var setter = lookupSetter(object, property);
|
11319
|
-
object.__proto__ = prototype;
|
11320
|
-
|
11321
|
-
if (getter || setter) {
|
11322
|
-
if (getter) descriptor.get = getter;
|
11323
|
-
if (setter) descriptor.set = setter;
|
11324
|
-
return descriptor;
|
11325
|
-
}
|
11326
|
-
}
|
11327
|
-
descriptor.value = object[property];
|
11328
|
-
return descriptor;
|
11329
|
-
};
|
11330
|
-
}
|
11331
|
-
if (!Object.getOwnPropertyNames) {
|
11332
|
-
Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
|
11333
|
-
return Object.keys(object);
|
11334
|
-
};
|
11335
|
-
}
|
11336
|
-
if (!Object.create) {
|
11337
|
-
var createEmpty;
|
11338
|
-
if (Object.prototype.__proto__ === null) {
|
11339
|
-
createEmpty = function () {
|
11340
|
-
return { "__proto__": null };
|
11341
|
-
};
|
11342
|
-
} else {
|
11343
|
-
createEmpty = function () {
|
11344
|
-
var empty = {};
|
11345
|
-
for (var i in empty)
|
11346
|
-
empty[i] = null;
|
11347
|
-
empty.constructor =
|
11348
|
-
empty.hasOwnProperty =
|
11349
|
-
empty.propertyIsEnumerable =
|
11350
|
-
empty.isPrototypeOf =
|
11351
|
-
empty.toLocaleString =
|
11352
|
-
empty.toString =
|
11353
|
-
empty.valueOf =
|
11354
|
-
empty.__proto__ = null;
|
11355
|
-
return empty;
|
11356
|
-
}
|
11357
|
-
}
|
11358
|
-
|
11359
|
-
Object.create = function create(prototype, properties) {
|
11360
|
-
var object;
|
11361
|
-
if (prototype === null) {
|
11362
|
-
object = createEmpty();
|
11363
|
-
} else {
|
11364
|
-
if (typeof prototype != "object")
|
11365
|
-
throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
|
11366
|
-
var Type = function () {};
|
11367
|
-
Type.prototype = prototype;
|
11368
|
-
object = new Type();
|
11369
|
-
object.__proto__ = prototype;
|
11370
|
-
}
|
11371
|
-
if (properties !== void 0)
|
11372
|
-
Object.defineProperties(object, properties);
|
11373
|
-
return object;
|
11374
|
-
};
|
11375
|
-
}
|
11376
|
-
|
11377
|
-
function doesDefinePropertyWork(object) {
|
11378
|
-
try {
|
11379
|
-
Object.defineProperty(object, "sentinel", {});
|
11380
|
-
return "sentinel" in object;
|
11381
|
-
} catch (exception) {
|
11382
|
-
}
|
11383
|
-
}
|
11384
|
-
if (Object.defineProperty) {
|
11385
|
-
var definePropertyWorksOnObject = doesDefinePropertyWork({});
|
11386
|
-
var definePropertyWorksOnDom = typeof document == "undefined" ||
|
11387
|
-
doesDefinePropertyWork(document.createElement("div"));
|
11388
|
-
if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
|
11389
|
-
var definePropertyFallback = Object.defineProperty;
|
11390
|
-
}
|
11391
|
-
}
|
11392
|
-
|
11393
|
-
if (!Object.defineProperty || definePropertyFallback) {
|
11394
|
-
var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
|
11395
|
-
var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
|
11396
|
-
var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
|
11397
|
-
"on this javascript engine";
|
11398
|
-
|
11399
|
-
Object.defineProperty = function defineProperty(object, property, descriptor) {
|
11400
|
-
if ((typeof object != "object" && typeof object != "function") || object === null)
|
11401
|
-
throw new TypeError(ERR_NON_OBJECT_TARGET + object);
|
11402
|
-
if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
|
11403
|
-
throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
|
11404
|
-
if (definePropertyFallback) {
|
11405
|
-
try {
|
11406
|
-
return definePropertyFallback.call(Object, object, property, descriptor);
|
11407
|
-
} catch (exception) {
|
11408
|
-
}
|
11409
|
-
}
|
11410
|
-
if (owns(descriptor, "value")) {
|
11411
|
-
|
11412
|
-
if (supportsAccessors && (lookupGetter(object, property) ||
|
11413
|
-
lookupSetter(object, property)))
|
11414
|
-
{
|
11415
|
-
var prototype = object.__proto__;
|
11416
|
-
object.__proto__ = prototypeOfObject;
|
11417
|
-
delete object[property];
|
11418
|
-
object[property] = descriptor.value;
|
11419
|
-
object.__proto__ = prototype;
|
11420
|
-
} else {
|
11421
|
-
object[property] = descriptor.value;
|
11422
|
-
}
|
11423
|
-
} else {
|
11424
|
-
if (!supportsAccessors)
|
11425
|
-
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
|
11426
|
-
if (owns(descriptor, "get"))
|
11427
|
-
defineGetter(object, property, descriptor.get);
|
11428
|
-
if (owns(descriptor, "set"))
|
11429
|
-
defineSetter(object, property, descriptor.set);
|
11430
|
-
}
|
11431
|
-
|
11432
|
-
return object;
|
11433
|
-
};
|
11434
|
-
}
|
11435
|
-
if (!Object.defineProperties) {
|
11436
|
-
Object.defineProperties = function defineProperties(object, properties) {
|
11437
|
-
for (var property in properties) {
|
11438
|
-
if (owns(properties, property))
|
11439
|
-
Object.defineProperty(object, property, properties[property]);
|
11440
|
-
}
|
11441
|
-
return object;
|
11442
|
-
};
|
11443
|
-
}
|
11444
|
-
if (!Object.seal) {
|
11445
|
-
Object.seal = function seal(object) {
|
11446
|
-
return object;
|
11447
|
-
};
|
11448
|
-
}
|
11449
|
-
if (!Object.freeze) {
|
11450
|
-
Object.freeze = function freeze(object) {
|
11451
|
-
return object;
|
11452
|
-
};
|
11453
|
-
}
|
11454
|
-
try {
|
11455
|
-
Object.freeze(function () {});
|
11456
|
-
} catch (exception) {
|
11457
|
-
Object.freeze = (function freeze(freezeObject) {
|
11458
|
-
return function freeze(object) {
|
11459
|
-
if (typeof object == "function") {
|
11460
|
-
return object;
|
11461
|
-
} else {
|
11462
|
-
return freezeObject(object);
|
11463
|
-
}
|
11464
|
-
};
|
11465
|
-
})(Object.freeze);
|
11466
|
-
}
|
11467
|
-
if (!Object.preventExtensions) {
|
11468
|
-
Object.preventExtensions = function preventExtensions(object) {
|
11469
|
-
return object;
|
11470
|
-
};
|
11471
|
-
}
|
11472
|
-
if (!Object.isSealed) {
|
11473
|
-
Object.isSealed = function isSealed(object) {
|
11474
|
-
return false;
|
11475
|
-
};
|
11476
|
-
}
|
11477
|
-
if (!Object.isFrozen) {
|
11478
|
-
Object.isFrozen = function isFrozen(object) {
|
11479
|
-
return false;
|
11480
|
-
};
|
11481
|
-
}
|
11482
|
-
if (!Object.isExtensible) {
|
11483
|
-
Object.isExtensible = function isExtensible(object) {
|
11484
|
-
if (Object(object) === object) {
|
11485
|
-
throw new TypeError(); // TODO message
|
11486
|
-
}
|
11487
|
-
var name = '';
|
11488
|
-
while (owns(object, name)) {
|
11489
|
-
name += '?';
|
11490
|
-
}
|
11491
|
-
object[name] = true;
|
11492
|
-
var returnValue = owns(object, name);
|
11493
|
-
delete object[name];
|
11494
|
-
return returnValue;
|
11495
|
-
};
|
11496
|
-
}
|
11497
|
-
if (!Object.keys) {
|
11498
|
-
var hasDontEnumBug = true,
|
11499
|
-
dontEnums = [
|
11500
|
-
"toString",
|
11501
|
-
"toLocaleString",
|
11502
|
-
"valueOf",
|
11503
|
-
"hasOwnProperty",
|
11504
|
-
"isPrototypeOf",
|
11505
|
-
"propertyIsEnumerable",
|
11506
|
-
"constructor"
|
11507
|
-
],
|
11508
|
-
dontEnumsLength = dontEnums.length;
|
11509
|
-
|
11510
|
-
for (var key in {"toString": null}) {
|
11511
|
-
hasDontEnumBug = false;
|
11512
|
-
}
|
11513
|
-
|
11514
|
-
Object.keys = function keys(object) {
|
11515
|
-
|
11516
|
-
if (
|
11517
|
-
(typeof object != "object" && typeof object != "function") ||
|
11518
|
-
object === null
|
11519
|
-
) {
|
11520
|
-
throw new TypeError("Object.keys called on a non-object");
|
11521
|
-
}
|
11522
|
-
|
11523
|
-
var keys = [];
|
11524
|
-
for (var name in object) {
|
11525
|
-
if (owns(object, name)) {
|
11526
|
-
keys.push(name);
|
11527
|
-
}
|
11528
|
-
}
|
11529
|
-
|
11530
|
-
if (hasDontEnumBug) {
|
11531
|
-
for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
|
11532
|
-
var dontEnum = dontEnums[i];
|
11533
|
-
if (owns(object, dontEnum)) {
|
11534
|
-
keys.push(dontEnum);
|
11535
|
-
}
|
11536
|
-
}
|
11537
|
-
}
|
11538
|
-
return keys;
|
11539
|
-
};
|
11540
|
-
|
11541
|
-
}
|
11542
|
-
if (!Date.now) {
|
11543
|
-
Date.now = function now() {
|
11544
|
-
return new Date().getTime();
|
11545
|
-
};
|
11546
|
-
}
|
11547
|
-
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003" +
|
11548
|
-
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
|
11549
|
-
"\u2029\uFEFF";
|
11550
|
-
if (!String.prototype.trim) {
|
11551
|
-
ws = "[" + ws + "]";
|
11552
|
-
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
|
11553
|
-
trimEndRegexp = new RegExp(ws + ws + "*$");
|
11554
|
-
String.prototype.trim = function trim() {
|
11555
|
-
return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
|
11556
|
-
};
|
11557
|
-
}
|
11558
|
-
|
11559
|
-
function toInteger(n) {
|
11560
|
-
n = +n;
|
11561
|
-
if (n !== n) { // isNaN
|
11562
|
-
n = 0;
|
11563
|
-
} else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
|
11564
|
-
n = (n > 0 || -1) * Math.floor(Math.abs(n));
|
11565
|
-
}
|
11566
|
-
return n;
|
11567
|
-
}
|
11568
|
-
|
11569
|
-
function isPrimitive(input) {
|
11570
|
-
var type = typeof input;
|
11571
|
-
return (
|
11572
|
-
input === null ||
|
11573
|
-
type === "undefined" ||
|
11574
|
-
type === "boolean" ||
|
11575
|
-
type === "number" ||
|
11576
|
-
type === "string"
|
11577
|
-
);
|
11578
|
-
}
|
11579
|
-
|
11580
|
-
function toPrimitive(input) {
|
11581
|
-
var val, valueOf, toString;
|
11582
|
-
if (isPrimitive(input)) {
|
11583
|
-
return input;
|
11584
|
-
}
|
11585
|
-
valueOf = input.valueOf;
|
11586
|
-
if (typeof valueOf === "function") {
|
11587
|
-
val = valueOf.call(input);
|
11588
|
-
if (isPrimitive(val)) {
|
11589
|
-
return val;
|
11590
|
-
}
|
11591
|
-
}
|
11592
|
-
toString = input.toString;
|
11593
|
-
if (typeof toString === "function") {
|
11594
|
-
val = toString.call(input);
|
11595
|
-
if (isPrimitive(val)) {
|
11596
|
-
return val;
|
11597
|
-
}
|
11598
|
-
}
|
11599
|
-
throw new TypeError();
|
11600
|
-
}
|
11601
|
-
var toObject = function (o) {
|
11602
|
-
if (o == null) { // this matches both null and undefined
|
11603
|
-
throw new TypeError("can't convert "+o+" to object");
|
11604
|
-
}
|
11605
|
-
return Object(o);
|
11606
|
-
};
|
11607
|
-
|
11608
|
-
});
|