mirror of https://github.com/apache/archiva.git
use knockout v2.1.0pre which has some nice perf improv with compiled binding cache
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1228033 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
230185791c
commit
f752ebe059
|
@ -1,13 +1,29 @@
|
|||
// Knockout JavaScript library v2.0.0
|
||||
// Knockout JavaScript library v2.1.0pre
|
||||
// (c) Steven Sanderson - http://knockoutjs.com/
|
||||
// License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
||||
|
||||
(function(window,undefined){
|
||||
var ko = window["ko"] = {};
|
||||
(function(window,document,navigator,undefined){
|
||||
!function(factory) {
|
||||
// Support AMD where available and opted in via define.amd.ko
|
||||
if (typeof define === 'function' && define['amd'] && define['amd']['ko']) {
|
||||
// Register as an AMD anonymous module
|
||||
define(['exports'], factory);
|
||||
} else {
|
||||
// AMD not in use (e.g., when referenced via aplain <script> tag) - put ko directly in global namespace
|
||||
factory(window['ko'] = {});
|
||||
}
|
||||
}(function(koExports){
|
||||
// Internally, all KO objects are attached to koExports (even the non-exported ones whose names will be minified by the closure compiler).
|
||||
// In the future, the following "ko" variable may be made distinct from "koExports" so that private objects are not externally reachable.
|
||||
var ko = typeof koExports !== 'undefined' ? koExports : {};
|
||||
// Google Closure Compiler helpers (used only to make the minified file smaller)
|
||||
ko.exportSymbol = function(publicPath, object) {
|
||||
var tokens = publicPath.split(".");
|
||||
var target = window;
|
||||
ko.exportSymbol = function(koPath, object) {
|
||||
var tokens = koPath.split(".");
|
||||
|
||||
// In the future, "ko" may become distinct from "koExports" (so that non-exported objects are not reachable)
|
||||
// At that point, "target" would be set to: (typeof koExports !== "undefined" ? koExports : ko)
|
||||
var target = ko;
|
||||
|
||||
for (var i = 0; i < tokens.length - 1; i++)
|
||||
target = target[tokens[i]];
|
||||
target[tokens[tokens.length - 1]] = object;
|
||||
|
@ -15,6 +31,7 @@ ko.exportSymbol = function(publicPath, object) {
|
|||
ko.exportProperty = function(owner, publicName, object) {
|
||||
owner[publicName] = object;
|
||||
};
|
||||
|
||||
ko.utils = new (function () {
|
||||
var stringTrimRegex = /^(\s|\u00A0)+|(\s|\u00A0)+$/g;
|
||||
|
||||
|
@ -182,17 +199,15 @@ ko.utils = new (function () {
|
|||
return string.substring(0, startsWith.length) === startsWith;
|
||||
},
|
||||
|
||||
evalWithinScope: function (expression /*, scope1, scope2, scope3... */) {
|
||||
buildEvalWithinScopeFunction: function (expression, scopeLevels) {
|
||||
// Build the source for a function that evaluates "expression"
|
||||
// For each scope variable, add an extra level of "with" nesting
|
||||
// Example result: with(sc[1]) { with(sc[0]) { return (expression) } }
|
||||
var scopes = Array.prototype.slice.call(arguments, 1);
|
||||
var functionBody = "return (" + expression + ")";
|
||||
for (var i = 0; i < scopes.length; i++) {
|
||||
if (scopes[i] && typeof scopes[i] == "object")
|
||||
functionBody = "with(sc[" + i + "]) { " + functionBody + " } ";
|
||||
for (var i = 0; i < scopeLevels; i++) {
|
||||
functionBody = "with(sc[" + i + "]) { " + functionBody + " } ";
|
||||
}
|
||||
return (new Function("sc", functionBody))(scopes);
|
||||
return new Function("sc", functionBody);
|
||||
},
|
||||
|
||||
domNodeIsContainedBy: function (node, containedByNode) {
|
||||
|
@ -318,7 +333,7 @@ ko.utils = new (function () {
|
|||
|
||||
if (ieVersion >= 9) {
|
||||
// Believe it or not, this actually fixes an IE9 rendering bug. Insane. https://github.com/SteveSanderson/knockout/issues/209
|
||||
element.innerHTML = element.innerHTML;
|
||||
element.style.display = element.style.display;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -414,30 +429,26 @@ ko.utils = new (function () {
|
|||
}
|
||||
})();
|
||||
|
||||
ko.exportSymbol('ko.utils', ko.utils);
|
||||
ko.utils.arrayForEach([
|
||||
['arrayForEach', ko.utils.arrayForEach],
|
||||
['arrayFirst', ko.utils.arrayFirst],
|
||||
['arrayFilter', ko.utils.arrayFilter],
|
||||
['arrayGetDistinctValues', ko.utils.arrayGetDistinctValues],
|
||||
['arrayIndexOf', ko.utils.arrayIndexOf],
|
||||
['arrayMap', ko.utils.arrayMap],
|
||||
['arrayPushAll', ko.utils.arrayPushAll],
|
||||
['arrayRemoveItem', ko.utils.arrayRemoveItem],
|
||||
['extend', ko.utils.extend],
|
||||
['fieldsIncludedWithJsonPost', ko.utils.fieldsIncludedWithJsonPost],
|
||||
['getFormFields', ko.utils.getFormFields],
|
||||
['postJson', ko.utils.postJson],
|
||||
['parseJson', ko.utils.parseJson],
|
||||
['registerEventHandler', ko.utils.registerEventHandler],
|
||||
['stringifyJson', ko.utils.stringifyJson],
|
||||
['range', ko.utils.range],
|
||||
['toggleDomNodeCssClass', ko.utils.toggleDomNodeCssClass],
|
||||
['triggerEvent', ko.utils.triggerEvent],
|
||||
['unwrapObservable', ko.utils.unwrapObservable]
|
||||
], function(item) {
|
||||
ko.exportSymbol('ko.utils.' + item[0], item[1]);
|
||||
});
|
||||
ko.exportSymbol('utils', ko.utils);
|
||||
ko.exportSymbol('utils.arrayForEach', ko.utils.arrayForEach);
|
||||
ko.exportSymbol('utils.arrayFirst', ko.utils.arrayFirst);
|
||||
ko.exportSymbol('utils.arrayFilter', ko.utils.arrayFilter);
|
||||
ko.exportSymbol('utils.arrayGetDistinctValues', ko.utils.arrayGetDistinctValues);
|
||||
ko.exportSymbol('utils.arrayIndexOf', ko.utils.arrayIndexOf);
|
||||
ko.exportSymbol('utils.arrayMap', ko.utils.arrayMap);
|
||||
ko.exportSymbol('utils.arrayPushAll', ko.utils.arrayPushAll);
|
||||
ko.exportSymbol('utils.arrayRemoveItem', ko.utils.arrayRemoveItem);
|
||||
ko.exportSymbol('utils.extend', ko.utils.extend);
|
||||
ko.exportSymbol('utils.fieldsIncludedWithJsonPost', ko.utils.fieldsIncludedWithJsonPost);
|
||||
ko.exportSymbol('utils.getFormFields', ko.utils.getFormFields);
|
||||
ko.exportSymbol('utils.postJson', ko.utils.postJson);
|
||||
ko.exportSymbol('utils.parseJson', ko.utils.parseJson);
|
||||
ko.exportSymbol('utils.registerEventHandler', ko.utils.registerEventHandler);
|
||||
ko.exportSymbol('utils.stringifyJson', ko.utils.stringifyJson);
|
||||
ko.exportSymbol('utils.range', ko.utils.range);
|
||||
ko.exportSymbol('utils.toggleDomNodeCssClass', ko.utils.toggleDomNodeCssClass);
|
||||
ko.exportSymbol('utils.triggerEvent', ko.utils.triggerEvent);
|
||||
ko.exportSymbol('utils.unwrapObservable', ko.utils.unwrapObservable);
|
||||
|
||||
if (!Function.prototype['bind']) {
|
||||
// Function.prototype.bind is a standard part of ECMAScript 5th Edition (December 2009, http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-262.pdf)
|
||||
|
@ -449,6 +460,7 @@ if (!Function.prototype['bind']) {
|
|||
};
|
||||
};
|
||||
}
|
||||
|
||||
ko.utils.domData = new (function () {
|
||||
var uniqueId = 0;
|
||||
var dataStoreKeyExpandoPropertyName = "__ko__" + (new Date).getTime();
|
||||
|
@ -488,8 +500,8 @@ ko.utils.domData = new (function () {
|
|||
}
|
||||
})();
|
||||
|
||||
ko.exportSymbol('ko.utils.domData', ko.utils.domData);
|
||||
ko.exportSymbol('ko.utils.domData.clear', ko.utils.domData.clear); // Exporting only so specs can clear up after themselves fully
|
||||
ko.exportSymbol('utils.domData', ko.utils.domData);
|
||||
ko.exportSymbol('utils.domData.clear', ko.utils.domData.clear); // Exporting only so specs can clear up after themselves fully
|
||||
ko.utils.domNodeDisposal = new (function () {
|
||||
var domDataKey = "__ko_domNodeDisposal__" + (new Date).getTime();
|
||||
|
||||
|
@ -561,11 +573,11 @@ ko.utils.domNodeDisposal = new (function () {
|
|||
})();
|
||||
ko.cleanNode = ko.utils.domNodeDisposal.cleanNode; // Shorthand name for convenience
|
||||
ko.removeNode = ko.utils.domNodeDisposal.removeNode; // Shorthand name for convenience
|
||||
ko.exportSymbol('ko.cleanNode', ko.cleanNode);
|
||||
ko.exportSymbol('ko.removeNode', ko.removeNode);
|
||||
ko.exportSymbol('ko.utils.domNodeDisposal', ko.utils.domNodeDisposal);
|
||||
ko.exportSymbol('ko.utils.domNodeDisposal.addDisposeCallback', ko.utils.domNodeDisposal.addDisposeCallback);
|
||||
ko.exportSymbol('ko.utils.domNodeDisposal.removeDisposeCallback', ko.utils.domNodeDisposal.removeDisposeCallback);(function () {
|
||||
ko.exportSymbol('cleanNode', ko.cleanNode);
|
||||
ko.exportSymbol('removeNode', ko.removeNode);
|
||||
ko.exportSymbol('utils.domNodeDisposal', ko.utils.domNodeDisposal);
|
||||
ko.exportSymbol('utils.domNodeDisposal.addDisposeCallback', ko.utils.domNodeDisposal.addDisposeCallback);
|
||||
ko.exportSymbol('utils.domNodeDisposal.removeDisposeCallback', ko.utils.domNodeDisposal.removeDisposeCallback);(function () {
|
||||
var leadingCommentRegex = /^(\s*)<!--(.*?)-->/;
|
||||
|
||||
function simpleHtmlParse(html) {
|
||||
|
@ -648,8 +660,9 @@ ko.exportSymbol('ko.utils.domNodeDisposal.removeDisposeCallback', ko.utils.domNo
|
|||
};
|
||||
})();
|
||||
|
||||
ko.exportSymbol('ko.utils.parseHtmlFragment', ko.utils.parseHtmlFragment);
|
||||
ko.exportSymbol('ko.utils.setHtml', ko.utils.setHtml);
|
||||
ko.exportSymbol('utils.parseHtmlFragment', ko.utils.parseHtmlFragment);
|
||||
ko.exportSymbol('utils.setHtml', ko.utils.setHtml);
|
||||
|
||||
ko.memoization = (function () {
|
||||
var memos = {};
|
||||
|
||||
|
@ -714,11 +727,11 @@ ko.memoization = (function () {
|
|||
};
|
||||
})();
|
||||
|
||||
ko.exportSymbol('ko.memoization', ko.memoization);
|
||||
ko.exportSymbol('ko.memoization.memoize', ko.memoization.memoize);
|
||||
ko.exportSymbol('ko.memoization.unmemoize', ko.memoization.unmemoize);
|
||||
ko.exportSymbol('ko.memoization.parseMemoText', ko.memoization.parseMemoText);
|
||||
ko.exportSymbol('ko.memoization.unmemoizeDomNodeAndDescendants', ko.memoization.unmemoizeDomNodeAndDescendants);
|
||||
ko.exportSymbol('memoization', ko.memoization);
|
||||
ko.exportSymbol('memoization.memoize', ko.memoization.memoize);
|
||||
ko.exportSymbol('memoization.unmemoize', ko.memoization.unmemoize);
|
||||
ko.exportSymbol('memoization.parseMemoText', ko.memoization.parseMemoText);
|
||||
ko.exportSymbol('memoization.unmemoizeDomNodeAndDescendants', ko.memoization.unmemoizeDomNodeAndDescendants);
|
||||
ko.extenders = {
|
||||
'throttle': function(target, timeout) {
|
||||
// Throttling means two things:
|
||||
|
@ -762,7 +775,8 @@ function applyExtenders(requestedExtenders) {
|
|||
return target;
|
||||
}
|
||||
|
||||
ko.exportSymbol('ko.extenders', ko.extenders);
|
||||
ko.exportSymbol('extenders', ko.extenders);
|
||||
|
||||
ko.subscription = function (callback, disposeCallback) {
|
||||
this.callback = callback;
|
||||
this.disposeCallback = disposeCallback;
|
||||
|
@ -828,8 +842,8 @@ ko.isSubscribable = function (instance) {
|
|||
return typeof instance.subscribe == "function" && typeof instance["notifySubscribers"] == "function";
|
||||
};
|
||||
|
||||
ko.exportSymbol('ko.subscribable', ko.subscribable);
|
||||
ko.exportSymbol('ko.isSubscribable', ko.isSubscribable);
|
||||
ko.exportSymbol('subscribable', ko.subscribable);
|
||||
ko.exportSymbol('isSubscribable', ko.isSubscribable);
|
||||
|
||||
ko.dependencyDetection = (function () {
|
||||
var _frames = [];
|
||||
|
@ -915,9 +929,9 @@ ko.isWriteableObservable = function (instance) {
|
|||
}
|
||||
|
||||
|
||||
ko.exportSymbol('ko.observable', ko.observable);
|
||||
ko.exportSymbol('ko.isObservable', ko.isObservable);
|
||||
ko.exportSymbol('ko.isWriteableObservable', ko.isWriteableObservable);
|
||||
ko.exportSymbol('observable', ko.observable);
|
||||
ko.exportSymbol('isObservable', ko.isObservable);
|
||||
ko.exportSymbol('isWriteableObservable', ko.isWriteableObservable);
|
||||
ko.observableArray = function (initialValues) {
|
||||
if (arguments.length == 0) {
|
||||
// Zero-parameter constructor initializes to empty array
|
||||
|
@ -1021,7 +1035,7 @@ ko.observableArray['fn'] = {
|
|||
|
||||
// Populate ko.observableArray.fn with read/write functions from native arrays
|
||||
ko.utils.arrayForEach(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (methodName) {
|
||||
ko.observableArray['fn'][methodName] = function () {
|
||||
ko.observableArray['fn'][methodName] = function () {
|
||||
var underlyingArray = this();
|
||||
this.valueWillMutate();
|
||||
var methodCallResult = underlyingArray[methodName].apply(underlyingArray, arguments);
|
||||
|
@ -1038,7 +1052,7 @@ ko.utils.arrayForEach(["slice"], function (methodName) {
|
|||
};
|
||||
});
|
||||
|
||||
ko.exportSymbol('ko.observableArray', ko.observableArray);
|
||||
ko.exportSymbol('observableArray', ko.observableArray);
|
||||
function prepareOptions(evaluatorFunctionOrOptions, evaluatorFunctionTarget, options) {
|
||||
if (evaluatorFunctionOrOptions && typeof evaluatorFunctionOrOptions == "object") {
|
||||
// Single-parameter syntax - everything is on this "options" param
|
||||
|
@ -1165,8 +1179,9 @@ ko.dependentObservable['fn'] = {
|
|||
|
||||
ko.dependentObservable.__ko_proto__ = ko.observable;
|
||||
|
||||
ko.exportSymbol('ko.dependentObservable', ko.dependentObservable);
|
||||
ko.exportSymbol('ko.computed', ko.dependentObservable); // Make "ko.computed" an alias for "ko.dependentObservable"
|
||||
ko.exportSymbol('dependentObservable', ko.dependentObservable);
|
||||
ko.exportSymbol('computed', ko.dependentObservable); // Make "ko.computed" an alias for "ko.dependentObservable"
|
||||
|
||||
(function() {
|
||||
var maxNestedObservableDepth = 10; // Escape the (unlikely) pathalogical case where an observable's current value is itself (or similar reference cycle)
|
||||
|
||||
|
@ -1251,8 +1266,8 @@ ko.exportSymbol('ko.computed', ko.dependentObservable); // Make "ko.computed" an
|
|||
};
|
||||
})();
|
||||
|
||||
ko.exportSymbol('ko.toJS', ko.toJS);
|
||||
ko.exportSymbol('ko.toJSON', ko.toJSON);(function () {
|
||||
ko.exportSymbol('toJS', ko.toJS);
|
||||
ko.exportSymbol('toJSON', ko.toJSON);(function () {
|
||||
var hasDomDataExpandoProperty = '__ko__hasDomDataOptionValue__';
|
||||
|
||||
// Normally, SELECT elements and their OPTIONs can only take value of type 'string' (because the values
|
||||
|
@ -1305,9 +1320,9 @@ ko.exportSymbol('ko.toJSON', ko.toJSON);(function () {
|
|||
};
|
||||
})();
|
||||
|
||||
ko.exportSymbol('ko.selectExtensions', ko.selectExtensions);
|
||||
ko.exportSymbol('ko.selectExtensions.readValue', ko.selectExtensions.readValue);
|
||||
ko.exportSymbol('ko.selectExtensions.writeValue', ko.selectExtensions.writeValue);
|
||||
ko.exportSymbol('selectExtensions', ko.selectExtensions);
|
||||
ko.exportSymbol('selectExtensions.readValue', ko.selectExtensions.readValue);
|
||||
ko.exportSymbol('selectExtensions.writeValue', ko.selectExtensions.writeValue);
|
||||
|
||||
ko.jsonExpressionRewriting = (function () {
|
||||
var restoreCapturedTokensRegex = /\@ko_token_(\d+)\@/g;
|
||||
|
@ -1476,10 +1491,10 @@ ko.jsonExpressionRewriting = (function () {
|
|||
};
|
||||
})();
|
||||
|
||||
ko.exportSymbol('ko.jsonExpressionRewriting', ko.jsonExpressionRewriting);
|
||||
ko.exportSymbol('ko.jsonExpressionRewriting.bindingRewriteValidators', ko.jsonExpressionRewriting.bindingRewriteValidators);
|
||||
ko.exportSymbol('ko.jsonExpressionRewriting.parseObjectLiteral', ko.jsonExpressionRewriting.parseObjectLiteral);
|
||||
ko.exportSymbol('ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson);
|
||||
ko.exportSymbol('jsonExpressionRewriting', ko.jsonExpressionRewriting);
|
||||
ko.exportSymbol('jsonExpressionRewriting.bindingRewriteValidators', ko.jsonExpressionRewriting.bindingRewriteValidators);
|
||||
ko.exportSymbol('jsonExpressionRewriting.parseObjectLiteral', ko.jsonExpressionRewriting.parseObjectLiteral);
|
||||
ko.exportSymbol('jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson);
|
||||
(function() {
|
||||
// "Virtual elements" is an abstraction on top of the usual DOM API which understands the notion that comment nodes
|
||||
// may be used to represent hierarchy (in addition to the DOM's natural hierarchy).
|
||||
|
@ -1680,7 +1695,9 @@ ko.exportSymbol('ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko
|
|||
(function() {
|
||||
var defaultBindingAttributeName = "data-bind";
|
||||
|
||||
ko.bindingProvider = function() { };
|
||||
ko.bindingProvider = function() {
|
||||
this.bindingCache = {};
|
||||
};
|
||||
|
||||
ko.utils.extend(ko.bindingProvider.prototype, {
|
||||
'nodeHasBindings': function(node) {
|
||||
|
@ -1710,9 +1727,10 @@ ko.exportSymbol('ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko
|
|||
// It's not part of the interface definition for a general binding provider.
|
||||
'parseBindingsString': function(bindingsString, bindingContext) {
|
||||
try {
|
||||
var viewModel = bindingContext['$data'];
|
||||
var rewrittenBindings = " { " + ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson(bindingsString) + " } ";
|
||||
return ko.utils.evalWithinScope(rewrittenBindings, viewModel === null ? window : viewModel, bindingContext);
|
||||
var viewModel = bindingContext['$data'],
|
||||
scopes = (typeof viewModel == 'object' && viewModel != null) ? [viewModel, bindingContext] : [bindingContext],
|
||||
bindingFunction = createBindingsStringEvaluatorViaCache(bindingsString, scopes.length, this.bindingCache);
|
||||
return bindingFunction(scopes);
|
||||
} catch (ex) {
|
||||
throw new Error("Unable to parse bindings.\nMessage: " + ex + ";\nBindings value: " + bindingsString);
|
||||
}
|
||||
|
@ -1720,9 +1738,21 @@ ko.exportSymbol('ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson', ko
|
|||
});
|
||||
|
||||
ko.bindingProvider['instance'] = new ko.bindingProvider();
|
||||
|
||||
function createBindingsStringEvaluatorViaCache(bindingsString, scopesCount, cache) {
|
||||
var cacheKey = scopesCount + '_' + bindingsString;
|
||||
return cache[cacheKey]
|
||||
|| (cache[cacheKey] = createBindingsStringEvaluator(bindingsString, scopesCount));
|
||||
}
|
||||
|
||||
function createBindingsStringEvaluator(bindingsString, scopesCount) {
|
||||
var rewrittenBindings = " { " + ko.jsonExpressionRewriting.insertPropertyAccessorsIntoJson(bindingsString) + " } ";
|
||||
return ko.utils.buildEvalWithinScopeFunction(rewrittenBindings, scopesCount);
|
||||
}
|
||||
})();
|
||||
|
||||
ko.exportSymbol('ko.bindingProvider', ko.bindingProvider);(function () {
|
||||
ko.exportSymbol('bindingProvider', ko.bindingProvider);
|
||||
(function () {
|
||||
ko.bindingHandlers = {};
|
||||
|
||||
ko.bindingContext = function(dataItem, parentBindingContext) {
|
||||
|
@ -1905,12 +1935,12 @@ ko.exportSymbol('ko.bindingProvider', ko.bindingProvider);(function () {
|
|||
return context ? context['$data'] : undefined;
|
||||
};
|
||||
|
||||
ko.exportSymbol('ko.bindingHandlers', ko.bindingHandlers);
|
||||
ko.exportSymbol('ko.applyBindings', ko.applyBindings);
|
||||
ko.exportSymbol('ko.applyBindingsToDescendants', ko.applyBindingsToDescendants);
|
||||
ko.exportSymbol('ko.applyBindingsToNode', ko.applyBindingsToNode);
|
||||
ko.exportSymbol('ko.contextFor', ko.contextFor);
|
||||
ko.exportSymbol('ko.dataFor', ko.dataFor);
|
||||
ko.exportSymbol('bindingHandlers', ko.bindingHandlers);
|
||||
ko.exportSymbol('applyBindings', ko.applyBindings);
|
||||
ko.exportSymbol('applyBindingsToDescendants', ko.applyBindingsToDescendants);
|
||||
ko.exportSymbol('applyBindingsToNode', ko.applyBindingsToNode);
|
||||
ko.exportSymbol('contextFor', ko.contextFor);
|
||||
ko.exportSymbol('dataFor', ko.dataFor);
|
||||
})();// For certain common events (currently just 'click'), allow a simplified data-binding syntax
|
||||
// e.g. click:handler instead of the usual full-length event:{click:handler}
|
||||
var eventHandlersWithShortcuts = ['click'];
|
||||
|
@ -2454,7 +2484,8 @@ ko.bindingHandlers['foreach'] = {
|
|||
};
|
||||
ko.jsonExpressionRewriting.bindingRewriteValidators['foreach'] = false; // Can't rewrite control flow bindings
|
||||
ko.virtualElements.allowedBindings['foreach'] = true;
|
||||
ko.exportSymbol('ko.allowedVirtualElementBindings', ko.virtualElements.allowedBindings);// If you want to make a custom template engine,
|
||||
ko.exportSymbol('allowedVirtualElementBindings', ko.virtualElements.allowedBindings);
|
||||
// If you want to make a custom template engine,
|
||||
//
|
||||
// [1] Inherit from this class (like ko.nativeTemplateEngine does)
|
||||
// [2] Override 'renderTemplateSource', supplying a function with this signature:
|
||||
|
@ -2535,7 +2566,8 @@ ko.templateEngine.prototype['rewriteTemplate'] = function (template, rewriterCal
|
|||
}
|
||||
};
|
||||
|
||||
ko.exportSymbol('ko.templateEngine', ko.templateEngine);
|
||||
ko.exportSymbol('templateEngine', ko.templateEngine);
|
||||
|
||||
ko.templateRewriting = (function () {
|
||||
var memoizeDataBindingAttributeSyntaxRegex = /(<[a-z]+\d*(\s+(?!data-bind=)[a-z0-9\-]+(=(\"[^\"]*\"|\'[^\']*\'))?)*\s+)data-bind=(["'])([\s\S]*?)\5/gi;
|
||||
var memoizeVirtualContainerBindingSyntaxRegex = /<!--\s*ko\b\s*([\s\S]*?)\s*-->/g;
|
||||
|
@ -2597,8 +2629,8 @@ ko.templateRewriting = (function () {
|
|||
}
|
||||
})();
|
||||
|
||||
ko.exportSymbol('ko.templateRewriting', ko.templateRewriting);
|
||||
ko.exportSymbol('ko.templateRewriting.applyMemoizedBindingsToNextSibling', ko.templateRewriting.applyMemoizedBindingsToNextSibling); // Exported only because it has to be referenced by string lookup from within rewritten template
|
||||
ko.exportSymbol('templateRewriting', ko.templateRewriting);
|
||||
ko.exportSymbol('templateRewriting.applyMemoizedBindingsToNextSibling', ko.templateRewriting.applyMemoizedBindingsToNextSibling); // Exported only because it has to be referenced by string lookup from within rewritten template
|
||||
(function() {
|
||||
// A template source represents a read/write way of accessing a template. This is to eliminate the need for template loading/saving
|
||||
// logic to be duplicated in every template engine (and means they can all work with anonymous templates, etc.)
|
||||
|
@ -2662,9 +2694,9 @@ ko.exportSymbol('ko.templateRewriting.applyMemoizedBindingsToNextSibling', ko.te
|
|||
}
|
||||
};
|
||||
|
||||
ko.exportSymbol('ko.templateSources', ko.templateSources);
|
||||
ko.exportSymbol('ko.templateSources.domElement', ko.templateSources.domElement);
|
||||
ko.exportSymbol('ko.templateSources.anonymousTemplate', ko.templateSources.anonymousTemplate);
|
||||
ko.exportSymbol('templateSources', ko.templateSources);
|
||||
ko.exportSymbol('templateSources.domElement', ko.templateSources.domElement);
|
||||
ko.exportSymbol('templateSources.anonymousTemplate', ko.templateSources.anonymousTemplate);
|
||||
})();
|
||||
(function () {
|
||||
var _templateEngine;
|
||||
|
@ -2888,8 +2920,9 @@ ko.exportSymbol('ko.templateRewriting.applyMemoizedBindingsToNextSibling', ko.te
|
|||
ko.virtualElements.allowedBindings['template'] = true;
|
||||
})();
|
||||
|
||||
ko.exportSymbol('ko.setTemplateEngine', ko.setTemplateEngine);
|
||||
ko.exportSymbol('ko.renderTemplate', ko.renderTemplate);
|
||||
ko.exportSymbol('setTemplateEngine', ko.setTemplateEngine);
|
||||
ko.exportSymbol('renderTemplate', ko.renderTemplate);
|
||||
|
||||
(function () {
|
||||
// Simple calculation based on Levenshtein distance.
|
||||
function calculateEditDistanceMatrix(oldArray, newArray, maxAllowedDistance) {
|
||||
|
@ -2971,7 +3004,7 @@ ko.exportSymbol('ko.renderTemplate', ko.renderTemplate);
|
|||
};
|
||||
})();
|
||||
|
||||
ko.exportSymbol('ko.utils.compareArrays', ko.utils.compareArrays);
|
||||
ko.exportSymbol('utils.compareArrays', ko.utils.compareArrays);
|
||||
|
||||
(function () {
|
||||
// Objective:
|
||||
|
@ -3126,7 +3159,7 @@ ko.exportSymbol('ko.utils.compareArrays', ko.utils.compareArrays);
|
|||
}
|
||||
})();
|
||||
|
||||
ko.exportSymbol('ko.utils.setDomNodeChildrenFromArrayMapping', ko.utils.setDomNodeChildrenFromArrayMapping);
|
||||
ko.exportSymbol('utils.setDomNodeChildrenFromArrayMapping', ko.utils.setDomNodeChildrenFromArrayMapping);
|
||||
ko.nativeTemplateEngine = function () {
|
||||
this['allowTemplateRewriting'] = false;
|
||||
}
|
||||
|
@ -3140,7 +3173,7 @@ ko.nativeTemplateEngine.prototype['renderTemplateSource'] = function (templateSo
|
|||
ko.nativeTemplateEngine.instance = new ko.nativeTemplateEngine();
|
||||
ko.setTemplateEngine(ko.nativeTemplateEngine.instance);
|
||||
|
||||
ko.exportSymbol('ko.nativeTemplateEngine', ko.nativeTemplateEngine);(function() {
|
||||
ko.exportSymbol('nativeTemplateEngine', ko.nativeTemplateEngine);(function() {
|
||||
ko.jqueryTmplTemplateEngine = function () {
|
||||
// Detect which version of jquery-tmpl you're using. Unfortunately jquery-tmpl
|
||||
// doesn't expose a version number, so we have to infer it.
|
||||
|
@ -3219,5 +3252,6 @@ ko.exportSymbol('ko.nativeTemplateEngine', ko.nativeTemplateEngine);(function()
|
|||
if (jqueryTmplTemplateEngineInstance.jQueryTmplVersion > 0)
|
||||
ko.setTemplateEngine(jqueryTmplTemplateEngineInstance);
|
||||
|
||||
ko.exportSymbol('ko.jqueryTmplTemplateEngine', ko.jqueryTmplTemplateEngine);
|
||||
})();})(window);
|
||||
ko.exportSymbol('jqueryTmplTemplateEngine', ko.jqueryTmplTemplateEngine);
|
||||
})();});
|
||||
})(window,document,navigator);
|
Loading…
Reference in New Issue