marko 4.25.0 → 4.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/markoc.js +18 -18
- package/dist/compiler/CompileContext.js +3 -8
- package/dist/core-tags/components/init-components-tag.js +1 -52
- package/dist/core-tags/components/package.json +1 -3
- package/dist/core-tags/components/preferred-script-location-tag.js +2 -2
- package/dist/core-tags/components/preserve-tag.js +1 -27
- package/dist/core-tags/core/await/AsyncValue.js +20 -20
- package/dist/core-tags/core/await/renderer.js +11 -12
- package/dist/core-tags/core/await/reorderer-renderer.js +11 -6
- package/dist/index.js +1 -39
- package/dist/node-require/index.js +11 -0
- package/dist/node_modules/@internal/components-beginComponent/index-browser.js +12 -0
- package/dist/{runtime/components/beginComponent.js → node_modules/@internal/components-beginComponent/index.js} +14 -14
- package/dist/node_modules/@internal/components-beginComponent/package.json +11 -0
- package/dist/{runtime/components/legacy/defineWidget-legacy-browser.js → node_modules/@internal/components-define-widget-legacy/index-browser.js} +47 -47
- package/dist/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
- package/dist/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
- package/dist/node_modules/@internal/components-endComponent/index.js +11 -0
- package/dist/node_modules/@internal/components-endComponent/package.json +11 -0
- package/dist/node_modules/@internal/components-entry/index-browser.js +9 -0
- package/dist/node_modules/@internal/components-entry/index.js +285 -0
- package/dist/node_modules/@internal/components-entry/package.json +11 -0
- package/dist/{runtime/components/legacy → node_modules/@internal/components-entry-legacy}/index-browser.js +14 -15
- package/dist/node_modules/@internal/components-entry-legacy/index.js +14 -0
- package/dist/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/dist/{runtime/components/init-components-browser.js → node_modules/@internal/components-registry/index-browser.js} +180 -79
- package/dist/node_modules/@internal/components-registry/index.js +34 -0
- package/dist/node_modules/@internal/components-registry/package.json +11 -0
- package/dist/{runtime/components/util-browser.js → node_modules/@internal/components-util/index-browser.js} +23 -24
- package/dist/{runtime/components/util.js → node_modules/@internal/components-util/index.js} +10 -12
- package/dist/node_modules/@internal/components-util/package.json +11 -0
- package/dist/node_modules/@internal/create-readable/index-browser.js +25 -0
- package/dist/node_modules/@internal/create-readable/index.js +52 -0
- package/dist/node_modules/@internal/create-readable/package.json +11 -0
- package/dist/node_modules/@internal/init-components-tag/index.js +52 -0
- package/dist/node_modules/@internal/init-components-tag/package.json +11 -0
- package/dist/{loader/index-default.js → node_modules/@internal/loader/index.js} +1 -1
- package/dist/node_modules/@internal/loader/package.json +11 -0
- package/dist/{core-tags/components/preserve-tag-browser.js → node_modules/@internal/preserve-tag/index-browser.js} +8 -8
- package/dist/node_modules/@internal/preserve-tag/index.js +27 -0
- package/dist/node_modules/@internal/preserve-tag/package.json +11 -0
- package/dist/node_modules/@internal/set-immediate/index-browser.js +17 -0
- package/dist/node_modules/@internal/set-immediate/index-worker.js +2 -0
- package/dist/node_modules/@internal/set-immediate/index.js +2 -0
- package/dist/node_modules/@internal/set-immediate/package.json +11 -0
- package/dist/runtime/RenderResult.js +24 -19
- package/dist/runtime/components/Component.js +154 -151
- package/dist/runtime/components/ComponentDef.js +28 -28
- package/dist/runtime/components/ComponentsContext.js +19 -19
- package/dist/runtime/components/GlobalComponentsContext.js +4 -4
- package/dist/runtime/components/KeySequence.js +3 -3
- package/dist/runtime/components/ServerComponent.js +13 -13
- package/dist/runtime/components/State.js +28 -28
- package/dist/runtime/components/attach-detach.js +9 -9
- package/dist/runtime/components/defineComponent.js +5 -5
- package/dist/runtime/components/dom-data.js +6 -6
- package/dist/runtime/components/event-delegation.js +15 -16
- package/dist/runtime/components/index.js +1 -285
- package/dist/runtime/components/legacy/browser.json +1 -1
- package/dist/runtime/components/legacy/defineComponent-legacy.js +1 -1
- package/dist/runtime/components/legacy/defineRenderer-legacy.js +18 -19
- package/dist/runtime/components/legacy/defineWidget-legacy.js +1 -18
- package/dist/runtime/components/legacy/dependencies/html.js +1 -1
- package/dist/runtime/components/legacy/dependencies/index.js +9 -9
- package/dist/runtime/components/legacy/helper-getWidgetFromOut.js +3 -3
- package/dist/runtime/components/legacy/index.js +1 -14
- package/dist/runtime/components/legacy/renderer-legacy.js +43 -43
- package/dist/runtime/components/registry.js +1 -34
- package/dist/runtime/components/renderer.js +38 -38
- package/dist/runtime/components/update-manager.js +10 -10
- package/dist/runtime/createOut.js +1 -1
- package/dist/runtime/dom-insert.js +6 -6
- package/dist/runtime/helpers/_change-case.js +2 -2
- package/dist/runtime/helpers/assign.js +3 -2
- package/dist/runtime/helpers/dynamic-tag.js +14 -16
- package/dist/runtime/helpers/load-template.js +1 -1
- package/dist/runtime/helpers/merge.js +3 -1
- package/dist/runtime/helpers/style-value.js +2 -2
- package/dist/runtime/html/AsyncStream.js +61 -52
- package/dist/runtime/html/BufferedWriter.js +5 -1
- package/dist/runtime/html/StringWriter.js +7 -3
- package/dist/runtime/html/helpers/_dynamic-attr.js +2 -2
- package/dist/runtime/html/helpers/attr.js +4 -4
- package/dist/runtime/html/helpers/attrs.js +3 -3
- package/dist/runtime/html/helpers/data-marko.js +4 -6
- package/dist/runtime/html/helpers/escape-quotes.js +2 -2
- package/dist/runtime/html/helpers/escape-xml.js +1 -1
- package/dist/runtime/html/helpers/props-script.js +1 -1
- package/dist/runtime/html/index.js +15 -12
- package/dist/runtime/renderable.js +5 -5
- package/dist/runtime/vdom/AsyncVDOMBuilder.js +102 -103
- package/dist/runtime/vdom/VComment.js +7 -7
- package/dist/runtime/vdom/VComponent.js +5 -5
- package/dist/runtime/vdom/VDocumentFragment.js +8 -8
- package/dist/runtime/vdom/VElement.js +55 -54
- package/dist/runtime/vdom/VFragment.js +9 -9
- package/dist/runtime/vdom/VNode.js +30 -30
- package/dist/runtime/vdom/VText.js +7 -7
- package/dist/runtime/vdom/helpers/v-element.js +1 -1
- package/dist/runtime/vdom/helpers/v-text.js +1 -1
- package/dist/runtime/vdom/index.js +12 -22
- package/dist/runtime/vdom/morphdom/fragment.js +5 -5
- package/dist/runtime/vdom/morphdom/helpers.js +3 -3
- package/dist/runtime/vdom/morphdom/index.js +72 -68
- package/dist/runtime/vdom/morphdom/specialElHandlers.js +8 -8
- package/dist/runtime/vdom/preserve-attrs.js +1 -1
- package/dist/runtime/vdom/vdom.js +19 -21
- package/docs/body-content.md +2 -2
- package/docs/class-components.md +3 -3
- package/docs/express.md +1 -1
- package/docs/lasso.md +3 -6
- package/docs/marko-v4.md +5 -5
- package/docs/redux.md +1 -1
- package/docs/server-side-rendering.md +2 -2
- package/docs/why-is-marko-fast.md +2 -10
- package/package.json +1 -1
- package/src/browser-refresh.js +2 -2
- package/src/compiler/CodeWriter.js +1 -3
- package/src/compiler/CompileContext.js +3 -8
- package/src/compiler/Compiler.js +4 -4
- package/src/compiler/HtmlJsParser.js +1 -1
- package/src/compiler/Migrator.js +1 -1
- package/src/compiler/Parser.js +3 -3
- package/src/compiler/ast/CustomTag.js +9 -11
- package/src/compiler/ast/HtmlAttribute/html/generateCode.js +2 -2
- package/src/compiler/ast/HtmlAttribute/index.js +1 -1
- package/src/compiler/ast/HtmlElement/vdom/HtmlElementVDOM.js +1 -1
- package/src/compiler/ast/HtmlElement/vdom/generateCode.js +1 -1
- package/src/compiler/ast/TemplateRoot.js +1 -1
- package/src/compiler/ast/Text/html/generateCode.js +3 -3
- package/src/compiler/ast/Text/vdom/generateCode.js +1 -1
- package/src/compiler/index.js +4 -4
- package/src/compiler/modules.js +4 -4
- package/src/compiler/util/finger-print.js +1 -1
- package/src/compiler/util/parseExpression.js +1 -1
- package/src/compiler/util/parseStatement.js +1 -1
- package/src/compiler/util/removeDashes.js +1 -1
- package/src/compiler/util/safeVarName.js +1 -1
- package/src/compiler/util/tokenizer.js +1 -1
- package/src/core-tags/cache/cached-fragment-tag-transformer.js +1 -1
- package/src/core-tags/cache/cached-fragment-tag.js +4 -4
- package/src/core-tags/cache/default-cache-manager.js +3 -3
- package/src/core-tags/components/TransformHelper/ComponentArgsCompiler.js +1 -1
- package/src/core-tags/components/TransformHelper/convertToComponent.js +1 -1
- package/src/core-tags/components/TransformHelper/handleComponentPreserveAttrs.js +1 -1
- package/src/core-tags/components/init-components-tag.js +1 -54
- package/src/core-tags/components/package.json +1 -3
- package/src/core-tags/components/preferred-script-location-tag.js +1 -1
- package/src/core-tags/components/preserve-tag.js +1 -27
- package/src/core-tags/components/util/getTransformHelper.js +1 -1
- package/src/core-tags/core/await/AsyncValue.js +3 -3
- package/src/core-tags/core/await/noop-render.js +1 -1
- package/src/core-tags/core/await/renderer.js +8 -7
- package/src/core-tags/core/await/reorderer-renderer.js +35 -14
- package/src/core-tags/core/await/transformer.js +1 -1
- package/src/core-tags/core/core-transformer.js +2 -2
- package/src/core-tags/migrate/all-tags/index.js +1 -1
- package/src/core-tags/migrate/all-templates/index.js +1 -1
- package/src/core-tags/migrate/include-tag.js +3 -2
- package/src/core-tags/migrate/util/parseFor.js +3 -2
- package/src/core-tags/migrate/util/printJS.js +1 -1
- package/src/defineRenderer.js +1 -1
- package/src/express.js +1 -1
- package/src/hot-reload.js +5 -5
- package/src/index.js +1 -41
- package/src/legacy-helpers/notEmpty.js +1 -1
- package/src/node-require/index.js +12 -1
- package/src/{runtime/components/beginComponent-browser.js → node_modules/@internal/components-beginComponent/index-browser.js} +1 -1
- package/src/{runtime/components/beginComponent.js → node_modules/@internal/components-beginComponent/index.js} +2 -2
- package/src/node_modules/@internal/components-beginComponent/package.json +11 -0
- package/src/{runtime/components/legacy/defineWidget-legacy-browser.js → node_modules/@internal/components-define-widget-legacy/index-browser.js} +21 -23
- package/src/node_modules/@internal/components-define-widget-legacy/index.js +18 -0
- package/src/node_modules/@internal/components-define-widget-legacy/package.json +11 -0
- package/src/{runtime/components/endComponent.js → node_modules/@internal/components-endComponent/index.js} +1 -1
- package/src/node_modules/@internal/components-endComponent/package.json +11 -0
- package/src/node_modules/@internal/components-entry/index-browser.js +9 -0
- package/src/node_modules/@internal/components-entry/index.js +301 -0
- package/src/node_modules/@internal/components-entry/package.json +11 -0
- package/src/node_modules/@internal/components-entry-legacy/index-browser.js +74 -0
- package/src/node_modules/@internal/components-entry-legacy/index.js +15 -0
- package/src/node_modules/@internal/components-entry-legacy/package.json +11 -0
- package/src/{runtime/components/init-components-browser.js → node_modules/@internal/components-registry/index-browser.js} +240 -75
- package/src/node_modules/@internal/components-registry/index.js +44 -0
- package/src/node_modules/@internal/components-registry/package.json +11 -0
- package/src/{runtime/components/util-browser.js → node_modules/@internal/components-util/index-browser.js} +11 -10
- package/src/{runtime/components/util.js → node_modules/@internal/components-util/index.js} +0 -2
- package/src/node_modules/@internal/components-util/package.json +11 -0
- package/src/node_modules/@internal/create-readable/index-browser.js +30 -0
- package/src/node_modules/@internal/create-readable/index.js +57 -0
- package/src/node_modules/@internal/create-readable/package.json +11 -0
- package/src/node_modules/@internal/init-components-tag/index.js +54 -0
- package/src/node_modules/@internal/init-components-tag/package.json +11 -0
- package/src/{loader/index-default.js → node_modules/@internal/loader/index.js} +2 -2
- package/src/node_modules/@internal/loader/package.json +11 -0
- package/src/node_modules/@internal/preserve-tag/index.js +27 -0
- package/src/node_modules/@internal/preserve-tag/package.json +11 -0
- package/src/node_modules/@internal/set-immediate/index-browser.js +17 -0
- package/src/node_modules/@internal/set-immediate/index-worker.js +2 -0
- package/src/node_modules/@internal/set-immediate/index.js +2 -0
- package/src/node_modules/@internal/set-immediate/package.json +11 -0
- package/src/runtime/RenderResult.js +20 -18
- package/src/runtime/components/Component.js +44 -41
- package/src/runtime/components/ComponentDef.js +9 -9
- package/src/runtime/components/ComponentsContext.js +4 -5
- package/src/runtime/components/GlobalComponentsContext.js +2 -1
- package/src/runtime/components/KeySequence.js +1 -1
- package/src/runtime/components/State.js +6 -6
- package/src/runtime/components/attach-detach.js +4 -4
- package/src/runtime/components/defineComponent.js +1 -1
- package/src/runtime/components/event-delegation.js +10 -10
- package/src/runtime/components/index.js +1 -301
- package/src/runtime/components/jquery.js +2 -2
- package/src/runtime/components/legacy/browser.json +1 -1
- package/src/runtime/components/legacy/defineRenderer-legacy.js +5 -6
- package/src/runtime/components/legacy/defineWidget-legacy.js +1 -18
- package/src/runtime/components/legacy/dependencies/html.js +1 -1
- package/src/runtime/components/legacy/dependencies/index.js +3 -3
- package/src/runtime/components/legacy/helper-getWidgetFromOut.js +3 -3
- package/src/runtime/components/legacy/index.js +1 -15
- package/src/runtime/components/legacy/renderer-legacy.js +7 -7
- package/src/runtime/components/ready.js +2 -2
- package/src/runtime/components/registry.js +1 -44
- package/src/runtime/components/renderer.js +4 -4
- package/src/runtime/components/update-manager.js +1 -1
- package/src/runtime/dom-insert.js +8 -8
- package/src/runtime/helpers/_weak-map.js +2 -2
- package/src/runtime/helpers/assign.js +3 -1
- package/src/runtime/helpers/bind-component.js +2 -2
- package/src/runtime/helpers/dynamic-tag.js +2 -4
- package/src/runtime/helpers/for-in.js +1 -1
- package/src/runtime/helpers/load-nested-tag.js +1 -1
- package/src/runtime/helpers/load-template.js +1 -1
- package/src/runtime/helpers/merge.js +3 -1
- package/src/runtime/helpers/noop.js +1 -1
- package/src/runtime/helpers/style-value.js +1 -1
- package/src/runtime/helpers/to-string.js +1 -1
- package/src/runtime/html/AsyncStream.js +90 -76
- package/src/runtime/html/BufferedWriter.js +6 -2
- package/src/runtime/html/StringWriter.js +15 -9
- package/src/runtime/html/helpers/attrs.js +3 -3
- package/src/runtime/html/helpers/data-marko.js +0 -2
- package/src/runtime/html/helpers/escape-quotes.js +1 -1
- package/src/runtime/html/helpers/escape-xml.js +1 -1
- package/src/runtime/html/index.js +23 -13
- package/src/runtime/queueMicrotask.js +2 -2
- package/src/runtime/renderable.js +9 -9
- package/src/runtime/vdom/AsyncVDOMBuilder.js +46 -51
- package/src/runtime/vdom/VComment.js +3 -3
- package/src/runtime/vdom/VDocumentFragment.js +3 -3
- package/src/runtime/vdom/VElement.js +17 -13
- package/src/runtime/vdom/VFragment.js +1 -1
- package/src/runtime/vdom/VNode.js +2 -2
- package/src/runtime/vdom/VText.js +3 -3
- package/src/runtime/vdom/helpers/attrs.js +1 -1
- package/src/runtime/vdom/helpers/const.js +2 -2
- package/src/runtime/vdom/helpers/v-element.js +1 -1
- package/src/runtime/vdom/helpers/v-text.js +1 -1
- package/src/runtime/vdom/index.js +21 -23
- package/src/runtime/vdom/morphdom/fragment.js +8 -7
- package/src/runtime/vdom/morphdom/index.js +19 -9
- package/src/runtime/vdom/morphdom/specialElHandlers.js +6 -6
- package/src/runtime/vdom/parse-html.js +4 -4
- package/src/runtime/vdom/preserve-attrs.js +1 -1
- package/src/runtime/vdom/vdom.js +5 -7
- package/src/taglib/taglib-finder/index.js +1 -1
- package/src/taglib/taglib-loader/Tag.js +5 -5
- package/src/taglib/taglib-loader/Taglib.js +2 -2
- package/src/taglib/taglib-loader/json-file-reader.js +1 -1
- package/src/taglib/taglib-loader/loadAttributeFromProps.js +1 -1
- package/src/taglib/taglib-loader/loadTagFromProps.js +5 -6
- package/src/taglib/taglib-loader/tag-def-from-code.js +2 -1
- package/src/taglib/taglib-lookup/TaglibLookup.js +2 -2
- package/src/taglib/taglib-lookup/index.js +1 -1
- package/dist/core-tags/core/await/client-reorder-browser.js +0 -1
- package/dist/core-tags/core/await/client-reorder-runtime.min.js +0 -5
- package/dist/core-tags/core/await/client-reorder.js +0 -11
- package/dist/core-tags/core/await/package.json +0 -6
- package/dist/index-browser.js +0 -4
- package/dist/loader/index.js +0 -7
- package/dist/loader/package.json +0 -5
- package/dist/node-require/index-browser.js +0 -1
- package/dist/package.json +0 -5
- package/dist/runtime/components/beginComponent-browser.js +0 -12
- package/dist/runtime/components/endComponent.js +0 -11
- package/dist/runtime/components/index-browser.js +0 -14
- package/dist/runtime/components/init-components.js +0 -1
- package/dist/runtime/components/legacy/package.json +0 -6
- package/dist/runtime/components/package.json +0 -12
- package/dist/runtime/components/registry-browser.js +0 -73
- package/dist/runtime/html/Template.js +0 -63
- package/dist/runtime/package.json +0 -5
- package/dist/runtime/setImmediate.js +0 -19
- package/src/core-tags/core/await/client-reorder-browser.js +0 -1
- package/src/core-tags/core/await/client-reorder-runtime.min.js +0 -1
- package/src/core-tags/core/await/client-reorder.js +0 -14
- package/src/core-tags/core/await/package.json +0 -6
- package/src/index-browser.js +0 -3
- package/src/loader/index.js +0 -7
- package/src/loader/package.json +0 -5
- package/src/node-require/index-browser.js +0 -1
- package/src/package.json +0 -5
- package/src/runtime/components/index-browser.js +0 -15
- package/src/runtime/components/init-components.js +0 -1
- package/src/runtime/components/legacy/index-browser.js +0 -73
- package/src/runtime/components/legacy/package.json +0 -6
- package/src/runtime/components/package.json +0 -12
- package/src/runtime/components/registry-browser.js +0 -103
- package/src/runtime/html/Template.js +0 -62
- package/src/runtime/package.json +0 -5
- package/src/runtime/setImmediate.js +0 -21
- /package/dist/{runtime/components/endComponent-browser.js → node_modules/@internal/components-endComponent/index-browser.js} +0 -0
- /package/dist/{core-tags/components/init-components-tag-browser.js → node_modules/@internal/init-components-tag/index-browser.js} +0 -0
- /package/dist/{loader → node_modules/@internal/loader}/index-browser.js +0 -0
- /package/src/{runtime/components/endComponent-browser.js → node_modules/@internal/components-endComponent/index-browser.js} +0 -0
- /package/src/{core-tags/components/init-components-tag-browser.js → node_modules/@internal/init-components-tag/index-browser.js} +0 -0
- /package/src/{loader → node_modules/@internal/loader}/index-browser.js +0 -0
- /package/src/{core-tags/components/preserve-tag-browser.js → node_modules/@internal/preserve-tag/index-browser.js} +0 -0
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
var complain = "MARKO_DEBUG" && require("complain");
|
|
4
4
|
var domData = require("../components/dom-data");
|
|
5
|
-
var componentsUtil = require("
|
|
5
|
+
var componentsUtil = require("@internal/components-util");
|
|
6
6
|
var vElementByDOMNode = domData.___vElementByDOMNode;
|
|
7
7
|
var VNode = require("./VNode");
|
|
8
8
|
var inherit = require("raptor-util/inherit");
|
|
9
9
|
var ATTR_XLINK_HREF = "xlink:href";
|
|
10
10
|
var xmlnsRegExp = /^xmlns(:|$)/;
|
|
11
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
11
12
|
var NS_XLINK = "http://www.w3.org/1999/xlink";
|
|
12
13
|
var NS_HTML = "http://www.w3.org/1999/xhtml";
|
|
13
14
|
var NS_MATH = "http://www.w3.org/1998/Math/MathML";
|
|
@@ -50,7 +51,7 @@ function convertAttrValue(type, value) {
|
|
|
50
51
|
|
|
51
52
|
function assign(a, b) {
|
|
52
53
|
for (var key in b) {
|
|
53
|
-
if (
|
|
54
|
+
if (hasOwnProperty.call(b, key)) {
|
|
54
55
|
a[key] = b[key];
|
|
55
56
|
}
|
|
56
57
|
}
|
|
@@ -117,7 +118,7 @@ function VElement(
|
|
|
117
118
|
VElement.prototype = {
|
|
118
119
|
___nodeType: 1,
|
|
119
120
|
|
|
120
|
-
___cloneNode: function() {
|
|
121
|
+
___cloneNode: function () {
|
|
121
122
|
return new VElementClone(this);
|
|
122
123
|
},
|
|
123
124
|
|
|
@@ -128,7 +129,7 @@ VElement.prototype = {
|
|
|
128
129
|
* @param {int|null} attrCount The number of attributes (or `null` if not known)
|
|
129
130
|
* @param {int|null} childCount The number of child nodes (or `null` if not known)
|
|
130
131
|
*/
|
|
131
|
-
e: function(tagName, attrs, key, ownerComponent, childCount, flags, props) {
|
|
132
|
+
e: function (tagName, attrs, key, ownerComponent, childCount, flags, props) {
|
|
132
133
|
var child = this.___appendChild(
|
|
133
134
|
new VElement(
|
|
134
135
|
tagName,
|
|
@@ -154,20 +155,23 @@ VElement.prototype = {
|
|
|
154
155
|
*
|
|
155
156
|
* @param {String} value The value for the new Comment node
|
|
156
157
|
*/
|
|
157
|
-
n: function(node, ownerComponent) {
|
|
158
|
+
n: function (node, ownerComponent) {
|
|
158
159
|
node = node.___cloneNode();
|
|
159
160
|
node.___ownerComponent = ownerComponent;
|
|
160
161
|
this.___appendChild(node);
|
|
161
162
|
return this.___finishChild();
|
|
162
163
|
},
|
|
163
164
|
|
|
164
|
-
___actualize: function(
|
|
165
|
+
___actualize: function (host, parentNamespaceURI) {
|
|
165
166
|
var tagName = this.___nodeName;
|
|
166
167
|
var attributes = this.___attributes;
|
|
167
168
|
var namespaceURI = DEFAULT_NS[tagName] || parentNamespaceURI || NS_HTML;
|
|
168
169
|
|
|
169
170
|
var flags = this.___flags;
|
|
170
|
-
var el =
|
|
171
|
+
var el = (host.ownerDocument || host).createElementNS(
|
|
172
|
+
namespaceURI,
|
|
173
|
+
tagName
|
|
174
|
+
);
|
|
171
175
|
|
|
172
176
|
if (flags & FLAG_CUSTOM_ELEMENT) {
|
|
173
177
|
assign(el, attributes);
|
|
@@ -202,7 +206,7 @@ VElement.prototype = {
|
|
|
202
206
|
return el;
|
|
203
207
|
},
|
|
204
208
|
|
|
205
|
-
___hasAttribute: function(name) {
|
|
209
|
+
___hasAttribute: function (name) {
|
|
206
210
|
// We don't care about the namespaces since the there
|
|
207
211
|
// is no chance that attributes with the same name will have
|
|
208
212
|
// different namespaces
|
|
@@ -215,9 +219,9 @@ inherit(VElement, VNode);
|
|
|
215
219
|
|
|
216
220
|
var proto = (VElementClone.prototype = VElement.prototype);
|
|
217
221
|
|
|
218
|
-
["checked", "selected", "disabled"].forEach(function(name) {
|
|
222
|
+
["checked", "selected", "disabled"].forEach(function (name) {
|
|
219
223
|
defineProperty(proto, name, {
|
|
220
|
-
get: function() {
|
|
224
|
+
get: function () {
|
|
221
225
|
var value = this.___attributes[name];
|
|
222
226
|
return value !== false && value != null;
|
|
223
227
|
}
|
|
@@ -225,7 +229,7 @@ var proto = (VElementClone.prototype = VElement.prototype);
|
|
|
225
229
|
});
|
|
226
230
|
|
|
227
231
|
defineProperty(proto, "___value", {
|
|
228
|
-
get: function() {
|
|
232
|
+
get: function () {
|
|
229
233
|
var value = this.___valueInternal;
|
|
230
234
|
if (value == null) {
|
|
231
235
|
value = this.___attributes.value;
|
|
@@ -239,7 +243,7 @@ defineProperty(proto, "___value", {
|
|
|
239
243
|
}
|
|
240
244
|
});
|
|
241
245
|
|
|
242
|
-
VElement.___removePreservedAttributes = function(attrs) {
|
|
246
|
+
VElement.___removePreservedAttributes = function (attrs) {
|
|
243
247
|
// By default this static method is a no-op, but if there are any
|
|
244
248
|
// compiled components that have "no-update" attributes then
|
|
245
249
|
// `preserve-attrs.js` will be imported and this method will be replaced
|
|
@@ -298,7 +302,7 @@ function virtualizeElement(node, virtualizeChildNodes, ownerComponent) {
|
|
|
298
302
|
|
|
299
303
|
VElement.___virtualize = virtualizeElement;
|
|
300
304
|
|
|
301
|
-
VElement.___morphAttrs = function(fromEl, vFromEl, toEl) {
|
|
305
|
+
VElement.___morphAttrs = function (fromEl, vFromEl, toEl) {
|
|
302
306
|
var removePreservedAttributes = VElement.___removePreservedAttributes;
|
|
303
307
|
|
|
304
308
|
var fromFlags = vFromEl.___flags;
|
|
@@ -13,7 +13,7 @@ function VFragment(key, ownerComponent, preserve) {
|
|
|
13
13
|
|
|
14
14
|
VFragment.prototype = {
|
|
15
15
|
___nodeType: 12,
|
|
16
|
-
___actualize: function() {
|
|
16
|
+
___actualize: function () {
|
|
17
17
|
var fragment = createFragmentNode();
|
|
18
18
|
keysByDOMNode.set(fragment, this.___key);
|
|
19
19
|
vElementByDOMNode.set(fragment, this);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
function VNode() {}
|
|
3
3
|
|
|
4
4
|
VNode.prototype = {
|
|
5
|
-
___VNode: function(finalChildCount, ownerComponent) {
|
|
5
|
+
___VNode: function (finalChildCount, ownerComponent) {
|
|
6
6
|
this.___finalChildCount = finalChildCount;
|
|
7
7
|
this.___childCount = 0;
|
|
8
8
|
this.___firstChildInternal = null;
|
|
@@ -45,7 +45,7 @@ VNode.prototype = {
|
|
|
45
45
|
return nextSibling;
|
|
46
46
|
},
|
|
47
47
|
|
|
48
|
-
___appendChild: function(child) {
|
|
48
|
+
___appendChild: function (child) {
|
|
49
49
|
this.___childCount++;
|
|
50
50
|
|
|
51
51
|
if (this.___nodeName === "textarea") {
|
|
@@ -11,11 +11,11 @@ VText.prototype = {
|
|
|
11
11
|
|
|
12
12
|
___nodeType: 3,
|
|
13
13
|
|
|
14
|
-
___actualize: function(
|
|
15
|
-
return
|
|
14
|
+
___actualize: function (host) {
|
|
15
|
+
return (host.ownerDocument || host).createTextNode(this.___nodeValue);
|
|
16
16
|
},
|
|
17
17
|
|
|
18
|
-
___cloneNode: function() {
|
|
18
|
+
___cloneNode: function () {
|
|
19
19
|
return new VText(this.___nodeValue);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
@@ -8,7 +8,7 @@ var parseHTML = require("../parse-html");
|
|
|
8
8
|
/**
|
|
9
9
|
* Helper for processing dynamic attributes
|
|
10
10
|
*/
|
|
11
|
-
module.exports = function(attributes) {
|
|
11
|
+
module.exports = function (attributes) {
|
|
12
12
|
if (typeof attributes === "string") {
|
|
13
13
|
// eslint-disable-next-line no-constant-condition
|
|
14
14
|
if ("MARKO_DEBUG") {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
require("../../");
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
typeof window === "object" &&
|
|
4
|
+
(window.Marko = {
|
|
5
|
+
Component: function () {}
|
|
6
|
+
});
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
9
|
* Method is for internal usage only. This method
|
|
@@ -12,27 +11,26 @@ var makeRenderable = require("../renderable");
|
|
|
12
11
|
* it is used to create a new Template instance.
|
|
13
12
|
* @private
|
|
14
13
|
*/
|
|
15
|
-
exports.t = function createTemplate(
|
|
16
|
-
return new Template(
|
|
14
|
+
exports.t = function createTemplate(typeName) {
|
|
15
|
+
return new Template(typeName);
|
|
17
16
|
};
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
exports.Template = Template;
|
|
19
|
+
function Template(typeName, func) {
|
|
20
|
+
this.path = typeName;
|
|
21
21
|
this._ = func;
|
|
22
22
|
this.meta = undefined;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
require("../createOut").___setCreateOut(createOut);
|
|
25
|
+
var AsyncVDOMBuilder = require("./AsyncVDOMBuilder");
|
|
26
|
+
require("../createOut").___setCreateOut(
|
|
27
|
+
(Template.prototype.createOut = function createOut(
|
|
28
|
+
globalData,
|
|
29
|
+
parent,
|
|
30
|
+
parentOut
|
|
31
|
+
) {
|
|
32
|
+
return new AsyncVDOMBuilder(globalData, parent, parentOut);
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
require("../renderable")(Template.prototype);
|
|
@@ -37,7 +37,7 @@ var fragmentPrototype = {
|
|
|
37
37
|
nodes.push(current);
|
|
38
38
|
return nodes;
|
|
39
39
|
},
|
|
40
|
-
insertBefore: function(newChildNode, referenceNode) {
|
|
40
|
+
insertBefore: function (newChildNode, referenceNode) {
|
|
41
41
|
var actualReference = referenceNode == null ? this.endNode : referenceNode;
|
|
42
42
|
return insertBefore(
|
|
43
43
|
newChildNode,
|
|
@@ -45,14 +45,14 @@ var fragmentPrototype = {
|
|
|
45
45
|
this.startNode.parentNode
|
|
46
46
|
);
|
|
47
47
|
},
|
|
48
|
-
insertInto: function(newParentNode, referenceNode) {
|
|
49
|
-
this.nodes.forEach(function(node) {
|
|
48
|
+
insertInto: function (newParentNode, referenceNode) {
|
|
49
|
+
this.nodes.forEach(function (node) {
|
|
50
50
|
insertBefore(node, referenceNode, newParentNode);
|
|
51
51
|
}, this);
|
|
52
52
|
return this;
|
|
53
53
|
},
|
|
54
|
-
remove: function() {
|
|
55
|
-
this.nodes.forEach(function(node) {
|
|
54
|
+
remove: function () {
|
|
55
|
+
this.nodes.forEach(function (node) {
|
|
56
56
|
this.detachedContainer.appendChild(node);
|
|
57
57
|
}, this);
|
|
58
58
|
}
|
|
@@ -69,7 +69,8 @@ function createFragmentNode(startNode, nextNode, parentNode) {
|
|
|
69
69
|
: document.createTextNode("");
|
|
70
70
|
fragment.startNode.fragment = fragment;
|
|
71
71
|
fragment.endNode.fragment = fragment;
|
|
72
|
-
var detachedContainer = (fragment.detachedContainer =
|
|
72
|
+
var detachedContainer = (fragment.detachedContainer =
|
|
73
|
+
document.createDocumentFragment());
|
|
73
74
|
parentNode =
|
|
74
75
|
parentNode || (startNode && startNode.parentNode) || detachedContainer;
|
|
75
76
|
insertBefore(fragment.startNode, startNode, parentNode);
|
|
@@ -79,7 +80,7 @@ function createFragmentNode(startNode, nextNode, parentNode) {
|
|
|
79
80
|
|
|
80
81
|
function beginFragmentNode(startNode, parentNode) {
|
|
81
82
|
var fragment = createFragmentNode(startNode, null, parentNode);
|
|
82
|
-
fragment.___finishFragment = function(nextNode) {
|
|
83
|
+
fragment.___finishFragment = function (nextNode) {
|
|
83
84
|
fragment.___finishFragment = null;
|
|
84
85
|
insertBefore(
|
|
85
86
|
fragment.endNode,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var specialElHandlers = require("./specialElHandlers");
|
|
3
3
|
var KeySequence = require("../../components/KeySequence");
|
|
4
|
-
var componentsUtil = require("
|
|
4
|
+
var componentsUtil = require("@internal/components-util");
|
|
5
5
|
var existingComponentLookup = componentsUtil.___componentLookup;
|
|
6
6
|
var destroyNodeRecursive = componentsUtil.___destroyNodeRecursive;
|
|
7
7
|
var addComponentRootToKeyedElements =
|
|
@@ -56,7 +56,7 @@ function onNodeAdded(node, componentsContext) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
function morphdom(fromNode, toNode,
|
|
59
|
+
function morphdom(fromNode, toNode, host, componentsContext) {
|
|
60
60
|
var globalComponentsContext;
|
|
61
61
|
var isHydrate = false;
|
|
62
62
|
var keySequences = Object.create(null);
|
|
@@ -74,7 +74,7 @@ function morphdom(fromNode, toNode, doc, componentsContext) {
|
|
|
74
74
|
ownerComponent,
|
|
75
75
|
parentComponent
|
|
76
76
|
) {
|
|
77
|
-
var realNode = vNode.___actualize(
|
|
77
|
+
var realNode = vNode.___actualize(host, parentEl.namespaceURI);
|
|
78
78
|
insertBefore(realNode, referenceEl, parentEl);
|
|
79
79
|
|
|
80
80
|
if (
|
|
@@ -321,9 +321,8 @@ function morphdom(fromNode, toNode, doc, componentsContext) {
|
|
|
321
321
|
curVFromNodeChild = virtualizeElement(curFromNodeChild);
|
|
322
322
|
curVFromNodeChild.___nodeName = curToNodeChild.___nodeName;
|
|
323
323
|
keysByDOMNode.set(curFromNodeChild, curToNodeKey);
|
|
324
|
-
referenceComponent.___keyedElements[
|
|
325
|
-
|
|
326
|
-
] = curFromNodeChild;
|
|
324
|
+
referenceComponent.___keyedElements[curToNodeKey] =
|
|
325
|
+
curFromNodeChild;
|
|
327
326
|
|
|
328
327
|
if (curToNodeChild.___preserve) {
|
|
329
328
|
vElementByDOMNode.set(curFromNodeChild, curVFromNodeChild);
|
|
@@ -565,6 +564,17 @@ function morphdom(fromNode, toNode, doc, componentsContext) {
|
|
|
565
564
|
isCompatible = true;
|
|
566
565
|
// Simply update nodeValue on the original node to
|
|
567
566
|
// change the text value
|
|
567
|
+
|
|
568
|
+
if (
|
|
569
|
+
isHydrate === true &&
|
|
570
|
+
toNextSibling &&
|
|
571
|
+
curFromNodeType === TEXT_NODE &&
|
|
572
|
+
toNextSibling.___nodeType === TEXT_NODE
|
|
573
|
+
) {
|
|
574
|
+
fromNextSibling = curFromNodeChild.splitText(
|
|
575
|
+
curToNodeChild.___nodeValue.length
|
|
576
|
+
);
|
|
577
|
+
}
|
|
568
578
|
if (curFromNodeChild.nodeValue !== curToNodeChild.___nodeValue) {
|
|
569
579
|
curFromNodeChild.nodeValue = curToNodeChild.___nodeValue;
|
|
570
580
|
}
|
|
@@ -668,12 +678,12 @@ function morphdom(fromNode, toNode, doc, componentsContext) {
|
|
|
668
678
|
|
|
669
679
|
// eslint-disable-next-line no-constant-condition
|
|
670
680
|
if ("MARKO_DEBUG") {
|
|
671
|
-
componentsUtil.___stopDOMManipulationWarning();
|
|
681
|
+
componentsUtil.___stopDOMManipulationWarning(host);
|
|
672
682
|
}
|
|
673
683
|
|
|
674
684
|
morphChildren(fromNode, toNode, toNode.___component);
|
|
675
685
|
|
|
676
|
-
detachedNodes.forEach(function(node) {
|
|
686
|
+
detachedNodes.forEach(function (node) {
|
|
677
687
|
var detachedFromComponent = detachedByDOMNode.get(node);
|
|
678
688
|
|
|
679
689
|
if (detachedFromComponent !== undefined) {
|
|
@@ -697,7 +707,7 @@ function morphdom(fromNode, toNode, doc, componentsContext) {
|
|
|
697
707
|
|
|
698
708
|
// eslint-disable-next-line no-constant-condition
|
|
699
709
|
if ("MARKO_DEBUG") {
|
|
700
|
-
componentsUtil.___startDOMManipulationWarning();
|
|
710
|
+
componentsUtil.___startDOMManipulationWarning(host);
|
|
701
711
|
}
|
|
702
712
|
}
|
|
703
713
|
|
|
@@ -32,10 +32,10 @@ SpecialElHandlers.prototype = {
|
|
|
32
32
|
* Needed for IE. Apparently IE doesn't think that "selected" is an
|
|
33
33
|
* attribute when reading over the attributes using selectEl.attributes
|
|
34
34
|
*/
|
|
35
|
-
option: function(fromEl, toEl) {
|
|
35
|
+
option: function (fromEl, toEl) {
|
|
36
36
|
syncBooleanAttrProp(fromEl, toEl, "selected");
|
|
37
37
|
},
|
|
38
|
-
button: function(fromEl, toEl) {
|
|
38
|
+
button: function (fromEl, toEl) {
|
|
39
39
|
syncBooleanAttrProp(fromEl, toEl, "disabled");
|
|
40
40
|
},
|
|
41
41
|
/**
|
|
@@ -44,7 +44,7 @@ SpecialElHandlers.prototype = {
|
|
|
44
44
|
* "value" property will have no effect since it is only used to the set the
|
|
45
45
|
* initial value. Similar for the "checked" attribute, and "disabled".
|
|
46
46
|
*/
|
|
47
|
-
input: function(fromEl, toEl) {
|
|
47
|
+
input: function (fromEl, toEl) {
|
|
48
48
|
syncBooleanAttrProp(fromEl, toEl, "checked");
|
|
49
49
|
syncBooleanAttrProp(fromEl, toEl, "disabled");
|
|
50
50
|
|
|
@@ -57,7 +57,7 @@ SpecialElHandlers.prototype = {
|
|
|
57
57
|
}
|
|
58
58
|
},
|
|
59
59
|
|
|
60
|
-
textarea: function(fromEl, toEl) {
|
|
60
|
+
textarea: function (fromEl, toEl) {
|
|
61
61
|
if (toEl.___preserveTextAreaValue) {
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
@@ -83,12 +83,12 @@ SpecialElHandlers.prototype = {
|
|
|
83
83
|
firstChild.nodeValue = newValue;
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
|
-
select: function(fromEl, toEl) {
|
|
86
|
+
select: function (fromEl, toEl) {
|
|
87
87
|
if (!toEl.___hasAttribute("multiple")) {
|
|
88
88
|
var selected = 0;
|
|
89
89
|
forEachOption(
|
|
90
90
|
toEl,
|
|
91
|
-
function(option, i) {
|
|
91
|
+
function (option, i) {
|
|
92
92
|
if (option.___hasAttribute("selected")) {
|
|
93
93
|
selected = i;
|
|
94
94
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var parseHTML = function(html) {
|
|
1
|
+
var parseHTML = function (html) {
|
|
2
2
|
var container = document.createElement("template");
|
|
3
3
|
parseHTML = container.content
|
|
4
|
-
? function(html) {
|
|
4
|
+
? function (html) {
|
|
5
5
|
container.innerHTML = html;
|
|
6
6
|
return container.content;
|
|
7
7
|
}
|
|
8
|
-
: function(html) {
|
|
8
|
+
: function (html) {
|
|
9
9
|
container.innerHTML = html;
|
|
10
10
|
return container;
|
|
11
11
|
};
|
|
@@ -13,6 +13,6 @@ var parseHTML = function(html) {
|
|
|
13
13
|
return parseHTML(html);
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
module.exports = function(html) {
|
|
16
|
+
module.exports = function (html) {
|
|
17
17
|
return parseHTML(html).firstChild;
|
|
18
18
|
};
|
|
@@ -4,7 +4,7 @@ function removePreservedAttributes(attrs, props) {
|
|
|
4
4
|
var preservedAttrs = props && props.pa;
|
|
5
5
|
if (preservedAttrs) {
|
|
6
6
|
attrs = extend({}, attrs);
|
|
7
|
-
preservedAttrs.forEach(function(preservedAttrName) {
|
|
7
|
+
preservedAttrs.forEach(function (preservedAttrName) {
|
|
8
8
|
delete attrs[preservedAttrName];
|
|
9
9
|
});
|
|
10
10
|
}
|
package/src/runtime/vdom/vdom.js
CHANGED
|
@@ -7,7 +7,6 @@ var VComponent = require("./VComponent");
|
|
|
7
7
|
var VFragment = require("./VFragment");
|
|
8
8
|
var parseHTML = require("./parse-html");
|
|
9
9
|
|
|
10
|
-
var defaultDocument = typeof document != "undefined" && document;
|
|
11
10
|
var specialHtmlRegexp = /[&<]/;
|
|
12
11
|
|
|
13
12
|
function virtualizeChildNodes(node, vdomParent, ownerComponent) {
|
|
@@ -33,7 +32,7 @@ function virtualize(node, ownerComponent) {
|
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
function virtualizeHTML(html,
|
|
35
|
+
function virtualizeHTML(html, ownerComponent) {
|
|
37
36
|
if (!specialHtmlRegexp.test(html)) {
|
|
38
37
|
return new VText(html, ownerComponent);
|
|
39
38
|
}
|
|
@@ -55,7 +54,7 @@ var Node_prototype = VNode.prototype;
|
|
|
55
54
|
* Shorthand method for creating and appending a Text node with a given value
|
|
56
55
|
* @param {String} value The text value for the new Text node
|
|
57
56
|
*/
|
|
58
|
-
Node_prototype.t = function(value) {
|
|
57
|
+
Node_prototype.t = function (value) {
|
|
59
58
|
var type = typeof value;
|
|
60
59
|
var vdomNode;
|
|
61
60
|
|
|
@@ -64,7 +63,7 @@ Node_prototype.t = function(value) {
|
|
|
64
63
|
value = "";
|
|
65
64
|
} else if (type === "object") {
|
|
66
65
|
if (value.toHTML) {
|
|
67
|
-
vdomNode = virtualizeHTML(value.toHTML()
|
|
66
|
+
vdomNode = virtualizeHTML(value.toHTML());
|
|
68
67
|
}
|
|
69
68
|
}
|
|
70
69
|
}
|
|
@@ -77,12 +76,12 @@ Node_prototype.t = function(value) {
|
|
|
77
76
|
* Shorthand method for creating and appending a Comment node with a given value
|
|
78
77
|
* @param {String} value The value for the new Comment node
|
|
79
78
|
*/
|
|
80
|
-
Node_prototype.c = function(value) {
|
|
79
|
+
Node_prototype.c = function (value) {
|
|
81
80
|
this.___appendChild(new VComment(value));
|
|
82
81
|
return this.___finishChild();
|
|
83
82
|
};
|
|
84
83
|
|
|
85
|
-
Node_prototype.___appendDocumentFragment = function() {
|
|
84
|
+
Node_prototype.___appendDocumentFragment = function () {
|
|
86
85
|
return this.___appendChild(new VDocumentFragment());
|
|
87
86
|
};
|
|
88
87
|
|
|
@@ -94,4 +93,3 @@ exports.___VComponent = VComponent;
|
|
|
94
93
|
exports.___VFragment = VFragment;
|
|
95
94
|
exports.___virtualize = virtualize;
|
|
96
95
|
exports.___virtualizeHTML = virtualizeHTML;
|
|
97
|
-
exports.___defaultDocument = defaultDocument;
|
|
@@ -74,13 +74,13 @@ class Tag {
|
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
forEachEntry(this.importedVariables, function(key, importedVariable) {
|
|
77
|
+
forEachEntry(this.importedVariables, function (key, importedVariable) {
|
|
78
78
|
callback.call(thisObj, importedVariable);
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
forEachTransformer(callback, thisObj) {
|
|
83
|
-
forEachEntry(this.transformers, function(key, transformer) {
|
|
83
|
+
forEachEntry(this.transformers, function (key, transformer) {
|
|
84
84
|
callback.call(thisObj, transformer);
|
|
85
85
|
});
|
|
86
86
|
}
|
|
@@ -249,7 +249,7 @@ class Tag {
|
|
|
249
249
|
return;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
forEachEntry(this.nestedTags, function(key, nestedTag) {
|
|
252
|
+
forEachEntry(this.nestedTags, function (key, nestedTag) {
|
|
253
253
|
callback.call(thisObj, nestedTag);
|
|
254
254
|
});
|
|
255
255
|
}
|
|
@@ -259,7 +259,7 @@ class Tag {
|
|
|
259
259
|
|
|
260
260
|
forEachMigrator(callback, thisObj) {
|
|
261
261
|
this.migratorPaths
|
|
262
|
-
.map(function(path) {
|
|
262
|
+
.map(function (path) {
|
|
263
263
|
return (this.migrators[path] =
|
|
264
264
|
this.migrators[path] || markoModules.require(path));
|
|
265
265
|
}, this)
|
|
@@ -278,7 +278,7 @@ class Tag {
|
|
|
278
278
|
var loadedCodeGenerator = markoModules.require(
|
|
279
279
|
this.codeGeneratorModulePath
|
|
280
280
|
);
|
|
281
|
-
nodeFactory = function(elNode) {
|
|
281
|
+
nodeFactory = function (elNode) {
|
|
282
282
|
elNode.setType(codeGeneratorModulePath);
|
|
283
283
|
elNode.setCodeGenerator(loadedCodeGenerator);
|
|
284
284
|
return elNode;
|
|
@@ -20,7 +20,7 @@ function handleImport(taglib, importedTaglib) {
|
|
|
20
20
|
taglib.imports.push(importedTaglib);
|
|
21
21
|
|
|
22
22
|
if (importedTaglib.imports) {
|
|
23
|
-
importedTaglib.imports.forEach(function(nestedImportedTaglib) {
|
|
23
|
+
importedTaglib.imports.forEach(function (nestedImportedTaglib) {
|
|
24
24
|
handleImport(taglib, nestedImportedTaglib);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -90,7 +90,7 @@ class Taglib {
|
|
|
90
90
|
forEachTag(callback, thisObj) {
|
|
91
91
|
forEachEntry(
|
|
92
92
|
this.tags,
|
|
93
|
-
function(key, tag) {
|
|
93
|
+
function (key, tag) {
|
|
94
94
|
callback.call(thisObj, tag);
|
|
95
95
|
},
|
|
96
96
|
this
|
|
@@ -2,7 +2,7 @@ var fs = require("fs");
|
|
|
2
2
|
var stripJsonComments = require("strip-json-comments");
|
|
3
3
|
var fsReadOptions = { encoding: "utf8" };
|
|
4
4
|
|
|
5
|
-
exports.readFileSync = function(path) {
|
|
5
|
+
exports.readFileSync = function (path) {
|
|
6
6
|
var json = fs.readFileSync(path, fsReadOptions);
|
|
7
7
|
|
|
8
8
|
try {
|
|
@@ -235,7 +235,7 @@ function loadAttributeFromProps(attrName, attrProps, dependencyChain) {
|
|
|
235
235
|
return attr;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
-
loadAttributeFromProps.isSupportedProperty = function(name) {
|
|
238
|
+
loadAttributeFromProps.isSupportedProperty = function (name) {
|
|
239
239
|
return AttrLoader.prototype.hasOwnProperty(name);
|
|
240
240
|
};
|
|
241
241
|
|
|
@@ -24,7 +24,7 @@ function exists(path) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
function removeDashes(str) {
|
|
27
|
-
return str.replace(/-([a-z])/g, function(match, lower) {
|
|
27
|
+
return str.replace(/-([a-z])/g, function (match, lower) {
|
|
28
28
|
return lower.toUpperCase();
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -136,11 +136,11 @@ class TagLoader {
|
|
|
136
136
|
propertyHandlers(
|
|
137
137
|
value,
|
|
138
138
|
{
|
|
139
|
-
name: function(value) {
|
|
139
|
+
name: function (value) {
|
|
140
140
|
nestedVariable.name = value;
|
|
141
141
|
},
|
|
142
142
|
|
|
143
|
-
nameFromAttribute: function(value) {
|
|
143
|
+
nameFromAttribute: function (value) {
|
|
144
144
|
nestedVariable.nameFromAttribute = value;
|
|
145
145
|
}
|
|
146
146
|
},
|
|
@@ -577,9 +577,8 @@ class TagLoader {
|
|
|
577
577
|
);
|
|
578
578
|
}
|
|
579
579
|
|
|
580
|
-
importedVar.expression =
|
|
581
|
-
expression
|
|
582
|
-
);
|
|
580
|
+
importedVar.expression =
|
|
581
|
+
markoCompiler.builder.parseExpression(expression);
|
|
583
582
|
tag.addImportedVariable(importedVar);
|
|
584
583
|
});
|
|
585
584
|
}
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
var tagStartRegExp = /(^\s*(?:(?:exports.(?:tag|TAG))|(?:TAG))\s*=\s*)\{/m;
|
|
4
4
|
|
|
5
5
|
// Tokens: "<string>", '<string>', /*<some comment*/, //<single line comment>, {, }, ;
|
|
6
|
-
var tokensRegExp =
|
|
6
|
+
var tokensRegExp =
|
|
7
|
+
/"(?:[^"]|\\")*"|'(?:[^'])|(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(\/\/.*)|[{};]/g;
|
|
7
8
|
|
|
8
9
|
function extractTagDef(code) {
|
|
9
10
|
var startMatches = tagStartRegExp.exec(code);
|