Merge remote-tracking branch 'origin/rewrite' into rewrite
Conflicts: docs/keys.md docs/signatures.md docs/v1.x-migration.md index.js ospec/bin/ospec.cmd request/request.js request/tests/test-xhr.js util/prop.js util/tests/index.html util/tests/test-prop.js
This commit is contained in:
commit
bce2abbffd
107 changed files with 1989 additions and 1970 deletions
10
.editorconfig
Normal file
10
.editorconfig
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
|
||||
[*.js]
|
||||
indent_style = tab
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
end_of_line = lf
|
||||
510
.eslintrc.js
510
.eslintrc.js
|
|
@ -1,257 +1,257 @@
|
|||
module.exports = {
|
||||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true,
|
||||
"node": true
|
||||
},
|
||||
"globals": {
|
||||
"Promise": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
"accessor-pairs": "error",
|
||||
"array-bracket-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"array-callback-return": "error",
|
||||
"arrow-body-style": "error",
|
||||
"arrow-parens": "error",
|
||||
"arrow-spacing": "error",
|
||||
"block-scoped-var": "off",
|
||||
"block-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"brace-style": "off",
|
||||
"callback-return": "off",
|
||||
"camelcase": "error",
|
||||
"comma-dangle": "off",
|
||||
"comma-spacing": [
|
||||
"error",
|
||||
{
|
||||
"after": true,
|
||||
"before": false
|
||||
}
|
||||
],
|
||||
"comma-style": [
|
||||
"error",
|
||||
"last"
|
||||
],
|
||||
"complexity": "off",
|
||||
"computed-property-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"consistent-return": "off",
|
||||
"consistent-this": "off",
|
||||
"curly": "off",
|
||||
"default-case": "off",
|
||||
"dot-location": [
|
||||
"error",
|
||||
"property"
|
||||
],
|
||||
"dot-notation": "off",
|
||||
"eol-last": "off",
|
||||
"eqeqeq": "off",
|
||||
"func-names": "off",
|
||||
"func-style": "off",
|
||||
"generator-star-spacing": "error",
|
||||
"global-require": "error",
|
||||
"guard-for-in": "off",
|
||||
"handle-callback-err": "error",
|
||||
"id-blacklist": "error",
|
||||
"id-length": "off",
|
||||
"id-match": "error",
|
||||
"indent": "off",
|
||||
"init-declarations": "off",
|
||||
"jsx-quotes": "error",
|
||||
"key-spacing": "error",
|
||||
"keyword-spacing": [
|
||||
"error",
|
||||
{
|
||||
"before": true,
|
||||
"after": true
|
||||
}
|
||||
],
|
||||
"lines-around-comment": "error",
|
||||
"max-depth": "off",
|
||||
"max-len": "off",
|
||||
"max-nested-callbacks": "error",
|
||||
"max-params": "off",
|
||||
"max-statements": "off",
|
||||
"max-statements-per-line": "off",
|
||||
"new-parens": "off",
|
||||
"newline-after-var": "off",
|
||||
"newline-before-return": "off",
|
||||
"newline-per-chained-call": "off",
|
||||
"no-alert": "error",
|
||||
"no-array-constructor": "error",
|
||||
"no-bitwise": "off",
|
||||
"no-caller": "error",
|
||||
"no-catch-shadow": "error",
|
||||
"no-cond-assign": "off",
|
||||
"no-confusing-arrow": "error",
|
||||
"no-continue": "error",
|
||||
"no-div-regex": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-else-return": "off",
|
||||
"no-empty-function": "off",
|
||||
"no-eq-null": "off",
|
||||
"no-eval": "error",
|
||||
"no-extend-native": "error",
|
||||
"no-extra-bind": "error",
|
||||
"no-extra-label": "error",
|
||||
"no-extra-parens": "off",
|
||||
"no-floating-decimal": "error",
|
||||
"no-implicit-coercion": "error",
|
||||
"no-implicit-globals": "error",
|
||||
"no-implied-eval": "error",
|
||||
"no-inline-comments": "off",
|
||||
"no-inner-declarations": [
|
||||
"error",
|
||||
"functions"
|
||||
],
|
||||
"no-invalid-this": "off",
|
||||
"no-iterator": "error",
|
||||
"no-label-var": "error",
|
||||
"no-labels": "error",
|
||||
"no-lone-blocks": "error",
|
||||
"no-lonely-if": "off",
|
||||
"no-loop-func": "off",
|
||||
"no-magic-numbers": "off",
|
||||
"no-mixed-requires": "error",
|
||||
"no-multi-spaces": "error",
|
||||
"no-multi-str": "error",
|
||||
"no-multiple-empty-lines": "error",
|
||||
"no-native-reassign": "error",
|
||||
"no-negated-condition": "off",
|
||||
"no-nested-ternary": "off",
|
||||
"no-new": "off",
|
||||
"no-new-func": "off",
|
||||
"no-new-object": "error",
|
||||
"no-new-require": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-octal-escape": "error",
|
||||
"no-param-reassign": "off",
|
||||
"no-path-concat": "error",
|
||||
"no-plusplus": "off",
|
||||
"no-process-env": "error",
|
||||
"no-process-exit": "error",
|
||||
"no-proto": "error",
|
||||
"no-redeclare": "off",
|
||||
"no-restricted-globals": "error",
|
||||
"no-restricted-imports": "error",
|
||||
"no-restricted-modules": "error",
|
||||
"no-restricted-syntax": "error",
|
||||
"no-return-assign": "off",
|
||||
"no-script-url": "error",
|
||||
"no-self-compare": "error",
|
||||
"no-sequences": "off",
|
||||
"no-shadow": "off",
|
||||
"no-shadow-restricted-names": "error",
|
||||
"no-spaced-func": "error",
|
||||
"no-sync": "off",
|
||||
"no-ternary": "off",
|
||||
"no-throw-literal": "error",
|
||||
"no-trailing-spaces": [
|
||||
"error",
|
||||
{
|
||||
"skipBlankLines": true
|
||||
}
|
||||
],
|
||||
"no-undef-init": "error",
|
||||
"no-undefined": "off",
|
||||
"no-underscore-dangle": "error",
|
||||
"no-unmodified-loop-condition": "error",
|
||||
"no-unneeded-ternary": "error",
|
||||
"no-unsafe-finally": "error",
|
||||
"no-unused-expressions": "off",
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"varsIgnorePattern": "module"
|
||||
}
|
||||
],
|
||||
"no-use-before-define": "off",
|
||||
"no-useless-call": "error",
|
||||
"no-useless-computed-key": "error",
|
||||
"no-useless-concat": "error",
|
||||
"no-useless-constructor": "error",
|
||||
"no-useless-escape": "off",
|
||||
"no-var": "off",
|
||||
"no-void": "error",
|
||||
"no-warning-comments": "off",
|
||||
"no-whitespace-before-property": "error",
|
||||
"no-with": "error",
|
||||
"object-curly-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"object-property-newline": [
|
||||
"error",
|
||||
{
|
||||
"allowMultiplePropertiesPerLine": true
|
||||
}
|
||||
],
|
||||
"object-shorthand": "off",
|
||||
"one-var": "off",
|
||||
"one-var-declaration-per-line": "off",
|
||||
"operator-assignment": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"operator-linebreak": [
|
||||
"error",
|
||||
"after"
|
||||
],
|
||||
"padded-blocks": "off",
|
||||
"prefer-arrow-callback": "off",
|
||||
"prefer-const": "error",
|
||||
"prefer-reflect": "off",
|
||||
"prefer-rest-params": "off",
|
||||
"prefer-spread": "off",
|
||||
"prefer-template": "off",
|
||||
"quote-props": "off",
|
||||
"quotes": [
|
||||
"error",
|
||||
"double"
|
||||
],
|
||||
"radix": [
|
||||
"error",
|
||||
"as-needed"
|
||||
],
|
||||
"require-jsdoc": "off",
|
||||
"require-yield": "error",
|
||||
"semi": "off",
|
||||
"semi-spacing": [
|
||||
"error",
|
||||
{
|
||||
"after": true,
|
||||
"before": false
|
||||
}
|
||||
],
|
||||
"sort-imports": "error",
|
||||
"sort-vars": "off",
|
||||
"space-before-blocks": "error",
|
||||
"space-before-function-paren": "off",
|
||||
"space-in-parens": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"space-infix-ops": "error",
|
||||
"space-unary-ops": "off",
|
||||
"spaced-comment": "off",
|
||||
"strict": "off",
|
||||
"template-curly-spacing": "error",
|
||||
"valid-jsdoc": "error",
|
||||
"vars-on-top": "off",
|
||||
"wrap-iife": "error",
|
||||
"wrap-regex": "error",
|
||||
"yield-star-spacing": "error",
|
||||
"yoda": [
|
||||
"error",
|
||||
"never"
|
||||
]
|
||||
}
|
||||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true,
|
||||
"node": true
|
||||
},
|
||||
"globals": {
|
||||
"Promise": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"rules": {
|
||||
"accessor-pairs": "error",
|
||||
"array-bracket-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"array-callback-return": "error",
|
||||
"arrow-body-style": "error",
|
||||
"arrow-parens": "error",
|
||||
"arrow-spacing": "error",
|
||||
"block-scoped-var": "off",
|
||||
"block-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"brace-style": "off",
|
||||
"callback-return": "off",
|
||||
"camelcase": "error",
|
||||
"comma-dangle": "off",
|
||||
"comma-spacing": [
|
||||
"error",
|
||||
{
|
||||
"after": true,
|
||||
"before": false
|
||||
}
|
||||
],
|
||||
"comma-style": [
|
||||
"error",
|
||||
"last"
|
||||
],
|
||||
"complexity": "off",
|
||||
"computed-property-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"consistent-return": "off",
|
||||
"consistent-this": "off",
|
||||
"curly": "off",
|
||||
"default-case": "off",
|
||||
"dot-location": [
|
||||
"error",
|
||||
"property"
|
||||
],
|
||||
"dot-notation": "off",
|
||||
"eol-last": "off",
|
||||
"eqeqeq": "off",
|
||||
"func-names": "off",
|
||||
"func-style": "off",
|
||||
"generator-star-spacing": "error",
|
||||
"global-require": "error",
|
||||
"guard-for-in": "off",
|
||||
"handle-callback-err": "error",
|
||||
"id-blacklist": "error",
|
||||
"id-length": "off",
|
||||
"id-match": "error",
|
||||
"indent": "off",
|
||||
"init-declarations": "off",
|
||||
"jsx-quotes": "error",
|
||||
"key-spacing": "error",
|
||||
"keyword-spacing": [
|
||||
"error",
|
||||
{
|
||||
"before": true,
|
||||
"after": true
|
||||
}
|
||||
],
|
||||
"lines-around-comment": "error",
|
||||
"max-depth": "off",
|
||||
"max-len": "off",
|
||||
"max-nested-callbacks": "error",
|
||||
"max-params": "off",
|
||||
"max-statements": "off",
|
||||
"max-statements-per-line": "off",
|
||||
"new-parens": "off",
|
||||
"newline-after-var": "off",
|
||||
"newline-before-return": "off",
|
||||
"newline-per-chained-call": "off",
|
||||
"no-alert": "error",
|
||||
"no-array-constructor": "error",
|
||||
"no-bitwise": "off",
|
||||
"no-caller": "error",
|
||||
"no-catch-shadow": "error",
|
||||
"no-cond-assign": "off",
|
||||
"no-confusing-arrow": "error",
|
||||
"no-continue": "error",
|
||||
"no-div-regex": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-else-return": "off",
|
||||
"no-empty-function": "off",
|
||||
"no-eq-null": "off",
|
||||
"no-eval": "error",
|
||||
"no-extend-native": "error",
|
||||
"no-extra-bind": "error",
|
||||
"no-extra-label": "error",
|
||||
"no-extra-parens": "off",
|
||||
"no-floating-decimal": "error",
|
||||
"no-implicit-coercion": "error",
|
||||
"no-implicit-globals": "error",
|
||||
"no-implied-eval": "error",
|
||||
"no-inline-comments": "off",
|
||||
"no-inner-declarations": [
|
||||
"error",
|
||||
"functions"
|
||||
],
|
||||
"no-invalid-this": "off",
|
||||
"no-iterator": "error",
|
||||
"no-label-var": "error",
|
||||
"no-labels": "error",
|
||||
"no-lone-blocks": "error",
|
||||
"no-lonely-if": "off",
|
||||
"no-loop-func": "off",
|
||||
"no-magic-numbers": "off",
|
||||
"no-mixed-requires": "error",
|
||||
"no-multi-spaces": "error",
|
||||
"no-multi-str": "error",
|
||||
"no-multiple-empty-lines": "error",
|
||||
"no-native-reassign": "error",
|
||||
"no-negated-condition": "off",
|
||||
"no-nested-ternary": "off",
|
||||
"no-new": "off",
|
||||
"no-new-func": "off",
|
||||
"no-new-object": "error",
|
||||
"no-new-require": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-octal-escape": "error",
|
||||
"no-param-reassign": "off",
|
||||
"no-path-concat": "error",
|
||||
"no-plusplus": "off",
|
||||
"no-process-env": "error",
|
||||
"no-process-exit": "error",
|
||||
"no-proto": "error",
|
||||
"no-redeclare": "off",
|
||||
"no-restricted-globals": "error",
|
||||
"no-restricted-imports": "error",
|
||||
"no-restricted-modules": "error",
|
||||
"no-restricted-syntax": "error",
|
||||
"no-return-assign": "off",
|
||||
"no-script-url": "error",
|
||||
"no-self-compare": "error",
|
||||
"no-sequences": "off",
|
||||
"no-shadow": "off",
|
||||
"no-shadow-restricted-names": "error",
|
||||
"no-spaced-func": "error",
|
||||
"no-sync": "off",
|
||||
"no-ternary": "off",
|
||||
"no-throw-literal": "error",
|
||||
"no-trailing-spaces": [
|
||||
"error",
|
||||
{
|
||||
"skipBlankLines": true
|
||||
}
|
||||
],
|
||||
"no-undef-init": "error",
|
||||
"no-undefined": "off",
|
||||
"no-underscore-dangle": "error",
|
||||
"no-unmodified-loop-condition": "error",
|
||||
"no-unneeded-ternary": "error",
|
||||
"no-unsafe-finally": "error",
|
||||
"no-unused-expressions": "off",
|
||||
"no-unused-vars": [
|
||||
"error",
|
||||
{
|
||||
"varsIgnorePattern": "module"
|
||||
}
|
||||
],
|
||||
"no-use-before-define": "off",
|
||||
"no-useless-call": "error",
|
||||
"no-useless-computed-key": "error",
|
||||
"no-useless-concat": "error",
|
||||
"no-useless-constructor": "error",
|
||||
"no-useless-escape": "off",
|
||||
"no-var": "off",
|
||||
"no-void": "error",
|
||||
"no-warning-comments": "off",
|
||||
"no-whitespace-before-property": "error",
|
||||
"no-with": "error",
|
||||
"object-curly-spacing": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"object-property-newline": [
|
||||
"error",
|
||||
{
|
||||
"allowMultiplePropertiesPerLine": true
|
||||
}
|
||||
],
|
||||
"object-shorthand": "off",
|
||||
"one-var": "off",
|
||||
"one-var-declaration-per-line": "off",
|
||||
"operator-assignment": [
|
||||
"error",
|
||||
"always"
|
||||
],
|
||||
"operator-linebreak": [
|
||||
"error",
|
||||
"after"
|
||||
],
|
||||
"padded-blocks": "off",
|
||||
"prefer-arrow-callback": "off",
|
||||
"prefer-const": "error",
|
||||
"prefer-reflect": "off",
|
||||
"prefer-rest-params": "off",
|
||||
"prefer-spread": "off",
|
||||
"prefer-template": "off",
|
||||
"quote-props": "off",
|
||||
"quotes": [
|
||||
"error",
|
||||
"double"
|
||||
],
|
||||
"radix": [
|
||||
"error",
|
||||
"as-needed"
|
||||
],
|
||||
"require-jsdoc": "off",
|
||||
"require-yield": "error",
|
||||
"semi": "off",
|
||||
"semi-spacing": [
|
||||
"error",
|
||||
{
|
||||
"after": true,
|
||||
"before": false
|
||||
}
|
||||
],
|
||||
"sort-imports": "error",
|
||||
"sort-vars": "off",
|
||||
"space-before-blocks": "error",
|
||||
"space-before-function-paren": "off",
|
||||
"space-in-parens": [
|
||||
"error",
|
||||
"never"
|
||||
],
|
||||
"space-infix-ops": "error",
|
||||
"space-unary-ops": "off",
|
||||
"spaced-comment": "off",
|
||||
"strict": "off",
|
||||
"template-curly-spacing": "error",
|
||||
"valid-jsdoc": "error",
|
||||
"vars-on-top": "off",
|
||||
"wrap-iife": "error",
|
||||
"wrap-regex": "error",
|
||||
"yield-star-spacing": "error",
|
||||
"yoda": [
|
||||
"error",
|
||||
"never"
|
||||
]
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@ language: node_js
|
|||
node_js:
|
||||
- stable
|
||||
|
||||
sudo: false
|
||||
sudo: false
|
||||
|
|
|
|||
|
|
@ -79,6 +79,3 @@ Type checks are generally already irreducible expressions and having micro-modul
|
|||
You should be trying to reduce the number of DOM operations or reduce algorithmic complexity in a hot spot. Anything else is likely a waste of time. Specifically, micro-optimizations like caching array lengths, caching object property values and inlining functions won't have any positive impact in modern javascript engines.
|
||||
|
||||
Keep object properties consistent (i.e. ensure the data objects always have the same properties and that properties are always in the same order) to allow the engine to keep using JIT'ed structs instead of hashmaps. Always place null checks first in compound type checking expressions to allow the Javascript engine to optimize to type-specific code paths. Prefer for loops over Array methods and try to pull conditionals out of loops if possible.
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ module.exports = function(root, renderer, pubsub, callback) {
|
|||
if (e.redraw !== false) run()
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (pubsub != null) {
|
||||
if (root.redraw) pubsub.unsubscribe(root.redraw)
|
||||
pubsub.subscribe(run)
|
||||
}
|
||||
|
||||
|
||||
return root.redraw = run
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module.exports = function(renderer, pubsub) {
|
|||
var run = autoredraw(root, renderer, pubsub, function() {
|
||||
renderer.render(root, {tag: component})
|
||||
})
|
||||
|
||||
|
||||
run()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,6 @@ module.exports = function($window, renderer, pubsub) {
|
|||
route.prefix = router.setPrefix
|
||||
route.setPath = router.setPath
|
||||
route.getPath = router.getPath
|
||||
|
||||
|
||||
return route
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,13 +24,13 @@
|
|||
<script src="../../api/autoredraw.js"></script>
|
||||
<script src="../../api/mount.js"></script>
|
||||
<script src="../../api/router.js"></script>
|
||||
|
||||
|
||||
<script src="./test-throttle.js"></script>
|
||||
<script src="./test-pubsub.js"></script>
|
||||
<script src="./test-autoredraw.js"></script>
|
||||
<script src="./test-mount.js"></script>
|
||||
<script src="./test-router.js"></script>
|
||||
|
||||
|
||||
<script>require("../../ospec/ospec").run()</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -17,79 +17,79 @@ o.spec("autoredraw", function() {
|
|||
pubsub = apiPubSub()
|
||||
spy = o.spy()
|
||||
})
|
||||
|
||||
|
||||
o("returns self-trigger", function() {
|
||||
var run = autoredraw(root, renderer, pubsub, spy)
|
||||
|
||||
|
||||
run()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
})
|
||||
|
||||
|
||||
o("null renderer doesn't throw", function(done) {
|
||||
autoredraw(root, null, pubsub, spy)
|
||||
done()
|
||||
})
|
||||
|
||||
|
||||
o("null pubsub doesn't throw", function(done) {
|
||||
autoredraw(root, renderer, null, spy)
|
||||
done()
|
||||
})
|
||||
|
||||
|
||||
o("registers onevent", function() {
|
||||
autoredraw(root, renderer, pubsub, spy)
|
||||
|
||||
|
||||
renderer.render(root, {tag: "div", attrs: {onclick: function() {}}})
|
||||
|
||||
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
e.initEvent("click", true, true)
|
||||
root.firstChild.dispatchEvent(e)
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
})
|
||||
|
||||
|
||||
o("registers pubsub", function() {
|
||||
autoredraw(root, renderer, pubsub, spy)
|
||||
|
||||
|
||||
pubsub.publish()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
})
|
||||
|
||||
|
||||
o("re-registering pubsub works", function() {
|
||||
autoredraw(root, renderer, pubsub, spy)
|
||||
autoredraw(root, renderer, pubsub, spy)
|
||||
|
||||
|
||||
pubsub.publish()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
})
|
||||
|
||||
|
||||
o("throttles", function(done) {
|
||||
var run = autoredraw(root, renderer, pubsub, spy)
|
||||
|
||||
|
||||
run()
|
||||
run()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
o(spy.callCount).equals(2)
|
||||
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
|
||||
|
||||
o("does not redraw if e.redraw is false", function() {
|
||||
autoredraw(root, renderer, pubsub, spy)
|
||||
|
||||
|
||||
renderer.render(root, {tag: "div", attrs: {onclick: function(e) {e.redraw = false}}})
|
||||
|
||||
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
e.initEvent("click", true, true)
|
||||
root.firstChild.dispatchEvent(e)
|
||||
|
||||
|
||||
o(spy.callCount).equals(0)
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
|
|
|||
|
|
@ -11,34 +11,34 @@ var apiMounter = require("../../api/mount")
|
|||
o.spec("mount", function() {
|
||||
var FRAME_BUDGET = Math.floor(1000 / 60)
|
||||
var $window, root, redraw, mount
|
||||
|
||||
|
||||
o.beforeEach(function() {
|
||||
$window = domMock()
|
||||
|
||||
|
||||
root = $window.document.body
|
||||
|
||||
|
||||
redraw = apiPubSub()
|
||||
mount = apiMounter(coreRenderer($window), redraw)
|
||||
})
|
||||
|
||||
|
||||
o("renders into `root`", function() {
|
||||
mount(root, {
|
||||
view : function() {
|
||||
return m("div")
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
})
|
||||
|
||||
|
||||
o("redraws on events", function(done) {
|
||||
var onupdate = o.spy()
|
||||
var oninit = o.spy()
|
||||
var onclick = o.spy()
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
|
||||
|
||||
e.initEvent("click", true, true)
|
||||
|
||||
|
||||
mount(root, {
|
||||
view : function() {
|
||||
return m("div", {
|
||||
|
|
@ -48,32 +48,32 @@ o.spec("mount", function() {
|
|||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
root.firstChild.dispatchEvent(e)
|
||||
|
||||
|
||||
o(oninit.callCount).equals(1)
|
||||
o(onupdate.callCount).equals(0)
|
||||
|
||||
|
||||
o(onclick.callCount).equals(1)
|
||||
o(onclick.this).equals(root.firstChild)
|
||||
o(onclick.args[0].type).equals("click")
|
||||
o(onclick.args[0].target).equals(root.firstChild)
|
||||
|
||||
|
||||
// Wrapped to give time for the rate-limited redraw to fire
|
||||
setTimeout(function() {
|
||||
o(onupdate.callCount).equals(1)
|
||||
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
|
||||
|
||||
o("event handlers can skip redraw", function(done) {
|
||||
var onupdate = o.spy()
|
||||
var oninit = o.spy()
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
|
||||
|
||||
e.initEvent("click", true, true)
|
||||
|
||||
|
||||
mount(root, {
|
||||
view: function() {
|
||||
return m("div", {
|
||||
|
|
@ -85,23 +85,23 @@ o.spec("mount", function() {
|
|||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
root.firstChild.dispatchEvent(e)
|
||||
|
||||
|
||||
o(oninit.callCount).equals(1)
|
||||
|
||||
|
||||
// Wrapped to ensure no redraw fired
|
||||
setTimeout(function() {
|
||||
o(onupdate.callCount).equals(0)
|
||||
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
|
||||
|
||||
o("redraws when the render function is run", function(done) {
|
||||
var onupdate = o.spy()
|
||||
var oninit = o.spy()
|
||||
|
||||
|
||||
mount(root, {
|
||||
view : function() {
|
||||
return m("div", {
|
||||
|
|
@ -110,16 +110,16 @@ o.spec("mount", function() {
|
|||
})
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
o(oninit.callCount).equals(1)
|
||||
o(onupdate.callCount).equals(0)
|
||||
|
||||
|
||||
redraw.publish()
|
||||
|
||||
|
||||
// Wrapped to give time for the rate-limited redraw to fire
|
||||
setTimeout(function() {
|
||||
o(onupdate.callCount).equals(1)
|
||||
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,68 +8,68 @@ o.spec("pubsub", function() {
|
|||
o.beforeEach(function() {
|
||||
pubsub = apiPubSub()
|
||||
})
|
||||
|
||||
|
||||
o("shouldn't error if there are no renderers", function() {
|
||||
pubsub.publish()
|
||||
})
|
||||
|
||||
|
||||
o("should run a single renderer entry", function() {
|
||||
var spy = o.spy()
|
||||
|
||||
|
||||
pubsub.subscribe(spy)
|
||||
|
||||
|
||||
pubsub.publish()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
||||
pubsub.publish()
|
||||
pubsub.publish()
|
||||
pubsub.publish()
|
||||
|
||||
|
||||
o(spy.callCount).equals(4)
|
||||
})
|
||||
|
||||
|
||||
o("should run all renderer entries", function() {
|
||||
var spy1 = o.spy()
|
||||
var spy2 = o.spy()
|
||||
var spy3 = o.spy()
|
||||
|
||||
|
||||
pubsub.subscribe(spy1)
|
||||
pubsub.subscribe(spy2)
|
||||
pubsub.subscribe(spy3)
|
||||
|
||||
|
||||
pubsub.publish()
|
||||
|
||||
|
||||
o(spy1.callCount).equals(1)
|
||||
o(spy2.callCount).equals(1)
|
||||
o(spy3.callCount).equals(1)
|
||||
|
||||
|
||||
pubsub.publish()
|
||||
|
||||
|
||||
o(spy1.callCount).equals(2)
|
||||
o(spy2.callCount).equals(2)
|
||||
o(spy3.callCount).equals(2)
|
||||
})
|
||||
|
||||
|
||||
o("should stop running after unsubscribe", function() {
|
||||
var spy = o.spy()
|
||||
|
||||
|
||||
pubsub.subscribe(spy)
|
||||
pubsub.unsubscribe(spy)
|
||||
|
||||
|
||||
pubsub.publish()
|
||||
|
||||
|
||||
o(spy.callCount).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("does nothing on invalid unsubscribe", function() {
|
||||
var spy = o.spy()
|
||||
|
||||
|
||||
pubsub.subscribe(spy)
|
||||
pubsub.unsubscribe(null)
|
||||
|
||||
|
||||
pubsub.publish()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,170 +1,170 @@
|
|||
"use strict"
|
||||
|
||||
var o = require("../../ospec/ospec")
|
||||
var pushStateMock = require("../../test-utils/pushStateMock")
|
||||
var domMock = require("../../test-utils/domMock")
|
||||
|
||||
var m = require("../../render/hyperscript")
|
||||
var coreRenderer = require("../../render/render")
|
||||
var apiPubSub = require("../../api/pubsub")
|
||||
var apiRouter = require("../../api/router")
|
||||
|
||||
o.spec("route", function() {
|
||||
var FRAME_BUDGET = Math.floor(1000 / 60)
|
||||
var $window, root, redraw, route
|
||||
|
||||
o.beforeEach(function() {
|
||||
$window = {}
|
||||
|
||||
var dom = domMock()
|
||||
for (var key in dom) $window[key] = dom[key]
|
||||
|
||||
var loc = pushStateMock()
|
||||
for (var key in loc) $window[key] = loc[key]
|
||||
|
||||
root = $window.document.body
|
||||
|
||||
redraw = apiPubSub()
|
||||
route = apiRouter($window, coreRenderer($window), redraw)
|
||||
})
|
||||
|
||||
o("renders into `root`", function() {
|
||||
route(root, "/", {
|
||||
"/" : {
|
||||
view: function() {
|
||||
return m("div")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
})
|
||||
|
||||
o("redraws when render function is executed", function(done) {
|
||||
var onupdate = o.spy()
|
||||
var oninit = o.spy()
|
||||
|
||||
route(root, "/", {
|
||||
"/" : {
|
||||
view: function() {
|
||||
return m("div", {
|
||||
oninit: oninit,
|
||||
onupdate: onupdate
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
o(oninit.callCount).equals(1)
|
||||
|
||||
redraw.publish()
|
||||
|
||||
// Wrapped to give time for the rate-limited redraw to fire
|
||||
setTimeout(function() {
|
||||
o(onupdate.callCount).equals(1)
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
|
||||
o("redraws on events", function(done, timeout) {
|
||||
var onupdate = o.spy()
|
||||
var oninit = o.spy()
|
||||
var onclick = o.spy()
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
|
||||
e.initEvent("click", true, true)
|
||||
|
||||
route(root, "/", {
|
||||
"/" : {
|
||||
view: function() {
|
||||
return m("div", {
|
||||
oninit: oninit,
|
||||
onupdate: onupdate,
|
||||
onclick: onclick,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
root.firstChild.dispatchEvent(e)
|
||||
|
||||
o(oninit.callCount).equals(1)
|
||||
|
||||
o(onclick.callCount).equals(1)
|
||||
o(onclick.this).equals(root.firstChild)
|
||||
o(onclick.args[0].type).equals("click")
|
||||
o(onclick.args[0].target).equals(root.firstChild)
|
||||
|
||||
// Wrapped to give time for the rate-limited redraw to fire
|
||||
setTimeout(function() {
|
||||
o(onupdate.callCount).equals(1)
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
|
||||
o("event handlers can skip redraw", function(done) {
|
||||
var onupdate = o.spy()
|
||||
var oninit = o.spy()
|
||||
var onclick = o.spy()
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
|
||||
e.initEvent("click", true, true)
|
||||
|
||||
route(root, "/", {
|
||||
"/" : {
|
||||
view: function() {
|
||||
return m("div", {
|
||||
oninit: oninit,
|
||||
onupdate: onupdate,
|
||||
onclick: function(e) {
|
||||
e.redraw = false
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
root.firstChild.dispatchEvent(e)
|
||||
|
||||
o(oninit.callCount).equals(1)
|
||||
|
||||
// Wrapped to ensure no redraw fired
|
||||
setTimeout(function() {
|
||||
o(onupdate.callCount).equals(0)
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
|
||||
o("changes location on route.link", function() {
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
|
||||
e.initEvent("click", true, true)
|
||||
|
||||
route.prefix("?")
|
||||
|
||||
route(root, "/", {
|
||||
"/" : {
|
||||
view: function() {
|
||||
return m("a", {
|
||||
href: "/test",
|
||||
oncreate: route.link
|
||||
})
|
||||
}
|
||||
},
|
||||
"/test" : {
|
||||
view : function() {
|
||||
return m("div")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
o($window.location.href).equals("http://localhost/?/")
|
||||
|
||||
root.firstChild.dispatchEvent(e)
|
||||
|
||||
o($window.location.href).equals("http://localhost/?/test")
|
||||
})
|
||||
})
|
||||
"use strict"
|
||||
|
||||
var o = require("../../ospec/ospec")
|
||||
var pushStateMock = require("../../test-utils/pushStateMock")
|
||||
var domMock = require("../../test-utils/domMock")
|
||||
|
||||
var m = require("../../render/hyperscript")
|
||||
var coreRenderer = require("../../render/render")
|
||||
var apiPubSub = require("../../api/pubsub")
|
||||
var apiRouter = require("../../api/router")
|
||||
|
||||
o.spec("route", function() {
|
||||
var FRAME_BUDGET = Math.floor(1000 / 60)
|
||||
var $window, root, redraw, route
|
||||
|
||||
o.beforeEach(function() {
|
||||
$window = {}
|
||||
|
||||
var dom = domMock()
|
||||
for (var key in dom) $window[key] = dom[key]
|
||||
|
||||
var loc = pushStateMock()
|
||||
for (var key in loc) $window[key] = loc[key]
|
||||
|
||||
root = $window.document.body
|
||||
|
||||
redraw = apiPubSub()
|
||||
route = apiRouter($window, coreRenderer($window), redraw)
|
||||
})
|
||||
|
||||
o("renders into `root`", function() {
|
||||
route(root, "/", {
|
||||
"/" : {
|
||||
view: function() {
|
||||
return m("div")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
})
|
||||
|
||||
o("redraws when render function is executed", function(done) {
|
||||
var onupdate = o.spy()
|
||||
var oninit = o.spy()
|
||||
|
||||
route(root, "/", {
|
||||
"/" : {
|
||||
view: function() {
|
||||
return m("div", {
|
||||
oninit: oninit,
|
||||
onupdate: onupdate
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
o(oninit.callCount).equals(1)
|
||||
|
||||
redraw.publish()
|
||||
|
||||
// Wrapped to give time for the rate-limited redraw to fire
|
||||
setTimeout(function() {
|
||||
o(onupdate.callCount).equals(1)
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
|
||||
o("redraws on events", function(done, timeout) {
|
||||
var onupdate = o.spy()
|
||||
var oninit = o.spy()
|
||||
var onclick = o.spy()
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
|
||||
e.initEvent("click", true, true)
|
||||
|
||||
route(root, "/", {
|
||||
"/" : {
|
||||
view: function() {
|
||||
return m("div", {
|
||||
oninit: oninit,
|
||||
onupdate: onupdate,
|
||||
onclick: onclick,
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
root.firstChild.dispatchEvent(e)
|
||||
|
||||
o(oninit.callCount).equals(1)
|
||||
|
||||
o(onclick.callCount).equals(1)
|
||||
o(onclick.this).equals(root.firstChild)
|
||||
o(onclick.args[0].type).equals("click")
|
||||
o(onclick.args[0].target).equals(root.firstChild)
|
||||
|
||||
// Wrapped to give time for the rate-limited redraw to fire
|
||||
setTimeout(function() {
|
||||
o(onupdate.callCount).equals(1)
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
|
||||
o("event handlers can skip redraw", function(done) {
|
||||
var onupdate = o.spy()
|
||||
var oninit = o.spy()
|
||||
var onclick = o.spy()
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
|
||||
e.initEvent("click", true, true)
|
||||
|
||||
route(root, "/", {
|
||||
"/" : {
|
||||
view: function() {
|
||||
return m("div", {
|
||||
oninit: oninit,
|
||||
onupdate: onupdate,
|
||||
onclick: function(e) {
|
||||
e.redraw = false
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
root.firstChild.dispatchEvent(e)
|
||||
|
||||
o(oninit.callCount).equals(1)
|
||||
|
||||
// Wrapped to ensure no redraw fired
|
||||
setTimeout(function() {
|
||||
o(onupdate.callCount).equals(0)
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
|
||||
o("changes location on route.link", function() {
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
|
||||
e.initEvent("click", true, true)
|
||||
|
||||
route.prefix("?")
|
||||
|
||||
route(root, "/", {
|
||||
"/" : {
|
||||
view: function() {
|
||||
return m("a", {
|
||||
href: "/test",
|
||||
oncreate: route.link
|
||||
})
|
||||
}
|
||||
},
|
||||
"/test" : {
|
||||
view : function() {
|
||||
return m("div")
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
o($window.location.href).equals("http://localhost/?/")
|
||||
|
||||
root.firstChild.dispatchEvent(e)
|
||||
|
||||
o($window.location.href).equals("http://localhost/?/test")
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -11,74 +11,74 @@ o.spec("throttle", function() {
|
|||
spy = o.spy()
|
||||
throttled = throttle(spy)
|
||||
})
|
||||
|
||||
|
||||
o("runs first call synchronously", function() {
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
})
|
||||
|
||||
|
||||
o("throttles subsequent synchronous calls", function(done) {
|
||||
throttled()
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
o(spy.callCount).equals(2)
|
||||
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET) //this delay is much higher than 16.6ms due to setTimeout clamp and other runtime costs
|
||||
})
|
||||
|
||||
|
||||
o("calls after threshold", function(done) {
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
||||
setTimeout(function(t) {
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(2)
|
||||
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
o("throttles before threshold", function(done) {
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
||||
callAsync(function(t) {
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o("it only runs once per tick", function(done) {
|
||||
throttled()
|
||||
throttled()
|
||||
throttled()
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
o(spy.callCount).equals(2)
|
||||
|
||||
|
||||
done()
|
||||
}, FRAME_BUDGET)
|
||||
})
|
||||
|
||||
|
||||
o("it supports forcing a synchronous redraw", function() {
|
||||
throttled()
|
||||
throttled()
|
||||
throttled(true)
|
||||
|
||||
|
||||
o(spy.callCount).equals(2)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ function resolve(dir, data) {
|
|||
var replacements = []
|
||||
data = data.replace(/((?:var|let|const|)[\t ]*)([\w_$\.]+)(\s*=\s*)require\(([^\)]+)\)/g, function(match, def, variable, eq, dep) {
|
||||
usedVariables[variable] = usedVariables[variable] ? usedVariables[variable]++ : 1
|
||||
|
||||
|
||||
var filename = new Function("return " + dep).call()
|
||||
var normalized = path.resolve(dir, filename)
|
||||
var pathname = path.dirname(normalized)
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ To learn more about components, [see the components page](components.md).
|
|||
|
||||
### Lifecycle methods
|
||||
|
||||
Vnodes and components can have lifecycle methods (also known as *hooks*), which are called at various points during the lifetime of a DOM element. The lifecycle methods supported by Mithril are: `oninit`, `oncreate`, `onupdate`, `onbeforeremove`, `onremove`, and `onbeforeupdate`.
|
||||
Vnodes and components can have lifecycle methods (also known as *hooks*), which are called at various points during the lifetime of a DOM element. The lifecycle methods supported by Mithril are: `oninit`, `oncreate`, `onupdate`, `onbeforeremove`, `onremove`, and `onbeforeupdate`.
|
||||
|
||||
Lifecycle methods are defined in the same way as DOM event handlers, but receive the vnode as an argument, instead of an Event object:
|
||||
|
||||
|
|
@ -307,7 +307,7 @@ m("ul", users.map(function(u) { // <ul>
|
|||
})) // </ul>
|
||||
|
||||
// ES6:
|
||||
// m("ul", users.map(u =>
|
||||
// m("ul", users.map(u =>
|
||||
// m("li", u.name)
|
||||
// ))
|
||||
```
|
||||
|
|
@ -390,7 +390,7 @@ var BadListComponent = {
|
|||
for (var i = 0; i < vnode.attrs.items.length; i++) {
|
||||
list.push(m("li", vnode.attrs.items[i]))
|
||||
}
|
||||
|
||||
|
||||
return m("ul", list)
|
||||
}
|
||||
}
|
||||
|
|
@ -407,4 +407,4 @@ var BetterListComponent = {
|
|||
}))
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
|
|
|||
|
|
@ -204,4 +204,4 @@ If a design-based solution is not feasible, and you must optimize a UI with a la
|
|||
|
||||
Avoid applying the optimization to other areas of your application "just-in-case". Remember that, generally speaking, more code incurs a higher maintenance cost than less code, and `onbeforeupdate` related bugs can be especially difficult to troubleshoot if you rely on object identity for its conditional checks.
|
||||
|
||||
Again, **the `onbeforeupdate` hook should only be used as a last resort.**
|
||||
Again, **the `onbeforeupdate` hook should only be used as a last resort.**
|
||||
|
|
|
|||
|
|
@ -32,4 +32,3 @@ This method is internally called by [`m.mount()`](mount.md), [`m.route()`](route
|
|||
The `m.render` module is similar in scope to view libraries like Knockout, React and Vue. It is less than 500 lines of code (3kb min+gzip) and implements a virtual DOM diffing engine with a modern search space reduction algorithm and DOM recycling, which translate to top-of-class performance, both in terms of initial page load and re-rendering. It has no dependencies on other parts of Mithril and can be used as a standalone library.
|
||||
|
||||
Despite being incredibly small, the render module is fully functional and self-suficient. It supports everything you might expect: SVG, custom elements, and all valid attributes and events - without any weird case-sensitive edge cases or exceptions. Of course, it also fully supports [components](components.md) and [lifecycle methods](lifecycle-methods.md).
|
||||
|
||||
|
|
|
|||
|
|
@ -105,10 +105,10 @@ Here's the example snippet for the [Facebook Like button](https://developers.fac
|
|||
}(document, 'script', 'facebook-jssdk'));</script>
|
||||
|
||||
<!-- Your like button code -->
|
||||
<div class="fb-like"
|
||||
data-href="http://www.your-domain.com/your-page.html"
|
||||
data-layout="standard"
|
||||
data-action="like"
|
||||
<div class="fb-like"
|
||||
data-href="http://www.your-domain.com/your-page.html"
|
||||
data-layout="standard"
|
||||
data-action="like"
|
||||
data-show-faces="true">
|
||||
</div>
|
||||
```
|
||||
|
|
@ -153,4 +153,4 @@ Unicode characters for accented characters can be typed using a keyboard layout
|
|||
|
||||
All characters that are representable as HTML entities have unicode counterparts, including non-visible characters such as ` ` and `­`.
|
||||
|
||||
To avoid encoding issues, you should set the file encoding to UTF-8 on the Javascript file, as well as add the `<meta charset="utf-8">` meta tag in the host HTML file.
|
||||
To avoid encoding issues, you should set the file encoding to UTF-8 on the Javascript file, as well as add the `<meta charset="utf-8">` meta tag in the host HTML file.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
Migrating from `v0.2.x` to `v1.x`
|
||||
=================================
|
||||
# Migrating from `v0.2.x` to `v1.x`
|
||||
|
||||
`v1.x` is largely API-compatible with `v0.2.x`, but there are a few breaking changes.
|
||||
|
||||
|
|
@ -11,6 +10,7 @@ Migrating from `v0.2.x` to `v1.x`
|
|||
- [`m.route` and anchor tags](#mroute-and-anchor-tags)
|
||||
- [Reading/writing the current route](#readingwriting-the-current-route)
|
||||
- [Accessing route params](#accessing-route-params)
|
||||
- [Setting route prefix](#setting-route-prefix)
|
||||
|
||||
## `config` function
|
||||
|
||||
|
|
@ -84,10 +84,10 @@ In `v1.x` there is no more `controller` property in components, use `oninit` ins
|
|||
m.mount(document.body, {
|
||||
controller : function() {
|
||||
var ctrl = this;
|
||||
|
||||
|
||||
ctrl.fooga = 1;
|
||||
},
|
||||
|
||||
|
||||
view : function(ctrl) {
|
||||
return m("p", ctrl.fooga);
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ m.mount(document.body, {
|
|||
oninit : function(vnode) {
|
||||
vnode.state.fooga = 1;
|
||||
},
|
||||
|
||||
|
||||
view : function(vnode) {
|
||||
return m("p", vnode.state.fooga);
|
||||
}
|
||||
|
|
@ -112,13 +112,13 @@ m.mount(document.body, {
|
|||
m.mount(document.body, {
|
||||
oninit : function(vnode) {
|
||||
var ctrl = this; // this is bound to vnode.state by default
|
||||
|
||||
|
||||
ctrl.fooga = 1;
|
||||
},
|
||||
|
||||
|
||||
view : function(vnode) {
|
||||
var ctrl = this; // this is bound to vnode.state by default
|
||||
|
||||
|
||||
return m("p", ctrl.fooga);
|
||||
}
|
||||
});
|
||||
|
|
@ -135,7 +135,7 @@ var component = {
|
|||
controller : function(options) {
|
||||
// options.fooga === 1
|
||||
},
|
||||
|
||||
|
||||
view : function(ctrl, options) {
|
||||
// options.fooga == 1
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ var component = {
|
|||
oninit : function(vnode) {
|
||||
// vnode.attrs.fooga === 1
|
||||
},
|
||||
|
||||
|
||||
view : function(vnode) {
|
||||
// vnode.attrs.fooga == 1
|
||||
}
|
||||
|
|
@ -254,3 +254,19 @@ m.route(document.body, "/booga", {
|
|||
}
|
||||
});
|
||||
```
|
||||
|
||||
## Setting route prefix
|
||||
|
||||
In `v0.2.x` the route prefix could be set by assigning a string of `"pathname"`, `"hash"`, or `"search"` to `m.route.mode`. In `v1.x` this has been replaced by `m.route.prefix` which is a setter function. Passing it an empty string is analogous to using pathname mode. Other options include passing `"#"` for hash and `"?"` for search.
|
||||
|
||||
### `v0.2.x`
|
||||
|
||||
```js
|
||||
m.route.mode = "pathname";
|
||||
```
|
||||
|
||||
### `v1.x`
|
||||
|
||||
```js
|
||||
m.route.prefix("");
|
||||
```
|
||||
|
|
|
|||
|
|
@ -99,4 +99,4 @@ Only element tag names and components can be the first argument of the `m()` fun
|
|||
|
||||
The `mithril/render/node` module is used by Mithril to generate all vnodes. This ensures modern Javascript engines can optimize virtual dom diffing by always compiling vnodes to the same hidden class.
|
||||
|
||||
When creating libraries that emit vnodes, you should use this module instead of writing naked Javascript objects in order to ensure a high level of rendering performance.
|
||||
When creating libraries that emit vnodes, you should use this module instead of writing naked Javascript objects in order to ensure a high level of rendering performance.
|
||||
|
|
|
|||
|
|
@ -54,11 +54,11 @@ function run() {
|
|||
cells = cells === full ? empty : full
|
||||
|
||||
renderer.render(root, [view()])
|
||||
|
||||
|
||||
setTimeout(run, 2000)
|
||||
}
|
||||
|
||||
run()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
4
examples/dbmonster/angular/app.js
vendored
4
examples/dbmonster/angular/app.js
vendored
|
|
@ -35,7 +35,7 @@ var AppComponent = ng.core.Component({selector: "my-app"})
|
|||
var self = this
|
||||
self.databases = ENV.generateData(true).toArray()
|
||||
setTimeout(function() {self.update()}, ENV.timeout)
|
||||
|
||||
|
||||
if (renderStage === 0) {
|
||||
renderStage = 1
|
||||
perfMonitor.startProfile("render")
|
||||
|
|
@ -52,4 +52,4 @@ var AppComponent = ng.core.Component({selector: "my-app"})
|
|||
document.addEventListener("DOMContentLoaded", function() {
|
||||
ng.core.enableProdMode()
|
||||
ng.platform.browser.bootstrap(AppComponent)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -15,4 +15,4 @@
|
|||
<script src="https://localvoid.github.io/perf-monitor/0.1/perf-monitor.js"></script>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ var MemoryStats = function (){
|
|||
if( perf.memory.totalJSHeapSize === 0 ){
|
||||
console.warn('totalJSHeapSize === 0... performance.memory is only available in Chrome .')
|
||||
}
|
||||
|
||||
|
||||
// TODO, add a sanity check to see if values are bucketed.
|
||||
// If so, reminde user to adopt the --enable-precise-memory-info flag.
|
||||
// open -a "/Applications/Google Chrome.app" --args --enable-precise-memory-info
|
||||
|
|
@ -76,16 +76,16 @@ var MemoryStats = function (){
|
|||
var delta = perf.memory.usedJSHeapSize - lastUsedHeap;
|
||||
lastUsedHeap = perf.memory.usedJSHeapSize;
|
||||
var color = delta < 0 ? '#830' : '#131';
|
||||
|
||||
|
||||
var ms = perf.memory.usedJSHeapSize;
|
||||
msMin = Math.min( msMin, ms );
|
||||
msMax = Math.max( msMax, ms );
|
||||
msText.textContent = "Mem: " + bytesToSize(ms, 2);
|
||||
|
||||
|
||||
var normValue = ms / (30*1024*1024);
|
||||
var height = Math.min( 30, 30 - normValue * 30 );
|
||||
updateGraph( msGraph, height, color);
|
||||
|
||||
|
||||
function bytesToSize( bytes, nFractDigit ){
|
||||
var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
||||
if (bytes == 0) return 'n/a';
|
||||
|
|
@ -97,5 +97,5 @@ var MemoryStats = function (){
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ update()
|
|||
|
||||
function update() {
|
||||
data = ENV.generateData().toArray()
|
||||
|
||||
|
||||
Monitoring.renderRate.ping()
|
||||
|
||||
|
||||
m.redraw();
|
||||
|
||||
|
||||
setTimeout(update, ENV.timeout)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,11 +38,11 @@ m.mount(document.getElementById("app"), {
|
|||
|
||||
function update() {
|
||||
data = ENV.generateData().toArray()
|
||||
|
||||
|
||||
perfMonitor.startProfile("render")
|
||||
m.redraw()
|
||||
perfMonitor.endProfile("render")
|
||||
|
||||
|
||||
setTimeout(update, ENV.timeout)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,18 +14,18 @@ update()
|
|||
|
||||
function update() {
|
||||
data = ENV.generateData().toArray()
|
||||
|
||||
|
||||
perfMonitor.startProfile("render")
|
||||
render(root, view())
|
||||
perfMonitor.endProfile("render")
|
||||
|
||||
|
||||
setTimeout(update, ENV.timeout)
|
||||
}
|
||||
|
||||
function view() {
|
||||
return m("div", [
|
||||
m("table", {className: "table table-striped latest-data"}, [
|
||||
m("tbody",
|
||||
m("tbody",
|
||||
data.map(function(db) {
|
||||
return m("tr", {key: db.dbname}, [
|
||||
m("td", {className: "dbname"}, db.dbname),
|
||||
|
|
|
|||
|
|
@ -56,5 +56,5 @@ var Monitoring = Monitoring || (function() {
|
|||
memoryStats: stats,
|
||||
renderRate: renderRate
|
||||
};
|
||||
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -56,11 +56,11 @@ var DBMon = React.createClass({
|
|||
|
||||
loadSamples: function loadSamples() {
|
||||
var data = ENV.generateData(true).toArray()
|
||||
|
||||
|
||||
perfMonitor.startProfile("render")
|
||||
this.setState({databases: data})
|
||||
perfMonitor.endProfile("render")
|
||||
|
||||
|
||||
setTimeout(this.loadSamples, ENV.timeout)
|
||||
},
|
||||
|
||||
|
|
@ -85,4 +85,4 @@ var DBMon = React.createClass({
|
|||
}
|
||||
})
|
||||
|
||||
ReactDOM.render(h(DBMon, null), document.getElementById("app"))
|
||||
ReactDOM.render(h(DBMon, null), document.getElementById("app"))
|
||||
|
|
|
|||
|
|
@ -24,4 +24,3 @@ table {border-collapse:collapse;border-spacing:0;}
|
|||
|
||||
.Query {position:relative;}
|
||||
.Query:hover .popover {display:block;left:-100%;width:100%;}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,4 +31,4 @@ var Editor = {
|
|||
m.mount(document.getElementById("editor"), Editor)
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -40,4 +40,4 @@ function run() {
|
|||
run()
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -16,13 +16,13 @@ var m = require("../../render/hyperscript")
|
|||
var render = require("../../render/render")(window).render
|
||||
|
||||
//http://codepen.io/RobinVr/pen/kEoqc
|
||||
var ring = m(".top",
|
||||
m(".middle",
|
||||
var ring = m(".top",
|
||||
m(".middle",
|
||||
m("svg[preserveAspectRatio='xMidYMid meet'][version='1.1'][viewBox='0 0 584 586'][xmlns='http://www.w3.org/2000/svg'][xmlns:sketch='http://www.bohemiancoding.com/sketch/ns'][xmlns:xlink='http://www.w3.org/1999/xlink']", [
|
||||
m("title", "Group 2"),
|
||||
m("desc", "Created with Sketch."),
|
||||
m("defs"),
|
||||
m("g[fill='none'][fill-rule='evenodd'][id='Page-1'][sketch:type='MSPage'][stroke='none'][stroke-width='1.5']",
|
||||
m("g[fill='none'][fill-rule='evenodd'][id='Page-1'][sketch:type='MSPage'][stroke='none'][stroke-width='1.5']",
|
||||
m("g[id='Group-2'][opacity='0.9'][sketch:type='MSLayerGroup'][stroke='#FFFFFF'][transform='translate(1.000000, 1.000000)']", [
|
||||
m("path[d='M359.085786,10.8707797 L359.085786,85.5688806 L397.873564,24.7820036 L359.085786,10.8707797 Z'][id='Path-1'][sketch:type='MSShapeGroup']"),
|
||||
m("path[d='M388.952155,53.4828426 L440.476682,45.4269494 L406.424622,25.6072146 L388.952155,53.4828426 Z'][id='Path-2'][sketch:type='MSShapeGroup']"),
|
||||
|
|
|
|||
|
|
@ -15,726 +15,726 @@
|
|||
var m = require("../../render/hyperscript")
|
||||
var render = require("../../render/render")(window).render
|
||||
|
||||
var tiger = m("svg[id='svg2'][version='1.1'][viewBox='0 0 900 900'][xmlns='http://www.w3.org/2000/svg']",
|
||||
var tiger = m("svg[id='svg2'][version='1.1'][viewBox='0 0 900 900'][xmlns='http://www.w3.org/2000/svg']",
|
||||
m("g[fill='none'][id='g4'][transform='matrix(1.7656463,0,0,1.7656463,324.90716,255.00942)']", [
|
||||
m("g[fill='#FFF'][id='g6'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("g[fill='#FFF'][id='g6'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("path[d='m-122.3,84.285s0.1,1.894-0.73,1.875c-0.82-0.019-17.27-48.094-37.8-45.851,0,0,17.78-7.353,38.53,43.976z'][id='path8']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g10'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("g[fill='#FFF'][id='g10'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("path[d='m-118.77,81.262s-0.55,1.816-1.32,1.517c-0.77-0.298,0.11-51.104-19.95-55.978,0,0,19.22-0.864,21.27,54.461z'][id='path12']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g14'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("g[fill='#FFF'][id='g14'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("path[d='m-91.284,123.59s1.636,0.96,1.166,1.64c-0.471,0.67-49.642-12.13-59.102,6.23,0,0,3.68-18.89,57.936-7.87z'][id='path16']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g18'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("g[fill='#FFF'][id='g18'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("path[d='m-94.093,133.8s1.856,0.4,1.622,1.19c-0.233,0.79-50.939,4.13-54.129,24.53,0,0-2.46-19.08,52.507-25.72z'][id='path20']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g22'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("g[fill='#FFF'][id='g22'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("path[d='m-98.304,128.28s1.778,0.66,1.432,1.41-50.998-3.34-57.128,16.37c0,0,0.35-19.24,55.696-17.78z'][id='path24']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g26'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("g[fill='#FFF'][id='g26'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("path[d='m-109.01,110.07s1.31,1.38,0.67,1.9-44.38-25.336-58.53-10.29c0,0,8.74-17.147,57.86,8.39z'][id='path28']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g30'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("g[fill='#FFF'][id='g30'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("path[d='m-116.55,114.26s1.45,1.22,0.88,1.81c-0.58,0.59-46.97-20.148-59.32-3.6,0,0,6.74-18.023,58.44,1.79z'][id='path32']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g34'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("g[fill='#FFF'][id='g34'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("path[d='m-119.15,118.34s1.6,1,1.11,1.67c-0.49,0.66-49.27-13.56-59.25,4.51,0,0,4.22-18.77,58.14-6.18z'][id='path36']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g38'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("g[fill='#FFF'][id='g38'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("path[d='m-108.42,118.95s1.12,1.53,0.42,1.97c-0.7,0.43-40.77-30.818-56.73-17.71,0,0,10.87-15.884,56.31,15.74z'][id='path40']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g42'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("g[fill='#FFF'][id='g42'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("path[d='m-128.2,90s0.6,1.8-0.2,2-29.4-41.8-48.6-34.2c0,0,15.2-11.8,48.8,32.2z'][id='path44']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g46'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("g[fill='#FFF'][id='g46'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("path[d='m-127.5,96.979s0.97,1.629,0.23,1.996c-0.74,0.368-37.72-34.476-54.83-22.914,0,0,12.3-14.8,54.6,20.918z'][id='path48']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g50'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("g[fill='#FFF'][id='g50'][stroke='#000'][stroke-width='0.17200001']",
|
||||
m("path[d='m-127.62,101.35s1.12,1.53,0.42,1.97c-0.7,0.43-40.77-30.818-56.73-17.713,0,0,10.87-15.881,56.31,15.743z'][id='path52']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g54'][stroke='#000']",
|
||||
m("g[fill='#FFF'][id='g54'][stroke='#000']",
|
||||
m("path[d='m-129.83,103.06c0.5,6.05,1.49,12.62,3.23,15.74,0,0-3.6,12.4,5.2,25.6,0,0-0.4,7.2,1.2,10.4,0,0,4,8.4,8.8,9.2,3.88,0.65,12.607,3.72,22.468,5.12,0,0,17.132,14.08,13.932,26.88,0,0-0.4,16.4-4,18,0,0,11.6-11.2,2,5.6l-4.4,18.8s25.6-21.6,10-3.2l-10,26s19.6-18.4,12.4-10l-3.2,8.8s43.2-27.2,12.4,2.4c0,0,8-3.6,12.4-0.8,0,0,6.8-1.2,6,0.4,0,0-20.8,10.4-24.4,28.8,0,0,8.4-10,5.2,0.8l0.4,11.6s4-21.6,3.6,16c0,0,19.2-18,7.6,2.8v16.8s15.2-16.4,8.8-3.6c0,0,10-8.8,6,6.4,0,0-0.8,10.4,3.6-0.8,0,0,16-30.6,10-4.4,0,0-0.8,19.2,4,4.4,0,0,0.4,10.4,9.6,17.6,0,0-1.2-50.8,11.6-14.8l4,16.4s2.8-9.2,2.4-14.4l8,8s15.2-22.8,12-9.6c0,0-7.6,16-6,20.8,0,0,16.8-34.8,18-36.4,0,0-2,42.4,8.8,6.4,0,0,5.6,12,2.8,16.4,0,0,8-8,7.2-11.2,0,0,4.6-8.2,7.4,5.4,0,0,1.8,9.4,3.4,6.2,0,0,4,24,5.2,1.2,0,0,1.6-13.6-5.6-25.2,0,0,0.8-3.2-2-7.2,0,0,13.6,21.6,6.4-7.2,0,0,11.201,8,12.401,8,0,0-13.601-23.2-4.801-18.4,0,0-5.2-10.4,12.801,1.6,0,0-16.001-16,1.6-6.4,0,0,7.999,6.4,0.4-3.6,0,0-14.401-16,7.599,2,0,0,11.6,16.4,12.4,19.2,0,0-10-29.2-14.4-32,0,0,8.4-36.4,49.6-20.8,0,0,6.8,17.2,11.2-1.2,0,0,12.8-6.4,24,21.2,0,0,4-13.6,3.2-16.4,0,0,6.8,1.2,6,0,0,0,13.2,4.4,14.4,3.6,0,0,6.8,6.8,7.2,3.2,0,0,9.2,2.8,7.2-0.8,0,0,8.8,15.6,9.2,19.2l2.4-14,2,2.8s1.6-7.6,0.8-8.8,20,6.8,24.8,27.6l2,8.4s6-14.8,4.4-18.8c0,0,5.2,0.8,5.6,5.2,0,0,4-23.2-0.8-29.2,0,0,4.4-0.8,5.6,2.8v-7.2s7.2,0.8,7.2-1.6c0,0,4.4-4,6.4,0.8,0,0-12.4-35.2,6-16,0,0,7.2,10.8,3.6-8s-7.6-20.4-2.8-20.8c0,0,0.8-3.6-1.2-5.2s1.2,0,1.2,0,4.8,4-0.4-18c0,0,6.4,1.6-5.6-27.6,0,0,2.8-2.4-1.2-10.8,0,0,8,4.4,10.8,2.8,0,0-0.4-1.6-3.6-5.6,0,0-21.6-54.8-1.2-32.8,0,0,11.85,13.55,5.45-9.25,0,0-9.11-24.009-8.33-28.305l-429.55,23.015z'][id='path56']")
|
||||
),
|
||||
m("g[fill='#cc7226'][id='g58'][stroke='#000']",
|
||||
m("g[fill='#cc7226'][id='g58'][stroke='#000']",
|
||||
m("path[d='m299.72,80.245c0.62,0.181,2.83,1.305,4.08,2.955,0,0,6.8,10.8,1.6-7.6,0,0-9.2-28.8-0.4-17.6,0,0,6,7.2,2.8-6.4-3.86-16.427-6.4-22.8-6.4-22.8s11.6,4.8-15.2-34.8l8.8,3.6s-19.6-39.6-41.2-44.8l-8-6s38.4-38,25.6-74.8c0,0-6.8-5.2-16.4,4,0,0-6.4,4.8-12.4,3.2,0,0-30.8,1.2-32.8,1.2s-36.8-37.2-102.4-19.6c0,0-5.2,2-9.599,0.8,0,0-18.401-16-67.201,6.8,0,0-10,2-11.6,2s-4.4,0-12.4,6.4-8.4,7.2-10.4,8.8c0,0-16.4,11.2-21.2,12,0,0-11.6,6.4-16,16.4l-3.6,1.2s-1.6,7.2-2,8.4c0,0-4.8,3.6-5.6,9.2,0,0-8.8,6-8.4,10.4,0,0-1.6,5.2-2.4,10,0,0-7.2,4.8-6.4,7.6,0,0-7.6,14-6.4,20.8,0,0-6.4-0.4-9.2,2,0,0-0.8,4.8-2.4,5.2,0,0-2.8,1.2-0.4,5.2,0,0-1.6,2.8-2,4.4,0,0,0.8,2.8-3.6,8.4,0,0-6.4,18.8-4.4,24,0,0,0.4,4.8-2.4,6.4,0,0-3.6-0.4,4.8,11.6,0,0,0.8,1.2-2.4,3.6,0,0-17.2,3.6-19.6,20,0,0-13.6,14.8-13.6,20,0,2.305,0.27,5.452,0.97,10.06,0,0-0.57,8.34,27.03,9.14s402.72-31.355,402.72-31.355z'][id='path60']")
|
||||
),
|
||||
m("g[fill='#cc7226'][id='g62']",
|
||||
m("g[fill='#cc7226'][id='g62']",
|
||||
m("path[d='m-115.6,102.6c-25-39.4-10.6,17-10.6,17,8.8,34.4,138.4-3.2,138.4-3.2s168.8-30.4,180-34.4,106.4,2.4,106.4,2.4l-5.6-16.8c-64.8-46.4-84-23.2-97.6-27.2s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2-31.74-22.951-16.8,8.8c16,34-58.4,39.2-75.2,28s7.2,18.4,7.2,18.4c18.4,20-16,3.2-16,3.2-34.4-12.8-58.4,12.8-61.6,13.6s-8,4-8.8-2.4-8.31-23.101-40,3.2c-20,16.6-33.8-5.4-33.8-5.4l-2.8,11.6z'][id='path64']")
|
||||
),
|
||||
m("g[fill='#e87f3a'][id='g66']",
|
||||
m("g[fill='#e87f3a'][id='g66']",
|
||||
m("path[d='m133.51,25.346c-6.4,0.8-31.77-22.939-16.8,8.8,16.6,35.2-58.4,39.2-75.2,28-16.801-11.2,7.2,18.4,7.2,18.4,18.4,20.004-16.001,3.2-16.001,3.2-34.4-12.8-58.4,12.8-61.6,13.6s-8,4.004-8.8-2.4c-0.8-6.4-8.179-22.934-40,3.2-21.236,17.344-34.729-4.109-34.729-4.109l-3.2,10.113c-25-39.804-9.93,18.51-9.93,18.51,8.81,34.4,139.06-4.51,139.06-4.51s168.8-30.404,180-34.404,105.53,2.327,105.53,2.327l-5.53-17.309c-64.8-46.4-83.2-22.618-96.8-26.618s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z'][id='path68']")
|
||||
),
|
||||
m("g[fill='#ea8c4d'][id='g70']",
|
||||
m("g[fill='#ea8c4d'][id='g70']",
|
||||
m("path[d='m134.82,27.091c-6.4,0.8-31.14-23.229-16.8,8.8,16.2,36.201-58.401,39.201-75.201,28.001s7.2,18.4,7.2,18.4c18.4,19.998-16,3.2-16,3.2-34.4-12.8-58.401,12.8-61.601,13.6s-8,3.998-8.8-2.4c-0.8-6.4-8.048-22.767-40,3.2-22.473,18.088-35.658-2.818-35.658-2.818l-3.6,8.616c-23.8-38.998-9.25,20.02-9.25,20.02,8.8,34.4,139.71-5.82,139.71-5.82s168.8-30.398,180-34.398,104.65,2.254,104.65,2.254l-5.45-17.818c-64.8-46.4-82.4-22.037-96-26.037s-11.2,5.6-14.4,6.401c-3.2,0.8-42.4-24.001-48.8-23.201z'][id='path72']")
|
||||
),
|
||||
m("g[fill='#ec9961'][id='g74']",
|
||||
m("g[fill='#ec9961'][id='g74']",
|
||||
m("path[d='m136.13,28.837c-6.4,0.8-31.13-23.232-16.8,8.8,16.8,37.556-58.936,38.845-75.202,28-16.8-11.2,7.2,18.4,7.2,18.4,18.4,20.003-16,3.2-16,3.2-34.4-12.8-58.4,12.803-61.6,13.603s-8,4-8.8-2.403c-0.8-6.4-7.917-22.598-40.001,3.203-23.709,18.83-36.587-1.53-36.587-1.53l-4,7.13c-21.8-36.803-8.58,21.52-8.58,21.52,8.8,34.4,140.37-7.12,140.37-7.12s168.8-30.403,180-34.403,103.78,2.182,103.78,2.182l-5.38-18.327c-64.8-46.401-81.6-21.455-95.2-25.455s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z'][id='path76']")
|
||||
),
|
||||
m("g[fill='#eea575'][id='g78']",
|
||||
m("g[fill='#eea575'][id='g78']",
|
||||
m("path[d='m137.44,30.583c-6.4,0.8-30.63-23.454-16.8,8.8,16.8,39.2-58.403,39.2-75.203,28s7.2,18.4,7.2,18.4c18.4,19.997-16,3.2-16,3.2-34.4-12.8-58.4,12.797-61.6,13.597s-8,4-8.8-2.4c-0.8-6.397-7.785-22.428-40,3.2-24.946,19.58-37.507-0.23-37.507-0.23l-4.4,5.63c-19.8-34.798-7.91,23.04-7.91,23.04,8.8,34.4,141.02-8.44,141.02-8.44s168.8-30.397,180-34.397,102.91,2.109,102.91,2.109l-5.31-18.837c-64.8-46.4-80.8-20.872-94.4-24.872s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z'][id='path80']")
|
||||
),
|
||||
m("g[fill='#f1b288'][id='g82']",
|
||||
m("g[fill='#f1b288'][id='g82']",
|
||||
m("path[d='m138.75,32.328c-6.4,0.8-32.37-22.651-16.8,8.8,19.2,38.8-58.404,39.2-75.204,28s7.2,18.4,7.2,18.4c18.4,20.002-16,3.2-16,3.2-34.4-12.8-58.4,12.802-61.6,13.602s-8,4-8.8-2.4c-0.8-6.402-7.654-22.265-40,3.2-26.182,20.33-38.436,1.05-38.436,1.05l-4.8,4.15c-18-33.202-7.24,24.54-7.24,24.54,8.8,34.4,141.68-9.74,141.68-9.74s168.8-30.402,180-34.402,102.03,2.036,102.03,2.036l-5.23-19.345c-64.8-46.4-80-20.291-93.6-24.291s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z'][id='path84']")
|
||||
),
|
||||
m("g[fill='#f3bf9c'][id='g86']",
|
||||
m("g[fill='#f3bf9c'][id='g86']",
|
||||
m("path[d='m140.06,34.073c-6.4,0.8-32.75-22.46-16.8,8.8,20.4,40.001-58.405,39.201-75.205,28.001s7.2,18.4,7.2,18.4c18.4,19.996-16,3.2-16,3.2-34.4-12.8-58.4,12.796-61.6,13.596s-8,4-8.8-2.4c-0.8-6.396-7.523-22.092-40,3.2-27.419,21.08-39.365,2.35-39.365,2.35l-5.2,2.65c-16-30.196-6.56,26.06-6.56,26.06,8.8,34.4,142.32-11.06,142.32-11.06s168.8-30.396,180-34.396,101.16,1.963,101.16,1.963l-5.16-19.854c-64.8-46.4-79.2-19.709-92.8-23.709-13.6-4.001-11.2,5.6-14.4,6.4s-42.4-24.001-48.8-23.201z'][id='path88']")
|
||||
),
|
||||
m("g[fill='#f5ccb0'][id='g90']",
|
||||
m("g[fill='#f5ccb0'][id='g90']",
|
||||
m("path[d='m141.36,35.819c-6.4,0.8-33.84-21.875-16.8,8.8,22,39.6-58.396,39.2-75.196,28s7.2,18.4,7.2,18.4c18.4,20.001-16,3.2-16,3.2-34.4-12.8-58.4,12.801-61.6,13.601s-8,4-8.8-2.4c-0.8-6.401-7.391-21.928-40,3.2-28.655,21.82-40.294,3.64-40.294,3.64l-5.6,1.16c-14.4-28.401-5.89,27.56-5.89,27.56,8.8,34.4,142.98-12.36,142.98-12.36s168.8-30.401,180-34.401,100.3,1.891,100.3,1.891l-5.1-20.364c-64.8-46.4-78.4-19.127-92-23.127s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z'][id='path92']")
|
||||
),
|
||||
m("g[fill='#f8d8c4'][id='g94']",
|
||||
m("g[fill='#f8d8c4'][id='g94']",
|
||||
m("path[d='m142.67,37.565c-6.4,0.8-33.84-21.876-16.8,8.8,22,39.6-58.396,39.2-75.196,28s7.2,18.4,7.2,18.4c18.4,19.995-16,3.2-16,3.2-34.401-12.8-58.401,12.795-61.601,13.595s-8,4-8.8-2.4-7.259-21.755-40,3.2c-29.891,22.57-41.213,4.93-41.213,4.93l-6-0.33c-13.61-26.396-5.22,29.08-5.22,29.08,8.8,34.4,143.63-13.68,143.63-13.68s168.8-30.395,180-34.395,99.42,1.818,99.42,1.818l-5.01-20.873c-64.81-46.4-77.61-18.545-91.21-22.545s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z'][id='path96']")
|
||||
),
|
||||
m("g[fill='#fae5d7'][id='g98']",
|
||||
m("g[fill='#fae5d7'][id='g98']",
|
||||
m("path[d='m143.98,39.31c-6.4,0.8-33.45-22.087-16.8,8.8,22,40.8-58.397,39.2-75.197,28s7.2,18.4,7.2,18.4c18.4,20-16,3.2-16,3.2-34.4-12.8-58.4,12.8-61.6,13.6-3.201,0.8-8.001,4-8.801-2.4s-7.128-21.592-40,3.2c-31.127,23.31-42.142,6.22-42.142,6.22l-6.4-1.82c-13-24-4.55,30.58-4.55,30.58,8.8,34.4,144.29-14.98,144.29-14.98s168.8-30.4,180-34.4,98.55,1.746,98.55,1.746l-4.95-21.382c-64.8-46.401-76.8-17.964-90.4-21.964s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2z'][id='path100']")
|
||||
),
|
||||
m("g[fill='#fcf2eb'][id='g102']",
|
||||
m("g[fill='#fcf2eb'][id='g102']",
|
||||
m("path[d='m145.29,41.055c-6.4,0.8-32.37-22.644-16.8,8.8,21.2,42.801-58.398,39.201-75.198,28.001s7.2,18.4,7.2,18.4c18.4,20.004-16,3.2-16,3.2-34.4-12.8-58.4,12.804-61.6,13.604s-8,4-8.8-2.4-6.997-21.428-40,3.2c-32.365,24.05-43.072,7.5-43.072,7.5l-6.8-3.3c-12.8-23.204-3.87,32.09-3.87,32.09,8.8,34.4,144.94-16.29,144.94-16.29s168.8-30.4,180-34.404c11.2-4,97.67,1.674,97.67,1.674l-4.87-21.893c-64.8-46.4-76-17.381-89.6-21.381-13.6-4.001-11.2,5.6-14.4,6.4s-42.4-24.001-48.8-23.201z'][id='path104']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g106']",
|
||||
m("g[fill='#FFF'][id='g106']",
|
||||
m("path[d='m-115.8,119.6c-12.8-22-3.2,33.6-3.2,33.6,8.8,34.4,145.6-17.6,145.6-17.6s168.8-30.4,180-34.4,96.8,1.6,96.8,1.6l-4.8-22.4c-64.8-46.4-75.2-16.8-88.8-20.8s-11.2,5.6-14.4,6.4-42.4-24-48.8-23.2-31.62-23.007-16.8,8.8c22.23,47.707-60.759,37.627-75.2,28-16.8-11.2,7.2,18.4,7.2,18.4,18.4,20-16,3.2-16,3.2-34.4-12.8-58.4,12.8-61.6,13.6s-8,4-8.8-2.4-6.865-21.256-40,3.2c-33.6,24.8-44,8.8-44,8.8l-7.2-4.8z'][id='path108']")
|
||||
),
|
||||
m("g[fill='#000'][id='g110']",
|
||||
m("g[fill='#000'][id='g110']",
|
||||
m("path[d='m-74.2,149.6s-7.2,11.6,13.6,24.8c0,0,1.4,1.4-16.6-2.8,0,0-6.2-2-7.8-12.4,0,0-4.8-4.4-9.6-10s20.4,0.4,20.4,0.4z'][id='path112']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g114']",
|
||||
m("g[fill='#CCC'][id='g114']",
|
||||
m("path[d='m65.8,102s17.698,26.82,17.1,31.6c-1.3,10.4-1.5,20,1.7,24,3.201,4,12.001,37.2,12.001,37.2s-0.4,1.2,11.999-36.8c0,0,11.6-16-8.4-34.4,0,0-35.2-28.8-34.4-21.6z'][id='path116']")
|
||||
),
|
||||
m("g[fill='#000'][id='g118']",
|
||||
m("g[fill='#000'][id='g118']",
|
||||
m("path[d='m-54.2,176.4s11.2,7.2-3.2,38.4l6.4-2.4s-0.8,11.2-4,13.6l7.2-3.2s4.8,8,0.8,12.8c0,0,16.8,8,16,14.4,0,0,6.4-8,2.4-14.4s-11.2-2.4-10.4-20.8l-8.8,3.2s5.6-8.8,5.6-15.2l-8,2.4s15.469-26.58,4.8-28c-6-0.8-8.8-0.8-8.8-0.8z'][id='path120']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g122']",
|
||||
m("g[fill='#CCC'][id='g122']",
|
||||
m("path[d='m-21.8,193.2s2.8-4.4,0-3.6-34,15.6-40,25.2c0,0,34.4-24.4,40-21.6z'][id='path124']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g126']",
|
||||
m("g[fill='#CCC'][id='g126']",
|
||||
m("path[d='m-11.4,201.2s2.8-4.4,0-3.6-34,15.6-40,25.2c0,0,34.4-24.4,40-21.6z'][id='path128']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g130']",
|
||||
m("g[fill='#CCC'][id='g130']",
|
||||
m("path[d='m1.8,186s2.8-4.4,0-3.6-34,15.6-40,25.2c0,0,34.4-24.4,40-21.6z'][id='path132']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g134']",
|
||||
m("g[fill='#CCC'][id='g134']",
|
||||
m("path[d='m-21.4,229.6s0-6-2.8-5.2-38.8,18.4-44.8,28c0,0,42-25.6,47.6-22.8z'][id='path136']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g138']",
|
||||
m("g[fill='#CCC'][id='g138']",
|
||||
m("path[d='m-20.2,218.8s1.2-4.8-1.6-4c-2,0-28.4,11.6-34.4,21.2,0,0,29.6-21.6,36-17.2z'][id='path140']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g142']",
|
||||
m("g[fill='#CCC'][id='g142']",
|
||||
m("path[d='m-34.6,266.4-10,7.6s10.4-7.6,14-6.4c0,0-6.8,11.2-7.6,16.4,0,0,10.4-12.8,16-12.4,0,0,7.6,0.4,7.6,11.2,0,0,5.6-10.4,8.8-10,0,0,1.2,6.4,0,13.2,0,0,4-7.6,8-6,0,0,6.4-2,5.6,9.6,0,0,0,10.4-0.8,13.2,0,0,5.6-26.4,8-26.8,0,0,8-1.2,12.8,7.6,0,0-4-7.6,0.8-5.6,0,0,10.8,1.6,14,8.4,0,0-6.8-12-1.2-8.8l8,6.4s8.4,21.2,10.4,22.8c0,0-7.6-21.6-6-21.6,0,0-2-12,3.2,2.8,0,0-3.2-14,2.4-13.2s10,10.8,18.4,8.4c0,0,9.601,5.6,11.601-63.6l-124,46.8z'][id='path144']")
|
||||
),
|
||||
m("g[fill='#000'][id='g146']",
|
||||
m("g[fill='#000'][id='g146']",
|
||||
m("path[d='m-29.8,173.6s14.8-6,54.8,0c0,0,7.2,0.4,14-8.4s33.6-16,40-14l9.601,6.4,0.8,1.2s12.399,10.4,12.799,18-14.399,55.6-24,71.6c-9.6,16-19.2,28.4-38.4,26,0,0-20.8-4-46.4,0,0,0-29.2-1.6-32-9.6s11.2-23.2,11.2-23.2,4.4-8.4,3.2-22.8-0.8-42.4-5.6-45.2z'][id='path148']")
|
||||
),
|
||||
m("g[fill='#e5668c'][id='g150']",
|
||||
m("g[fill='#e5668c'][id='g150']",
|
||||
m("path[d='M-7.8,175.6c8.4,18.4-21.2,83.6-21.2,83.6-2,1.6,12.66,7.65,22.8,5.2,10.946-2.64,51.2,1.6,51.2,1.6,23.6-15.6,36.4-60,36.4-60s10.401-24-7.2-27.2c-17.6-3.2-82-3.2-82-3.2z'][id='path152']")
|
||||
),
|
||||
m("g[fill='#b23259'][id='g154']",
|
||||
m("g[fill='#b23259'][id='g154']",
|
||||
m("path[d='m-9.831,206.5c3.326-12.79,4.91-24.59,2.031-30.9,0,0,62.4,6.4,73.6-14.4,4.241-7.87,19.001,22.8,18.6,32.4,0,0-63,14.4-77.8,3.2l-16.431,9.7z'][id='path156']")
|
||||
),
|
||||
m("g[fill='#a5264c'][id='g158']",
|
||||
m("g[fill='#a5264c'][id='g158']",
|
||||
m("path[d='m-5.4,222.8s2,7.2-0.4,11.2c0,0-1.6,0.8-2.8,1.2,0,0,1.2,3.6,7.2,5.2,0,0,2,4.4,4.4,4.8s7.2,6,11.2,4.8,15.2-5.2,15.2-5.2,5.6-3.2,14.4,0.4c0,0,2.375-0.8,2.8-4.8,0.5-4.7,3.6-8.4,5.6-10.4s11.6-14.8,10.4-15.2-68,8-68,8z'][id='path160']")
|
||||
),
|
||||
m("g[fill='#ff727f'][id='g162'][stroke='#000']",
|
||||
m("g[fill='#ff727f'][id='g162'][stroke='#000']",
|
||||
m("path[d='m-9.8,174.4s-2.8,22.4,0.4,30.8,2.4,10.4,1.6,14.4,3.6,14,9.2,20l12,1.6s15.2-3.6,24.4-0.8c0,0,8.994,1.34,12.4-13.6,0,0,4.8-6.4,12-9.2s14.4-44.4,10.4-52.4-18.4-12.4-34.4,3.2-18-1.2-48,6z'][id='path164']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g166'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g166'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-8.2,249.2s-0.8-2-5.2-2.4c0,0-22.4-3.6-30.8-16,0,0-6.8-5.6-2.4,6,0,0,10.4,20.4,17.2,23.2,0,0,16.4,4,21.2-10.8z'][id='path168']")
|
||||
),
|
||||
m("g[fill='#cc3f4c'][id='g170']",
|
||||
m("g[fill='#cc3f4c'][id='g170']",
|
||||
m("path[d='m71.742,185.23c0.659-7.91,2.612-16.52,0.858-20.03-6.446-12.89-23.419-7.5-34.4,3.2-16,15.6-18-1.2-48,6,0,0-1.745,13.96-0.905,23.98,0,0,37.305-11.58,38.105-5.98,0,0,1.6-3.2,10.8-3.2s31.942-1.17,33.542-3.97z'][id='path172']")
|
||||
),
|
||||
m("g[id='g174'][stroke='#a51926'][stroke-width='2']",
|
||||
m("g[id='g174'][stroke='#a51926'][stroke-width='2']",
|
||||
m("path[d='m28.6,175.2s4.8,4.8,1.2,14.4c0,0-14.4,16-12.4,30'][id='path176']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g178'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g178'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-19.4,260s-4.4-12.8,4.4-6l3.6,3.6c-1.2,1.6-6.8,5.6-8,2.4z'][id='path180']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g182'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g182'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-14.36,261.2s-3.52-10.24,3.52-4.8l2.88,2.88c-4.56,1.28,0,3.84-6.4,1.92z'][id='path184']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g186'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g186'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-9.56,261.2s-3.52-10.24,3.52-4.8l2.88,2.88c-3.36,1.28,0,3.84-6.4,1.92z'][id='path188']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g190'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g190'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-2.96,261.4s-3.52-10.24,3.52-4.8c0,0,4.383,2.33,2.881,2.88-2.961,1.08,0,3.84-6.401,1.92z'][id='path192']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g194'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g194'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m3.52,261.32s-3.52-10.24,3.521-4.8l2.88,2.88c-0.96,1.28,0,3.84-6.401,1.92z'][id='path196']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g198'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g198'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m10.2,262s-4.8-12.4,4.4-6l3.6,3.6c-1.2,1.6,0,4.8-8,2.4z'][id='path200']")
|
||||
),
|
||||
m("g[id='g202'][stroke='#a5264c'][stroke-width='2']",
|
||||
m("g[id='g202'][stroke='#a5264c'][stroke-width='2']",
|
||||
m("path[d='m-18.2,244.8s13.2-2.8,19.2,0.4c0,0,6,1.2,7.2,0.8s4.4-0.8,4.4-0.8'][id='path204']")
|
||||
),
|
||||
m("g[id='g206'][stroke='#a5264c'][stroke-width='2']",
|
||||
m("g[id='g206'][stroke='#a5264c'][stroke-width='2']",
|
||||
m("path[d='m15.8,253.6s12-13.6,24-9.2c7.016,2.57,6-0.8,6.8-3.6s1-7,6-10'][id='path208']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g210'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g210'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m33,237.6s-4-10.8-6.8,2-6,16.4-7.6,19.2c0,0,0,5.2,8.4,4.8,0,0,10.8-0.4,11.2-3.2s-1.2-14.4-5.2-22.8z'][id='path212']")
|
||||
),
|
||||
m("g[id='g214'][stroke='#a5264c'][stroke-width='2']",
|
||||
m("g[id='g214'][stroke='#a5264c'][stroke-width='2']",
|
||||
m("path[d='m47,244.8s3.6-2.4,6-1.2'][id='path216']")
|
||||
),
|
||||
m("g[id='g218'][stroke='#a5264c'][stroke-width='2']",
|
||||
m("g[id='g218'][stroke='#a5264c'][stroke-width='2']",
|
||||
m("path[d='m53.5,228.4s2.9-4.9,7.7-5.7'][id='path220']")
|
||||
),
|
||||
m("g[fill='#b2b2b2'][id='g222']",
|
||||
m("g[fill='#b2b2b2'][id='g222']",
|
||||
m("path[d='m-25.8,265.2s18,3.2,22.4,1.6l0.4,2-20.8-1.2s-11.6-5.6-2-2.4z'][id='path224']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g226'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g226'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-11.8,172,19.6,0.8s7.2,30.8,3.6,38.4c0,0-1.2,2.8-4-2.8,0,0-18.4-32.8-21.6-34.8s1.2-1.6,2.4-1.6z'][id='path228']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g230'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g230'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-88.9,169.3s8.9,1.7,21.5,4.3c0,0,4.8,22.4,8,27.2s-0.4,4.8-4,2-18.4-16.8-20.4-21.2-5.1-12.3-5.1-12.3z'][id='path232']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g234'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g234'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-67.039,173.82s5.8,1.55,6.809,3.76c1.008,2.22-1.202,5.51-1.202,5.51s-1,3.31-2.202,1.15c-1.202-2.17-4.074-9.83-3.405-10.42z'][id='path236']")
|
||||
),
|
||||
m("g[fill='#000'][id='g238']",
|
||||
m("g[fill='#000'][id='g238']",
|
||||
m("path[d='m-67,173.6s3.6,5.2,7.2,5.2,3.982-0.41,6.8,0.2c4.6,1,4.2-1,10.8,0.2,2.64,0.48,5.2-0.4,8,0.8s6,0.4,7.2-1.6,6-6.2,6-6.2-12.8,1.8-15.6,2.6c0,0-22.4,1.2-30.4-1.2z'][id='path240']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g242'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g242'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-22.4,173.8s-6.45,3.5-6.85,5.9,5.25,6.1,5.25,6.1,2.75,4.6,3.35,2.2-0.95-13.8-1.75-14.2z'][id='path244']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g246'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g246'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-59.885,179.26s7.007,11.19,7.224-0.02c0,0,0.557-1.26-1.203-1.28-6.075-0.07-4.554-4.18-6.021,1.3z'][id='path248']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g250'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g250'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-52.707,179.51s7.921,11.19,7.285-0.09c0,0,0.007-0.33-1.746-0.48-4.747-0.42-4.402-4.94-5.539,0.57z'][id='path252']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g254'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g254'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-45.494,179.52s7.96,10.63,7.291,0.96c0,0,0.119-1.23-1.535-1.53-3.892-0.71-4.103-3.95-5.756,0.57z'][id='path256']")
|
||||
),
|
||||
m("g[fill='#FFC'][id='g258'][stroke='#000'][stroke-width='0.5']",
|
||||
m("g[fill='#FFC'][id='g258'][stroke='#000'][stroke-width='0.5']",
|
||||
m("path[d='m-38.618,179.6s7.9,11.56,8.248,1.78c0,0,1.644-1.38-0.102-1.6-5.818-0.74-5.02-5.19-8.146-0.18z'][id='path260']")
|
||||
),
|
||||
m("g[fill='#e5e5b2'][id='g262']",
|
||||
m("g[fill='#e5e5b2'][id='g262']",
|
||||
m("path[d='m-74.792,183.13-7.658-1.53c-2.6-5-4.7-11.15-4.7-11.15s6.35,1,18.85,3.8c0,0,0.876,3.32,2.348,9.11l-8.84-0.23z'][id='path264']")
|
||||
),
|
||||
m("g[fill='#e5e5b2'][id='g266']",
|
||||
m("g[fill='#e5e5b2'][id='g266']",
|
||||
m("path[d='m-9.724,178.47c-1.666-2.51-2.983-4.26-3.633-4.67-3.013-1.88,1.13-1.51,2.259-1.51l18.454,0.76s0.524,2.24,1.208,5.63c0,0-10.088-2.01-18.288-0.21z'][id='path268']")
|
||||
),
|
||||
m("g[fill='#cc7226'][id='g270']",
|
||||
m("g[fill='#cc7226'][id='g270']",
|
||||
m("path[d='m43.88,40.321c27.721,3.96,53.241-31.68,55.001-41.361,1.759-9.68-8.36-21.56-8.36-21.56,1.32-3.08-3.52-17.16-8.8-26.4s-21.181-8.266-38.721-9.24c-15.84-0.88-34.32,22.44-35.64,24.2s4.84,40.041,6.16,45.761-1.32,32.12-1.32,32.12c34.24-9.1,3.96-7.48,31.68-3.52z'][id='path272']")
|
||||
),
|
||||
m("g[fill='#ea8e51'][id='g274']",
|
||||
m("g[fill='#ea8e51'][id='g274']",
|
||||
m("path[d='m8.088-33.392c-1.296,1.728,4.752,39.313,6.048,44.929s-1.296,31.536-1.296,31.536c32.672-8.88,3.888-7.344,31.104-3.456,27.217,3.888,52.273-31.104,54.001-40.609,1.728-9.504-8.208-21.168-8.208-21.168,1.296-3.024-3.456-16.848-8.64-25.92s-20.795-8.115-38.017-9.072c-15.552-0.864-33.696,22.032-34.992,23.76z'][id='path276']")
|
||||
),
|
||||
m("g[fill='#efaa7c'][id='g278']",
|
||||
m("g[fill='#efaa7c'][id='g278']",
|
||||
m("path[d='m8.816-32.744c-1.272,1.696,4.664,38.585,5.936,44.097s-1.272,30.952-1.272,30.952c31.404-9.16,3.816-7.208,30.528-3.392,26.713,3.816,51.305-30.528,53.001-39.857,1.696-9.328-8.056-20.776-8.056-20.776,1.272-2.968-3.392-16.536-8.48-25.44s-20.41-7.965-37.313-8.904c-15.264-0.848-33.072,21.624-34.344,23.32z'][id='path280']")
|
||||
),
|
||||
m("g[fill='#f4c6a8'][id='g282']",
|
||||
m("g[fill='#f4c6a8'][id='g282']",
|
||||
m("path[d='m9.544-32.096c-1.248,1.664,4.576,37.857,5.824,43.265s-1.248,30.368-1.248,30.368c29.436-9.04,3.744-7.072,29.952-3.328,26.209,3.744,50.337-29.952,52.001-39.104,1.664-9.153-7.904-20.385-7.904-20.385,1.248-2.912-3.328-16.224-8.32-24.96s-20.025-7.815-36.609-8.736c-14.976-0.832-32.448,21.216-33.696,22.88z'][id='path284']")
|
||||
),
|
||||
m("g[fill='#f9e2d3'][id='g286']",
|
||||
m("g[fill='#f9e2d3'][id='g286']",
|
||||
m("path[d='m10.272-31.448c-1.224,1.632,4.488,37.129,5.712,42.433s-1.224,29.784-1.224,29.784c27.868-8.92,3.672-6.936,29.376-3.264,25.705,3.672,49.369-29.376,51.001-38.353,1.632-8.976-7.752-19.992-7.752-19.992,1.224-2.856-3.264-15.912-8.16-24.48s-19.64-7.665-35.905-8.568c-14.688-0.816-31.824,20.808-33.048,22.44z'][id='path288']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g290']",
|
||||
m("g[fill='#FFF'][id='g290']",
|
||||
m("path[d='M44.2,36.8c25.2,3.6,48.401-28.8,50.001-37.6s-7.6-19.6-7.6-19.6c1.2-2.8-3.201-15.6-8.001-24s-19.254-7.514-35.2-8.4c-14.4-0.8-31.2,20.4-32.4,22s4.4,36.4,5.6,41.6-1.2,29.2-1.2,29.2c25.5-8.6,3.6-6.8,28.8-3.2z'][id='path292']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g294']",
|
||||
m("g[fill='#CCC'][id='g294']",
|
||||
m("path[d='m90.601,2.8s-27.801,7.6-39.401,6c0,0-15.8-6.6-24.6,15.2,0,0-3.6,7.2-5.6,9.2s69.601-30.4,69.601-30.4z'][id='path296']")
|
||||
),
|
||||
m("g[fill='#000'][id='g298']",
|
||||
m("g[fill='#000'][id='g298']",
|
||||
m("path[d='m94.401,0.6s-29.001,12.2-39.001,11.8c0,0-16.4-4.6-24.8,10,0,0-8.4,9.2-11.6,10.8,0,0-0.4,1.6,6-2.4l10.4,5.2s14.8,9.6,24.4-6.4c0,0,4-11.2,4-13.2s21.2-7.6,22.801-8c1.6-0.4,8.2-4.6,7.8-7.8z'][id='path300']")
|
||||
),
|
||||
m("g[fill='#99cc32'][id='g302']",
|
||||
m("g[fill='#99cc32'][id='g302']",
|
||||
m("path[d='m47,36.514c-6.872,0-15.245-3.865-15.245-10.114,0-6.248,8.373-12.513,15.245-12.513,6.874,0,12.446,5.065,12.446,11.313,0,6.249-5.572,11.314-12.446,11.314z'][id='path304']")
|
||||
),
|
||||
m("g[fill='#659900'][id='g306']",
|
||||
m("g[fill='#659900'][id='g306']",
|
||||
m("path[d='m43.377,19.83c-4.846,0.722-9.935,2.225-9.863,2.009,1.54-4.619,7.901-7.952,13.486-7.952,4.296,0,8.084,1.978,10.32,4.988,0,0-5.316-0.33-13.943,0.955z'][id='path308']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g310']",
|
||||
m("g[fill='#FFF'][id='g310']",
|
||||
m("path[d='m55.4,19.6s-4.4-3.2-4.4-1c0,0,3.6,4.4,4.4,1z'][id='path312']")
|
||||
),
|
||||
m("g[fill='#000'][id='g314']",
|
||||
m("g[fill='#000'][id='g314']",
|
||||
m("path[d='m45.4,27.726c-2.499,0-4.525-2.026-4.525-4.526,0-2.499,2.026-4.525,4.525-4.525,2.5,0,4.526,2.026,4.526,4.525,0,2.5-2.026,4.526-4.526,4.526z'][id='path316']")
|
||||
),
|
||||
m("g[fill='#cc7226'][id='g318']",
|
||||
m("g[fill='#cc7226'][id='g318']",
|
||||
m("path[d='m-58.6,14.4s-3.2-21.2-0.8-25.6c0,0,10.8-10,10.4-13.6,0,0-0.4-18-1.6-18.8s-8.8-6.8-14.8-0.4c0,0-10.4,18-9.6,24.4v2s-7.6-0.4-9.2,1.6c0,0-1.2,5.2-2.4,5.6,0,0-2.8,2.4-0.8,5.2,0,0-2,2.4-1.6,6.4l7.6,4s2,14.4,12.8,19.6c4.836,2.329,8-4.4,10-10.4z'][id='path320']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g322']",
|
||||
m("g[fill='#FFF'][id='g322']",
|
||||
m("path[d='m-59.6,12.56s-2.88-19.08-0.72-23.04c0,0,9.72-9,9.36-12.24,0,0-0.36-16.2-1.44-16.92s-7.92-6.12-13.32-0.36c0,0-9.36,16.2-8.64,21.96v1.8s-6.84-0.36-8.28,1.44c0,0-1.08,4.68-2.16,5.04,0,0-2.52,2.16-0.72,4.68,0,0-1.8,2.16-1.44,5.76l6.84,3.6s1.8,12.96,11.52,17.64c4.352,2.095,7.2-3.96,9-9.36z'][id='path324']")
|
||||
),
|
||||
m("g[fill='#eb955c'][id='g326']",
|
||||
m("g[fill='#eb955c'][id='g326']",
|
||||
m("path[d='m-51.05-42.61c-1.09-0.86-8.58-6.63-14.43-0.39,0,0-10.14,17.55-9.36,23.79v1.95s-7.41-0.39-8.97,1.56c0,0-1.17,5.07-2.34,5.46,0,0-2.73,2.34-0.78,5.07,0,0-1.95,2.34-1.56,6.24l7.41,3.9s1.95,14.04,12.48,19.11c4.714,2.27,7.8-4.29,9.75-10.14,0,0-3.12-20.67-0.78-24.96,0,0,10.53-9.75,10.14-13.26,0,0-0.39-17.55-1.56-18.33z'][id='path328']")
|
||||
),
|
||||
m("g[fill='#f2b892'][id='g330']",
|
||||
m("g[fill='#f2b892'][id='g330']",
|
||||
m("path[d='m-51.5-41.62c-0.98-0.92-8.36-6.46-14.06-0.38,0,0-9.88,17.1-9.12,23.18v1.9s-7.22-0.38-8.74,1.52c0,0-1.14,4.94-2.28,5.32,0,0-2.66,2.28-0.76,4.94,0,0-1.9,2.28-1.52,6.08l7.22,3.8s1.9,13.68,12.16,18.62c4.594,2.212,7.6-4.18,9.5-9.88,0,0-3.04-20.14-0.76-24.32,0,0,10.26-9.5,9.88-12.92,0,0-0.38-17.1-1.52-17.86z'][id='path332']")
|
||||
),
|
||||
m("g[fill='#f8dcc8'][id='g334']",
|
||||
m("g[fill='#f8dcc8'][id='g334']",
|
||||
m("path[d='m-51.95-40.63c-0.87-0.98-8.14-6.29-13.69-0.37,0,0-9.62,16.65-8.88,22.57v1.85s-7.03-0.37-8.51,1.48c0,0-1.11,4.81-2.22,5.18,0,0-2.59,2.22-0.74,4.81,0,0-1.85,2.22-1.48,5.92l7.03,3.7s1.85,13.32,11.84,18.13c4.473,2.154,7.4-4.07,9.25-9.62,0,0-2.96-19.61-0.74-23.68,0,0,9.99-9.25,9.62-12.58,0,0-0.37-16.65-1.48-17.39z'][id='path336']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g338']",
|
||||
m("g[fill='#FFF'][id='g338']",
|
||||
m("path[d='m-59.6,12.46s-2.88-18.98-0.72-22.94c0,0,9.72-9,9.36-12.24,0,0-0.36-16.2-1.44-16.92-0.76-1.04-7.92-6.12-13.32-0.36,0,0-9.36,16.2-8.64,21.96v1.8s-6.84-0.36-8.28,1.44c0,0-1.08,4.68-2.16,5.04,0,0-2.52,2.16-0.72,4.68,0,0-1.8,2.16-1.44,5.76l6.84,3.6s1.8,12.96,11.52,17.64c4.352,2.095,7.2-4.06,9-9.46z'][id='path340']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g342']",
|
||||
m("g[fill='#CCC'][id='g342']",
|
||||
m("path[d='m-62.7,6.2s-21.6-10.2-22.5-11c0,0,9.1,8.2,9.9,8.2s12.6,2.8,12.6,2.8z'][id='path344']")
|
||||
),
|
||||
m("g[fill='#000'][id='g346']",
|
||||
m("g[fill='#000'][id='g346']",
|
||||
m("path[d='m-79.8,0s18.4,3.6,18.4,8c0,2.912-0.243,16.331-5.6,14.8-8.4-2.4-4.8-16.8-12.8-22.8z'][id='path348']")
|
||||
),
|
||||
m("g[fill='#99cc32'][id='g350']",
|
||||
m("g[fill='#99cc32'][id='g350']",
|
||||
m("path[d='m-71.4,3.8s8.978,1.474,10,4.2c0.6,1.6,1.263,9.908-4.2,11-4.552,0.911-6.782-9.31-5.8-15.2z'][id='path352']")
|
||||
),
|
||||
m("g[fill='#000'][id='g354']",
|
||||
m("g[fill='#000'][id='g354']",
|
||||
m("path[d='m14.595,46.349c-0.497-1.742,0.814-1.611,2.605-2.149,2-0.6,14.2-4.4,15-7s14,1.8,14,1.8c1.8,0.8,6.2,3.4,6.2,3.4,4.8,1.2,11.4,1.6,11.4,1.6,2.4,1,5.8,3.8,5.8,3.8,14.6,10.2,27.001,3,27.001,3,19.999-6.6,13.999-23.8,13.999-23.8-3-9,0.2-12.4,0.2-12.4,0.2-3.8,7.4,2.6,7.4,2.6,2.6,4.2,3.4,9.2,3.4,9.2,8,11.2,4.6-6.6,4.6-6.6,0.2-1-2.6-4.6-2.6-5.8s-1.8-4.6-1.8-4.6c-3-3.4-0.6-10.4-0.6-10.4,1.8-13.8-0.4-12-0.4-12-1.2-1.8-10.4,8.2-10.4,8.2-2.2,3.4-8.2,5-8.2,5-2.799,1.8-6.199,0.4-6.199,0.4-2.6-0.4-8.2,6.6-8.2,6.6,2.8-0.2,5.2,4.2,7.6,4.4s4.2-2.4,5.799-3c1.6-0.6,4.4,5.2,4.4,5.2,0.4,2.6-5.2,7.4-5.2,7.4-0.4,4.6-1.999,3-1.999,3-3-0.6-4.2,3.2-5.2,7.8s-5.2,5-5.2,5c-1.6,7.4-2.801,4.4-2.801,4.4-0.2-5.6-6.2,0.2-6.2,0.2-1.2,2-5.8-0.2-5.8-0.2-6.8-2-4.4-4-4.4-4,1.8-2.2,13,0,13,0,2.2-1.6-5.8-5.6-5.8-5.6-0.6-1.8,0.4-6.2,0.4-6.2,1.2-3.2,8-8.8,8-8.8,9.401-1.2,6.601-2.8,6.601-2.8-6.2-5.2-12.001,2.4-12.001,2.4-2.2,6.2-19.6,21.2-19.6,21.2-4.8,3.4-2.2-3.4-6.2,0s-24.6-5.6-24.6-5.6c-11.562-1.193-14.294,14.549-17.823,11.429,0,0,5.418,8.52,3.818,2.92z'][id='path356']")
|
||||
),
|
||||
m("g[fill='#000'][id='g358']",
|
||||
m("g[fill='#000'][id='g358']",
|
||||
m("path[d='m209.4-120s-25.6,8-28.4,26.8c0,0-2.4,22.8,18,40.4,0,0,0.4,6.4,2.4,9.6,0,0-1.6,4.8,17.2-2.8l27.2-8.4s6.4-2.4,11.6-11.2,20.4-27.6,16.8-52.8c0,0,1.2-11.2-4.8-11.6,0,0-8.4-1.6-15.6,6,0,0-6.8,3.2-9.2,2.8l-35.2,1.2z'][id='path360']")
|
||||
),
|
||||
m("g[fill='#000'][id='g362']",
|
||||
m("g[fill='#000'][id='g362']",
|
||||
m("path[d='m264.02-120.99s2.1-8.93-2.74-4.09c0,0-7.04,5.72-14.52,5.72,0,0-14.52,2.2-18.92,15.4,0,0-3.96,26.84,3.96,32.56,0,0,4.84,7.48,11.88,0.88s22.54-36.83,20.34-50.47z'][id='path364']")
|
||||
),
|
||||
m("g[fill='#323232'][id='g366']",
|
||||
m("g[fill='#323232'][id='g366']",
|
||||
m("path[d='m263.65-120.63s2.09-8.75-2.66-3.99c0,0-6.92,5.61-14.26,5.61,0,0-14.26,2.16-18.58,15.12,0,0-3.89,26.354,3.89,31.97,0,0,4.75,7.344,11.66,0.864,6.92-6.48,22.11-36.184,19.95-49.574z'][id='path368']")
|
||||
),
|
||||
m("g[fill='#666'][id='g370']",
|
||||
m("g[fill='#666'][id='g370']",
|
||||
m("path[d='m263.27-120.27s2.08-8.56-2.58-3.9c0,0-6.78,5.51-13.99,5.51,0,0-14,2.12-18.24,14.84,0,0-3.81,25.868,3.82,31.38,0,0,4.66,7.208,11.45,0.848,6.78-6.36,21.66-35.538,19.54-48.678z'][id='path372']")
|
||||
),
|
||||
m("g[fill='#999'][id='g374']",
|
||||
m("g[fill='#999'][id='g374']",
|
||||
m("path[d='m262.9-119.92s2.07-8.37-2.51-3.79c0,0-6.65,5.41-13.73,5.41,0,0-13.72,2.08-17.88,14.56,0,0-3.75,25.372,3.74,30.78,0,0,4.58,7.072,11.23,0.832,6.66-6.24,21.23-34.892,19.15-47.792z'][id='path376']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g378']",
|
||||
m("g[fill='#CCC'][id='g378']",
|
||||
m("path[d='m262.53-119.56s2.06-8.18-2.43-3.7c0,0-6.53,5.31-13.47,5.31,0,0-13.46,2.04-17.54,14.28,0,0-3.67,24.886,3.67,30.19,0,0,4.49,6.936,11.02,0.816,6.52-6.12,20.79-34.246,18.75-46.896z'][id='path380']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g382']",
|
||||
m("g[fill='#FFF'][id='g382']",
|
||||
m("path[d='m262.15-119.2s2.05-8-2.35-3.6c0,0-6.4,5.2-13.2,5.2,0,0-13.2,2-17.2,14,0,0-3.6,24.4,3.6,29.6,0,0,4.4,6.8,10.8,0.8s20.35-33.6,18.35-46z'][id='path384']")
|
||||
),
|
||||
m("g[fill='#992600'][id='g386']",
|
||||
m("g[fill='#992600'][id='g386']",
|
||||
m("path[d='m50.6,84s-20.4-19.2-28.4-20c0,0-34.4-4-49.2,14,0,0,17.6-20.4,45.2-14.8,0,0-21.6-4.4-34-1.2l-26.4,14-2.8,4.8s4-14.8,22.4-20.8c0,0,22.8-4.8,33.6,0,0,0-21.6-6.8-31.6-4.8,0,0-30.4-2.4-43.2,24,0,0,4-14.4,18.8-21.6,0,0,13.6-8.8,34-6,0,0,14.4,3.2,19.6,5.6s4-0.4-4.4-5.2c0,0-5.6-10-19.6-9.6,0,0-42.8,3.6-53.2,15.6,0,0,13.6-11.2,24-14,0,0,22.4-8,30.8-7.2,0,0,24.8,1,32.4-3,0,0-11.2,5-8,8.2s10,10.8,10,12,24.2,23.3,27.8,27.7l2.2,2.3z'][id='path388']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g390']",
|
||||
m("g[fill='#CCC'][id='g390']",
|
||||
m("path[d='m189,278s-15.5-36.5-28-46c0,0,26,16,29.5,34,0,0,0,10-1.5,12z'][id='path392']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g394']",
|
||||
m("g[fill='#CCC'][id='g394']",
|
||||
m("path[d='m236,285.5s-26.5-55-45-79c0,0,43.5,37.5,48.5,64l0.5,5.5-3-2.5s-0.5,9-1,12z'][id='path396']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g398']",
|
||||
m("g[fill='#CCC'][id='g398']",
|
||||
m("path[d='m292.5,237s-62.5-59.5-64-62c0,0,60.5,66,63.5,73.5,0,0-2-9,0.5-11.5z'][id='path400']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g402']",
|
||||
m("g[fill='#CCC'][id='g402']",
|
||||
m("path[d='m104,280.5s19.5-52,38.5-29.5c0,0,15,10,14.5,13,0,0-4-6.5-22-6,0,0-19-3-31,22.5z'][id='path404']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g406']",
|
||||
m("g[fill='#CCC'][id='g406']",
|
||||
m("path[d='m294.5,153s-45-28.5-52.5-30c-11.81-2.36,49.5,29,54.5,39.5,0,0,2-2.5-2-9.5z'][id='path408']")
|
||||
),
|
||||
m("g[fill='#000'][id='g410']",
|
||||
m("g[fill='#000'][id='g410']",
|
||||
m("path[d='m143.8,259.6s20.4-2,27.2-8.8l4.4,3.6,17.6-38.4,3.6,5.2s14.4-14.8,13.6-22.8,12.8,6,12.8,6-0.8-11.6,6.4-4.8c0,0-2.4-15.6,6-7.6,0,0-10.54-30.16,12-4.4,5.6,6.4,1.2-0.4,1.2-0.4s-26-48-4.4-33.6c0,0,2-22.8,0.8-27.2s-3.2-26.8-8-32,0.4-6.8,6-1.6c0,0-11.2-24,2-12,0,0-3.6-15.2-8-18,0,0-5.6-17.2,9.6-6.4,0,0-4.4-12.4-7.6-15.6,0,0-11.6-27.6-4.4-22.8l4.4,3.6s-6.8-14-0.4-9.6,6.4,4,6.4,4-21.2-33.2-0.8-15.6c0,0-8.16-13.918-11.6-20.8,0,0-18.8-20.4-4.4-14l4.8,1.6s-8.8-10-16.8-11.6,2.4-8,8.8-6,22,9.6,22,9.6,12.8,18.8,16.8,19.2c0,0-20-7.6-14,0.4,0,0,14.4,14,7.2,13.6,0,0-6,7.2-1.2,16,0,0-18.46-18.391-3.6,7.2l6.8,16.4s-24.4-24.8-13.2-2.8c0,0,17.2,23.6,19.2,24s6.4,9.2,6.4,9.2l-4.4-2,5.2,8.8s-11.2-12-5.2,1.2l5.6,14.4s-20.4-22-6.8,7.6c0,0-16.4-5.2-7.6,12,0,0-1.6,16-1.2,21.2s1.6,33.6-2.8,41.6,6,27.2,8,31.2,5.6,14.8-3.2,5.6-4.4-3.6-2.4,5.2,8,24.4,7.2,30c0,0-1.2,1.2-4.4-2.4,0,0-14.8-22.8-13.2-8.4,0,0-1.2,8-4.4,16.8,0,0-3.2,10.8-3.2,2,0,0-3.2-16.8-6-9.2s-6.4,13.6-9.2,16-8-20.4-9.2-10c0,0-12-12.4-16.8,4l-11.6,16.4s-0.4-12.4-1.6-6.4c0,0-30,6-40.4,1.6z'][id='path412']")
|
||||
),
|
||||
m("g[fill='#000'][id='g414']",
|
||||
m("g[fill='#000'][id='g414']",
|
||||
m("path[d='m109.4-97.2s-11.599-8-15.599-7.6,27.599-8.8,68.799,18.8c0,0,4.8,2.8,8.4,2.4,0,0,3.2,2.4,0.4,6,0,0-8.8,9.6,2.4,20.8,0,0,18.4,6.8,12.8-2,0,0,10.8,4,13.2,8s1.2,0,1.2,0l-12.4-12.4s-5.2-2-8-10.4-5.2-18.4-0.8-21.6c0,0-4,4.4-3.2,0.4s4.4-7.6,6-8,18-16.2,24.8-16.6c0,0-9.2,1.4-12.2,0.4s-29.6-12.4-35.6-13.6c0,0-16.8-6.6-4.8-4.6,0,0,35.8,3.8,54,17,0,0-7.2-8.4-25.6-15.4,0,0-22.2-12.6-57.4-7.6,0,0-17.8,3.2-25.6,5,0,0-2.599-0.6-3.199-1s-12.401-9.4-40.001-2.4c0,0-17,4.6-25.6,9.4,0,0-15.2,1.2-18.8,4.4,0,0-18.6,14.6-20.6,15.4s-13.4,8.4-14.2,8.8c0,0,24.6-6.6,27-9s19.8-5,22.2-3.6,10.8,0.8,1.2,1.4c0,0,75.6,14.8,76.4,16.8s4.8,0.8,4.8,0.8z'][id='path416']")
|
||||
),
|
||||
m("g[fill='#cc7226'][id='g418']",
|
||||
m("g[fill='#cc7226'][id='g418']",
|
||||
m("path[d='m180.8-106.4s-10.2-7.4-12.2-7.4-14.4-10.2-18.6-9.8-16.4-9.6-43.8-1.4c0,0-0.6-2,3-2.8,0,0,6.4-2.2,6.8-2.8,0,0,20.2-4.2,27.4-0.6,0,0,9.2,2.6,15.4,8.8,0,0,11.2,3.2,14.4,2.2,0,0,8.8,2.2,9.2,4,0,0,5.8,3,4,5.6,0,0,0.4,1.6-5.6,4.2z'][id='path420']")
|
||||
),
|
||||
m("g[fill='#cc7226'][id='g422']",
|
||||
m("g[fill='#cc7226'][id='g422']",
|
||||
m("path[d='m168.33-108.51c0.81,0.63,1.83,0.73,2.43,1.54,0.24,0.31-0.05,0.64-0.37,0.74-1.04,0.31-2.1-0.26-3.24,0.33-0.4,0.21-1.04,0.03-1.6-0.12-1.63-0.44-3.46-0.47-5.15,0.22-1.98-1.13-4.34-0.54-6.42-1.55-0.06-0.02-0.28,0.32-0.36,0.3-3.04-1.15-6.79-0.87-9.22-3.15-2.43-0.41-4.78-0.87-7.21-1.55-1.82-0.51-3.23-1.5-4.85-2.33-1.38-0.71-2.83-1.23-4.37-1.61-1.86-0.45-3.69-0.34-5.58-0.86-0.1-0.02-0.29,0.32-0.37,0.3-0.32-0.11-0.62-0.69-0.79-0.64-1.68,0.52-3.17-0.45-4.83-0.11-1.18-1.22-2.9-0.98-4.45-1.42-2.97-0.85-6.12,0.42-9.15-0.58,4.11-1.84,8.8-0.61,12.86-2.68,2.33-1.18,4.99-0.08,7.56-0.84,0.49-0.15,1.18-0.35,1.58,0.32,0.14-0.14,0.32-0.37,0.38-0.35,2.44,1.16,4.76,2.43,7.24,3.5,0.34,0.15,0.88-0.09,1.13,0.12,1.52,1.21,3.46,1.11,4.85,2.33,1.7-0.5,3.49-0.12,5.22-0.75,0.08-0.02,0.31,0.32,0.34,0.3,1.14-0.75,2.29-0.48,3.18-0.18,0.34,0.12,1,0.37,1.31,0.44,1.12,0.27,1.98,0.75,3.16,0.94,0.11,0.02,0.3-0.32,0.37-0.3,1.12,0.44,2.16,0.39,2.82,1.55,0.14-0.14,0.3-0.37,0.38-0.35,1.03,0.34,1.68,1.1,2.78,1.34,0.48,0.1,1.1,0.73,1.67,0.91,2.39,0.73,4.24,2.26,6.43,3.15,0.76,0.31,1.64,0.55,2.27,1.04z'][id='path424']")
|
||||
),
|
||||
m("g[fill='#cc7226'][id='g426']",
|
||||
m("g[fill='#cc7226'][id='g426']",
|
||||
m("path[d='m91.696-122.74c-2.518-1.72-4.886-2.83-7.328-4.62-0.181-0.13-0.541,0.04-0.743-0.08-1.007-0.61-1.895-1.19-2.877-1.89-0.539-0.38-1.36-0.37-1.868-0.63-2.544-1.29-5.173-1.85-7.68-3.04,0.682-0.64,1.804-0.39,2.4-1.2,0.195,0.28,0.433,0.56,0.786,0.37,1.678-0.9,3.528-1.05,5.204-0.96,1.704,0.09,3.424,0.39,5.199,0.67,0.307,0.04,0.506,0.56,0.829,0.66,2.228,0.66,4.617,0.14,6.736,0.98,1.591,0.63,3.161,1.45,4.4,2.72,0.252,0.26-0.073,0.57-0.353,0.76,0.388-0.11,0.661,0.1,0.772,0.41,0.084,0.24,0.084,0.54,0,0.78-0.112,0.31-0.391,0.41-0.765,0.46-1.407,0.19,0.365-1.19-0.335-0.74-1.273,0.82-0.527,2.22-1.272,3.49-0.28-0.19-0.51-0.41-0.4-0.8,0.234,0.52-0.368,0.81-0.536,1.13-0.385,0.72-1.284,2.14-2.169,1.53z'][id='path428']")
|
||||
),
|
||||
m("g[fill='#cc7226'][id='g430']",
|
||||
m("g[fill='#cc7226'][id='g430']",
|
||||
m("path[d='m59.198-115.39c-3.154-0.79-6.204-0.68-9.22-1.96-0.067-0.02-0.29,0.32-0.354,0.3-1.366-0.6-2.284-1.56-3.36-2.61-0.913-0.89-2.571-0.5-3.845-0.99-0.324-0.12-0.527-0.63-0.828-0.67-1.219-0.16-2.146-1.11-3.191-1.68,2.336-0.8,4.747-0.76,7.209-1.15,0.113-0.02,0.258,0.31,0.391,0.31,0.136,0,0.266-0.23,0.4-0.36,0.195,0.28,0.497,0.61,0.754,0.35,0.548-0.54,1.104-0.35,1.644-0.31,0.144,0.01,0.269,0.32,0.402,0.32,0.136,0,0.267-0.32,0.4-0.32,0.136,0,0.267,0.32,0.4,0.32,0.136,0,0.266-0.23,0.4-0.36,0.692,0.78,1.577,0.23,2.399,0.41,1.038,0.22,1.305,1.37,2.379,1.67,4.715,1.3,8.852,3.45,13.215,5.54,0.307,0.14,0.517,0.39,0.407,0.78,0.267,0,0.58-0.09,0.77,0.04,1.058,0.74,2.099,1.28,2.796,2.38,0.216,0.34-0.113,0.75-0.346,0.7-4.429-1-8.435-1.61-12.822-2.71z'][id='path432']")
|
||||
),
|
||||
m("g[fill='#cc7226'][id='g434']",
|
||||
m("g[fill='#cc7226'][id='g434']",
|
||||
m("path[d='m45.338-71.179c-1.592-1.219-2.176-3.25-3.304-5.042-0.214-0.34,0.06-0.654,0.377-0.743,0.56-0.159,1.103,0.319,1.512,0.521,1.745,0.862,3.28,2.104,5.277,2.243,1.99,2.234,6.25,2.619,6.257,6,0.001,0.859-1.427-0.059-1.857,0.8-2.451-1.003-4.84-0.9-7.22-2.367-0.617-0.381-0.287-0.834-1.042-1.412z'][id='path436']")
|
||||
),
|
||||
m("g[fill='#cc7226'][id='g438']",
|
||||
m("g[fill='#cc7226'][id='g438']",
|
||||
m("path[d='m17.8-123.76c0.135,0,7.166,0.24,7.149,0.35-0.045,0.31-7.775,1.36-8.139,1.19-0.164-0.08-7.676,2.35-7.81,2.22,0.268-0.14,8.534-3.76,8.8-3.76z'][id='path440']")
|
||||
),
|
||||
m("g[fill='#000'][id='g442']",
|
||||
m("g[fill='#000'][id='g442']",
|
||||
m("path[d='m33.2-114s-14.8,1.8-19.2,3-23,8.8-26,10.8c0,0-13.4,5.4-30.4,25.4,0,0,7.6-3.4,9.8-6.2,0,0,13.6-12.6,13.4-10,0,0,12.2-8.6,11.6-6.4,0,0,24.4-11.2,22.4-8,0,0,21.6-4.6,20.6-2.6,0,0,18.8,4.4,16,4.6,0,0-5.8,1.2,0.6,4.8,0,0-3.4,4.4-8.8,0.4s-2.4-1.8-7.4-0.8c0,0-2.6,0.8-7.2-3.2,0,0-5.6-4.6-14.4-1,0,0-30.6,12.6-32.6,13.2,0,0-3.6,2.8-6,6.4,0,0-5.8,4.4-8.8,5.8,0,0-12.8,11.6-14,13,0,0-3.4,5.2-4.2,5.6,0,0,6.4-3.8,8.4-5.8,0,0,14-10,19.4-10.8,0,0,4.4-3,5.2-4.4,0,0,14.4-9.2,18.6-9.2,0,0,9.2,5.2,11.6-1.8,0,0,5.8-1.8,11.4-0.6,0,0,3.2-2.6,2.4-4.8,0,0,1.6-1.8,2.6,2,0,0,3.4,3.6,8.2,1.6,0,0,4-0.2,2,2.2,0,0-4.4,3.8-16.2,4,0,0-12.4,0.6-28.8,8.2,0,0-29.8,10.4-39,20.8,0,0-6.4,8.8-11.8,10,0,0-5.8,0.8-11.8,8.2,0,0,9.8-5.8,18.8-5.8,0,0,4-2.4,0.2,1.2,0,0-3.6,7.6-2,13,0,0-0.6,5.2-1.4,6.8,0,0-7.8,12.8-7.8,15.2s1.2,12.2,1.6,12.8-1-1.6,2.8,0.8,6.6,4,7.4,6.8-2-5.4-2.2-7.2-4.4-9-3.6-11.4c0,0,1,1,1.8,2.4,0,0-0.6-0.6,0-4.2,0,0,0.8-5.2,2.2-8.4s3.4-7,3.8-7.8,0.4-6.6,1.8-4l3.4,2.6s-2.8-2.6-0.6-4.8c0,0-1-5.6,0.8-8.2,0,0,7-8.4,8.6-9.4s0.2-0.6,0.2-0.6,6-4.2,0.2-2.6c0,0-4,1.6-7,1.6,0,0-7.6,2-3.6-2.2s14-9.6,17.8-9.4l0.8,1.6,11.2-2.4-1.2,0.8s-0.2-0.2,4-0.6,10,1,11.4-0.8,4.8-2.8,4.4-1.4-0.6,3.4-0.6,3.4,5-5.8,4.4-3.6-8.8,7.4-10.2,13.6l10.4-8.2,3.6-3s3.6,2.2,3.8,0.6,4.8-7.4,6-7.2,3.2-2.6,3,0,7.4,8,7.4,8,3.2-1.8,4.6-0.4,5.6-19.8,5.6-19.8l25-10.6,43.6-3.4-16.999-6.8-61.001-11.4z'][id='path444']")
|
||||
),
|
||||
m("g[id='g446'][stroke='#4c0000'][stroke-width='2']",
|
||||
m("g[id='g446'][stroke='#4c0000'][stroke-width='2']",
|
||||
m("path[d='m51.4,85s-15-16.8-23.4-19.4c0,0-13.4-6.8-38,1'][id='path448']")
|
||||
),
|
||||
m("g[id='g450'][stroke='#4c0000'][stroke-width='2']",
|
||||
m("g[id='g450'][stroke='#4c0000'][stroke-width='2']",
|
||||
m("path[d='m24.8,64.2s-25.2-8-40.6-3.8c0,0-18.4,2-26.8,15.8'][id='path452']")
|
||||
),
|
||||
m("g[id='g454'][stroke='#4c0000'][stroke-width='2']",
|
||||
m("g[id='g454'][stroke='#4c0000'][stroke-width='2']",
|
||||
m("path[d='m21.2,63s-17-7.2-31.8-9.4c0,0-16.6-2.6-33.2,4.6,0,0-12.2,6-17.6,16.2'][id='path456']")
|
||||
),
|
||||
m("g[id='g458'][stroke='#4c0000'][stroke-width='2']",
|
||||
m("g[id='g458'][stroke='#4c0000'][stroke-width='2']",
|
||||
m("path[d='m22.2,63.4s-15.4-11-16.4-12.4c0,0-7-11-20-11.4,0,0-21.4,0.8-38.6,8.8'][id='path460']")
|
||||
),
|
||||
m("g[fill='#000'][id='g462']",
|
||||
m("g[fill='#000'][id='g462']",
|
||||
m("path[d='M20.895,54.407c1.542,1.463,28.505,30.393,28.505,30.393,35.2,36.6,7.2,2.4,7.2,2.4-7.6-4.8-16.8-23.6-16.8-23.6-1.2-2.8,14,7.2,14,7.2,4,0.8,17.6,20,17.6,20-6.8-2.4-2,4.8-2,4.8,2.8,2,23.201,17.6,23.201,17.6,3.6,4,7.599,5.6,7.599,5.6,14-5.2,7.6,8,7.6,8,2.4,6.8,8-4.8,8-4.8,11.2-16.8-5.2-14.4-5.2-14.4-30,2.8-36.8-13.2-36.8-13.2-2.4-2.4,6.4,0,6.4,0,8.401,2-7.2-12.4-7.2-12.4,2.4,0,11.6,6.8,11.6,6.8,10.401,9.2,12.401,7.2,12.401,7.2,17.999-8.8,28.399-1.2,28.399-1.2,2,1.6-3.6,8.4-2,13.6s6.4,17.6,6.4,17.6c-2.4,1.6-2,12.4-2,12.4,16.8,23.2,7.2,21.2,7.2,21.2-15.6-0.4-0.8,7.2-0.8,7.2,3.2,2,12,9.2,12,9.2-2.8-1.2-4.4,4-4.4,4,4.8,4,2,8.8,2,8.8-6,1.2-7.2,5.2-7.2,5.2,6.8,8-3.2,8.4-3.2,8.4,3.6,4.4-1.2,16.4-1.2,16.4-4.8,0-11.2,5.6-11.2,5.6,2.4,4.8-8,10.4-8,10.4-8.4,1.6-5.6,8.4-5.6,8.4-7.999,6-10.399,22-10.399,22-0.8,10.4-3.2,13.6,2,11.6,5.199-2,4.399-14.4,4.399-14.4-4.799-15.6,38-31.6,38-31.6,4-1.6,4.8-6.8,4.8-6.8,2,0.4,10.8,8,10.8,8,7.6,11.2,8,2,8,2,1.2-3.6-0.4-9.6-0.4-9.6,6-21.6-8-28-8-28-10-33.6,4-25.2,4-25.2,2.8,5.6,13.6,10.8,13.6,10.8l3.6-2.4c-1.6-4.8,6.8-10.8,6.8-10.8,2.8,6.4,8.8-1.6,8.8-1.6,3.6-24.4,16-10,16-10,4,1.2,5.2-5.6,5.2-5.6,3.6-10.4,0-24,0-24,3.6-0.4,13.2,5.6,13.2,5.6,2.8-3.6-6.4-20.4-2.4-18s8.4,4,8.4,4c0.8-2-9.2-14.4-9.2-14.4-4.4-2.8-9.6-23.2-9.6-23.2,7.2,3.6-2.8-11.6-2.8-11.6,0-3.2,6-14.4,6-14.4-0.8-6.8,0-6.4,0-6.4,2.8,1.2,10.8,2.8,4-3.6s0.8-11.2,0.8-11.2c4.4-2.8-9.2-2.4-9.2-2.4-5.2-4.4-4.8-8.4-4.8-8.4,8,2-6.4-12.4-8.8-16s7.2-8.8,7.2-8.8c13.2-3.6,1.6-6.8,1.6-6.8-19.6,0.4-8.8-10.4-8.8-10.4,6,0.4,4.4-2,4.4-2-5.2-1.2-14.8-7.6-14.8-7.6-4-3.6-0.4-2.8-0.4-2.8,16.8,1.2-12-10-12-10,8,0-10-10.4-10-10.4-2-1.6-5.2-9.2-5.2-9.2-6-5.2-10.8-12-10.8-12-0.4-4.4-5.2-9.2-5.2-9.2-11.6-13.6-17.2-13.2-17.2-13.2-14.8-3.6-20-2.8-20-2.8l-52.8,4.4c-26.4,12.8-18.6,33.8-18.6,33.8,6.4,8.4,15.6,4.6,15.6,4.6,4.6-6.2,16.2-4,16.2-4,20.401,3.2,17.801-0.4,17.801-0.4-2.4-4.6-18.601-10.8-18.801-11.4s-9-4-9-4c-3-1.2-7.4-10.4-7.4-10.4-3.2-3.4,12.6,2.4,12.6,2.4-1.2,1,6.2,5,6.2,5,17.401-1,28.001,9.8,28.001,9.8,10.799,16.6,10.999,8.4,10.999,8.4,2.8-9.4-9-30.6-9-30.6,0.4-2,8.6,4.6,8.6,4.6,1.4-2,2.2,3.8,2.2,3.8,0.2,2.4,4,10.4,4,10.4,2.8,13,6.4,5.6,6.4,5.6l4.6,9.4c1.4,2.6-4.6,10.2-4.6,10.2-0.2,2.8,0.6,2.6-5,10.2s-2.2,12-2.2,12c-1.4,6.6,7.4,6.2,7.4,6.2,2.6,2.2,6,2.2,6,2.2,1.8,2,4.2,1.4,4.2,1.4,1.6-3.8,7.8-1.8,7.8-1.8,1.4-2.4,9.6-2.8,9.6-2.8,1-2.6,1.4-4.2,4.8-4.8s-21.2-43.6-21.2-43.6c6.4-0.8-1.8-13.2-1.8-13.2-2.2-6.6,9.2,8,11.4,9.4s3.2,3.6,1.6,3.4-3.4,2-2,2.2,14.4,15.2,17.8,25.4,9.4,14.2,15.6,20.2,5.4,30.2,5.4,30.2c-0.4,8.8,5.6,19.4,5.6,19.4,2,3.8-2.2,22-2.2,22-2,2.2-0.6,3-0.6,3,1,1.2,7.8,14.4,7.8,14.4-1.8-0.2,1.8,3.4,1.8,3.4,5.2,6-1.2,3-1.2,3-6-1.6,1,8.2,1,8.2,1.2,1.8-7.8-2.8-7.8-2.8-9.2-0.6,2.4,6.6,2.4,6.6,8.6,7.2-2.8,2.8-2.8,2.8-4.6-1.8-1.4,5-1.4,5,3.2,1.6,20.4,8.6,20.4,8.6,0.4,3.8-2.6,8.8-2.6,8.8,0.4,4-1.8,7.4-1.8,7.4-1.2,8.2-1.8,9-1.8,9-4.2,0.2-11.6,14-11.6,14-1.8,2.6-12,14.6-12,14.6-2,7-20-0.2-20-0.2-6.6,3.4-4.6,0-4.6,0-0.4-2.2,4.4-8.2,4.4-8.2,7-2.6,4.4-13.4,4.4-13.4,4-1.4-7.2-4.2-7-5.4s6-2.6,6-2.6c8-2,3.6-4.4,3.6-4.4-0.6-4,2.4-9.6,2.4-9.6,11.6-0.8,0-17,0-17-10.8-7.6-11.8-13.4-11.8-13.4,12.6-8.2,4.4-20.6,4.6-24.2s1.4-25.2,1.4-25.2c-2-6.2-5-19.8-5-19.8,2.2-5.2,9.6-17.8,9.6-17.8,2.8-4.2,11.6-9,9.4-12s-10-1.2-10-1.2c-7.8-1.4-7.2,3.8-7.2,3.8-1.6,1-2.4,6-2.4,6-0.72,7.933-9.6,14.2-9.6,14.2-11.2,6.2-2,10.2-2,10.2,6,6.6-3.8,6.8-3.8,6.8-11-1.8-2.8,8.4-2.8,8.4,10.8,12.8,7.8,15.6,7.8,15.6-10.2,1,2.4,10.2,2.4,10.2s-0.8-2-0.6-0.2,3.2,6,4,8-3.2,2.2-3.2,2.2c0.6,9.6-14.8,5.4-14.8,5.4l-1.6,0.2c-1.6,0.2-12.8-0.6-18.6-2.8s-12.599-2.2-12.599-2.2-4,1.8-11.601,1.6c-7.6-0.2-15.6,2.6-15.6,2.6-4.4-0.4,4.2-4.8,4.4-4.6s5.8-5.4-2.2-4.8c-21.797,1.635-32.6-8.6-32.6-8.6-2-1.4-4.6-4.2-4.6-4.2-10-2,1.4,12.4,1.4,12.4,1.2,1.4-0.2,2.4-0.2,2.4-0.8-1.6-8.6-7-8.6-7-2.811-0.973-4.174-2.307-6.505-4.793z'][id='path464']")
|
||||
),
|
||||
m("g[fill='#4c0000'][id='g466']",
|
||||
m("g[fill='#4c0000'][id='g466']",
|
||||
m("path[d='m-3,42.8s11.6,5.6,14.2,8.4,16.6,14.2,16.6,14.2-5.4-2-8-3.8-13.4-10-13.4-10-3.8-6-9.4-8.8z'][id='path468']")
|
||||
),
|
||||
m("g[fill='#99cc32'][id='g470']",
|
||||
m("g[fill='#99cc32'][id='g470']",
|
||||
m("path[d='M-61.009,11.603c0.337-0.148-0.187-2.86-0.391-3.403-1.022-2.726-10-4.2-10-4.2-0.227,1.365-0.282,2.961-0.176,4.599,0,0,4.868,5.519,10.567,3.004z'][id='path472']")
|
||||
),
|
||||
m("g[fill='#659900'][id='g474']",
|
||||
m("g[fill='#659900'][id='g474']",
|
||||
m("path[d='M-61.009,11.403c-0.449,0.158-0.015-2.734-0.191-3.203-1.022-2.726-10.2-4.3-10.2-4.3-0.227,1.365-0.282,2.961-0.176,4.599,0,0,4.268,5.119,10.567,2.904z'][id='path476']")
|
||||
),
|
||||
m("g[fill='#000'][id='g478']",
|
||||
m("g[fill='#000'][id='g478']",
|
||||
m("path[d='m-65.4,11.546c-0.625,0-1.131-1.14-1.131-2.546,0-1.405,0.506-2.545,1.131-2.545s1.132,1.14,1.132,2.545c0,1.406-0.507,2.546-1.132,2.546z'][id='path480']")
|
||||
),
|
||||
m("g[fill='#000'][id='g482']",
|
||||
m("g[fill='#000'][id='g482']",
|
||||
m("path[d='M-65.4,9z'][id='path484']")
|
||||
),
|
||||
m("g[fill='#000'][id='g486']",
|
||||
m("g[fill='#000'][id='g486']",
|
||||
m("path[d='m-111,109.6s-5.6,10,19.2,4c0,0,14-1.2,16.4-3.6,1.2,0.8,9.566,3.73,12.4,4.4,6.8,1.6,15.2-8.4,15.2-8.4s4.6-10.5,7.4-10.5-0.4,1.6-0.4,1.6-6.6,10.1-6.2,11.7c0,0-5.2,20-21.2,20.8,0,0-16.15,0.95-14.8,6.8,0,0,8.8-2.4,11.2,0,0,0,10.8-0.4,2.8,6l-6.8,11.6s0.14,3.92-10,0.4c-9.8-3.4-20.1-16.3-20.1-16.3s-15.95-14.55-5.1-28.5z'][id='path488']")
|
||||
),
|
||||
m("g[fill='#e59999'][id='g490']",
|
||||
m("g[fill='#e59999'][id='g490']",
|
||||
m("path[d='m-112.2,113.6s-2,9.6,34.8-0.8l6.8,0.8c2.4,0.8,14.4,3.6,16.4,2.4,0,0-7.2,13.6-18.8,12,0,0-13.2,1.6-12.8,6.4,0,0,4,7.2,8.8,9.6,0,0,2.8,2.4,2.4,5.6s-3.2,4.8-5.2,5.6-5.2-2.4-6.8-2.4-10-6.4-14.4-11.2-12.8-16.8-12.4-19.6,1.2-8.4,1.2-8.4z'][id='path492']")
|
||||
),
|
||||
m("g[fill='#b26565'][id='g494']",
|
||||
m("g[fill='#b26565'][id='g494']",
|
||||
m("path[d='m-109,131.05c2.6,3.95,5.8,8.15,8,10.55,4.4,4.8,12.8,11.2,14.4,11.2s4.8,3.2,6.8,2.4,4.8-2.4,5.2-5.6-2.4-5.6-2.4-5.6c-3.066-1.53-5.806-5.02-7.385-7.35,0,0,0.185,2.55-5.015,1.75s-10.4-3.6-12-6.8-4-5.6-2.4-2,4,7.2,5.6,7.6,1.2,1.6-1.2,1.2-5.2-0.8-9.6-6z'][id='path496']")
|
||||
),
|
||||
m("g[fill='#992600'][id='g498']",
|
||||
m("g[fill='#992600'][id='g498']",
|
||||
m("path[d='m-111.6,110s1.8-13.6,3-17.6c0,0-0.8-6.8,1.6-11s4.4-10.4,7.4-15.8,3.2-9.4,7.2-11,10-10.2,12.8-11.2,2.6-0.2,2.6-0.2,6.8-14.8,20.4-10.8c0,0-16.2-2.8-0.4-12.2,0,0-4.8,1.1-1.5-5.9,2.201-4.668,1.7,2.1-9.3,13.9,0,0-5,8.6-10.2,11.6s-17.2,10-18.4,13.8-4.4,9.6-6.4,11.2-4.8,5.8-5.2,9.2c0,0-1.2,4-2.6,5.2s-1.6,4.4-1.6,6.4-2,4.8-1.8,7.2c0,0,0.8,19,0.4,21l2-3.8z'][id='path500']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g502']",
|
||||
m("g[fill='#FFF'][id='g502']",
|
||||
m("path[d='m-120.2,114.6s-2-1.4-6.4,4.6c0,0,7.3,33,7.3,34.4,0,0,1.1-2.1-0.2-9.3s-2.2-19.9-2.2-19.9l1.5-9.8z'][id='path504']")
|
||||
),
|
||||
m("g[fill='#992600'][id='g506']",
|
||||
m("g[fill='#992600'][id='g506']",
|
||||
m("path[d='m-98.6,54s-17.6,3.2-17.2,32.4l-0.8,24.8s-1.2-25.6-2.4-27.2,2.8-12.8-0.4-6.8c0,0-14,14-6,35.2,0,0,1.5,3.3-1.5-1.3,0,0-4.6-12.6-3.5-19,0,0,0.2-2.2,2.1-5,0,0,8.6-11.7,11.3-14,0,0,1.8-14.4,17.2-19.6,0,0,5.7-2.3,1.2,0.5z'][id='path508']")
|
||||
),
|
||||
m("g[fill='#000'][id='g510']",
|
||||
m("g[fill='#000'][id='g510']",
|
||||
m("path[d='m40.8-12.2c0.66-0.354,0.651-1.324,1.231-1.497,1.149-0.344,1.313-1.411,1.831-2.195,0.873-1.319,1.066-2.852,1.648-4.343,0.272-0.7,0.299-1.655-0.014-2.315-1.174-2.481-1.876-4.93-3.318-7.356-0.268-0.45-0.53-1.244-0.731-1.842-0.463-1.384-1.72-2.375-2.58-3.695-0.288-0.441,0.237-1.366-0.479-1.45-0.897-0.105-2.346-0.685-2.579,0.341-0.588,2.587,0.423,5.11,1.391,7.552-0.782,0.692-0.448,1.613-0.296,2.38,0.71,3.606-0.488,6.958-1.249,10.432-0.023,0.104,0.319,0.302,0.291,0.364-1.222,2.686-2.674,5.131-4.493,7.512-0.758,0.992-1.63,1.908-2.127,2.971-0.368,0.787-0.776,1.753-0.526,2.741-3.435,2.78-5.685,6.625-8.296,10.471-0.462,0.68-0.171,1.889,0.38,2.158,0.813,0.398,1.769-0.626,2.239-1.472,0.389-0.698,0.742-1.348,1.233-1.991,0.133-0.175-0.046-0.594,0.089-0.715,2.633-2.347,4.302-5.283,6.755-7.651,1.95-0.329,3.487-1.327,5.235-2.34,0.308-0.179,0.832,0.07,1.122-0.125,1.753-1.177,1.751-3.213,1.857-5.123,0.05-0.884,0.246-2.201,1.386-2.812z'][id='path512']")
|
||||
),
|
||||
m("g[fill='#000'][id='g514']",
|
||||
m("g[fill='#000'][id='g514']",
|
||||
m("path[d='m31.959-16.666c0.124-0.077-0.031-0.5,0.078-0.716,0.162-0.324,0.565-0.512,0.727-0.836,0.109-0.216-0.054-0.596,0.082-0.738,2.333-2.447,2.59-5.471,1.554-8.444,1.024-0.62,1.085-1.882,0.66-2.729-0.853-1.7-1.046-3.626-2.021-5.169-0.802-1.269-2.38-2.513-3.751-1.21-0.421,0.4-0.742,1.187-0.464,1.899,0.064,0.163,0.349,0.309,0.322,0.391-0.107,0.324-0.653,0.548-0.659,0.82-0.03,1.496-0.984,3.007-0.354,4.336,0.772,1.629,1.591,3.486,2.267,5.262-1.234,2.116-0.201,4.565-1.954,6.442-0.136,0.146-0.127,0.532-0.005,0.734,0.292,0.486,0.698,0.892,1.184,1.184,0.202,0.121,0.55,0.123,0.75-0.001,0.578-0.362,0.976-0.849,1.584-1.225z'][id='path516']")
|
||||
),
|
||||
m("g[fill='#000'][id='g518']",
|
||||
m("g[fill='#000'][id='g518']",
|
||||
m("path[d='m94.771-26.977c1.389,1.792,1.679,4.587-0.37,5.977,0.55,3.309,3.901,1.33,5.999,0.8-0.11-0.388,0.12-0.732,0.4-0.737,1.06-0.015,1.74-1.047,2.8-0.863,0.44-1.557,2.07-2.259,2.72-3.639,1.72-3.695,1.13-7.968-1.45-11.214-0.2-0.254,0.01-0.771-0.11-1.133-0.76-2.211-2.82-2.526-4.76-3.214-1.176-3.875-1.837-7.906-3.599-11.6-1.614-0.25-2.312-1.989-3.649-2.709-1.333-0.719-1.901,0.86-1.86,1.906,0.007,0.205,0.459,0.429,0.289,0.794-0.076,0.164-0.336,0.275-0.336,0.409,0.001,0.135,0.222,0.266,0.356,0.4-0.918,0.82-2.341,1.297-2.636,2.442-0.954,3.71,1.619,6.835,3.287,10.036,0.591,1.135-0.145,2.406-0.905,3.614-0.438,0.695-0.33,1.822-0.054,2.678,0.752,2.331,2.343,4.07,3.878,6.053z'][id='path520']")
|
||||
),
|
||||
m("g[fill='#000'][id='g522']",
|
||||
m("g[fill='#000'][id='g522']",
|
||||
m("path[d='m57.611-8.591c-1.487,1.851-4.899,4.42-1.982,6.348,0.194,0.129,0.564,0.133,0.737-0.001,2.021-1.565,4.024-2.468,6.46-3.05,0.124-0.029,0.398,0.438,0.767,0.277,1.613-0.703,3.623-0.645,4.807-1.983,3.767,0.224,7.332-0.892,10.723-2.2,1.161-0.448,2.431-1.007,3.632-1.509,1.376-0.576,2.58-1.504,3.692-2.645,0.133-0.136,0.487-0.046,0.754-0.046-0.04-0.863,0.922-0.99,1.169-1.612,0.092-0.232-0.058-0.628,0.075-0.73,2.138-1.63,3.058-3.648,1.889-6.025-0.285-0.578-0.534-1.196-1.1-1.672-1.085-0.911-2.187-0.057-3.234-0.361-0.159,0.628-0.888,0.456-1.274,0.654-0.859,0.439-2.192-0.146-3.051,0.292-1.362,0.695-2.603,0.864-4.025,1.241-0.312,0.082-1.09-0.014-1.25,0.613-0.134-0.134-0.282-0.368-0.388-0.346-1.908,0.396-3.168,0.61-4.469,2.302-0.103,0.133-0.545-0.046-0.704,0.089-0.957,0.808-1.362,2.042-2.463,2.714-0.201,0.123-0.553-0.045-0.747,0.084-0.646,0.431-1.013,1.072-1.655,1.519-0.329,0.229-0.729-0.096-0.697-0.352,0.245-1.947,0.898-3.734,0.323-5.61,2.077-2.52,4.594-4.469,6.4-7.2,0.015-2.166,0.707-4.312,0.594-6.389-0.01-0.193-0.298-0.926-0.424-1.273-0.312-0.854,0.594-1.92-0.25-2.644-1.404-1.203-2.696-0.327-3.52,1.106-1.838,0.39-3.904,1.083-5.482-0.151-1.007-0.787-1.585-1.693-2.384-2.749-0.985-1.302-0.65-2.738-0.58-4.302,0.006-0.128-0.309-0.264-0.309-0.398,0.001-0.135,0.221-0.266,0.355-0.4-0.706-0.626-0.981-1.684-2-2,0.305-1.092-0.371-1.976-1.242-2.278-1.995-0.691-3.672,1.221-5.564,1.294-0.514,0.019-0.981-1.019-1.63-1.344-0.432-0.216-1.136-0.249-1.498,0.017-0.688,0.504-1.277,0.618-2.035,0.823-1.617,0.436-2.895,1.53-4.375,2.385-1.485,0.857-2.44,2.294-3.52,3.614-0.941,1.152-1.077,3.566,0.343,4.066,1.843,0.65,3.147-2.053,5.113-1.727,0.312,0.051,0.518,0.362,0.408,0.75,0.389,0.109,0.607-0.12,0.8-0.4,0.858,1.019,2.022,1.356,2.96,2.229,0.97,0.904,2.716,0.486,3.731,1.483,1.529,1.502,0.97,4.183,2.909,5.488-0.586,1.313-1.193,2.59-1.528,4.017-0.282,1.206,0.712,2.403,1.923,2.312,1.258-0.094,1.52-0.853,2.005-1.929,0.267,0.267,0.736,0.564,0.695,0.78-0.457,2.387-1.484,4.38-1.942,6.811-0.059,0.317-0.364,0.519-0.753,0.409-0.468,4.149-4.52,6.543-7.065,9.708-0.403,0.502-0.407,1.751,0.002,2.154,1.403,1.387,3.363-0.159,5.063-0.662,0.213-1.206,1.072-2.148,2.404-2.092,0.256,0.01,0.491-0.532,0.815-0.662,0.348-0.138,0.85,0.086,1.136-0.112,1.729-1.195,3.137-2.301,4.875-3.49,0.192-0.131,0.536,0.028,0.752-0.08,0.325-0.162,0.512-0.549,0.835-0.734,0.348-0.2,0.59,0.09,0.783,0.37-0.646,0.349-0.65,1.306-1.232,1.508-0.775,0.268-1.336,0.781-2.01,1.228-0.292,0.193-0.951-0.055-1.055,0.124-0.598,1.028-1.782,1.466-2.492,2.349z'][id='path524']")
|
||||
),
|
||||
m("g[fill='#000'][id='g526']",
|
||||
m("g[fill='#000'][id='g526']",
|
||||
m("path[d='m2.2-58s-9.238-2.872-20.4,22.8c0,0-2.4,5.2-4.8,7.2s-13.6,5.6-15.6,9.6l-10.4,16s14.8-16,18-18.4c0,0,8-8.4,4.8-1.6,0,0-14,10.8-12.8,20,0,0-5.6,14.4-6.4,16.4,0,0,16-32,18.4-33.2s3.6-1.2,2.4,2.4-1.6,20-4.4,22c0,0,8-20.4,7.2-23.6,0,0,3.2-3.6,5.6,1.6l-1.2,16,4.4,12s-2.4-11.2-0.8-26.8c0,0-2-10.4,2-4.8s13.6,11.6,13.6,16.4c0,0-5.2-17.6-14.4-22.4l-4,6-1.2-2s-3.6-0.8,0.8-7.6,4-7.6,4-7.6,6.4,7.2,8,7.2c0,0,13.2-7.6,14.4,16.8,0,0,6.8-14.4-2.4-21.2,0,0-14.8-2-13.6-7.2l7.2-12.4c3.6-5.2,2-2.4,2-2.4z'][id='path528']")
|
||||
),
|
||||
m("g[fill='#000'][id='g530']",
|
||||
m("g[fill='#000'][id='g530']",
|
||||
m("path[d='m-17.8-41.6-16,5.2-7.2,9.6s17.2-10,21.2-11.2,2-3.6,2-3.6z'][id='path532']")
|
||||
),
|
||||
m("g[fill='#000'][id='g534']",
|
||||
m("g[fill='#000'][id='g534']",
|
||||
m("path[d='m-57.8-35.2s-2,1.2-2.4,4-2.8,3.2-2,6,2.8,5.2,2.8,1.2,1.6-6,2.4-7.2,2.4-5.6-0.8-4z'][id='path536']")
|
||||
),
|
||||
m("g[fill='#000'][id='g538']",
|
||||
m("g[fill='#000'][id='g538']",
|
||||
m("path[d='m-66.6,26s-8.4-4-11.6-7.6-2.748,1.566-7.6,1.2c-5.847-0.441-4.8-16.4-4.8-16.4l-4,7.6s-1.2,14.4,6.8,12c3.907-1.172,5.2,0.4,3.6,1.2s5.6,1.2,2.8,2.8,11.6-3.6,9.2,6.8l5.6-7.6z'][id='path540']")
|
||||
),
|
||||
m("g[fill='#000'][id='g542']",
|
||||
m("g[fill='#000'][id='g542']",
|
||||
m("path[d='m-79.2,40.4s-15.4,4.4-19-5.2c0,0-4.8,2.4-2.6,5.4s3.4,3.4,3.4,3.4,5.4,1.2,4.8,2-3,4.2-3,4.2,10.2-6,16.4-9.8z'][id='path544']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g546']",
|
||||
m("g[fill='#FFF'][id='g546']",
|
||||
m("path[d='m149.2,118.6c-0.43,2.14-2.1,2.94-4,3.6-1.92-0.96-4.51-4.06-6.4-2-0.47-0.48-1.25-0.54-1.6-1.2-0.46-0.9-0.19-1.94-0.53-2.74-0.55-1.28-1.25-2.64-1.07-4.06,1.81-0.71,2.4-2.62,1.93-4.38-0.07-0.26-0.5-0.45-0.3-0.8,0.19-0.33,0.5-0.55,0.77-0.82-0.13,0.14-0.28,0.37-0.39,0.35-0.61-0.11-0.49-0.75-0.36-1.13,0.59-1.75,2.6-2.01,3.95-0.82,0.26-0.56,0.77-0.37,1.2-0.4-0.05-0.58,0.36-1.11,0.56-1.53,0.52-1.09,2.14,0.01,2.94-0.6,1.08-0.83,2.14-1.52,3.22-0.92,1.81,1.01,3.52,2.22,4.72,3.97,0.57,0.83,0.81,2.11,0.75,3.07-0.04,0.65-1.42,0.29-1.76,1.22-0.65,1.75,1.19,2.27,1.94,3.61,0.2,0.35-0.06,0.65-0.38,0.75-0.41,0.13-1.19-0.06-1.06,0.39,0.98,3.19-1.78,3.87-4.13,4.44z'][id='path548']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g550']",
|
||||
m("g[fill='#FFF'][id='g550']",
|
||||
m("path[d='m139.6,138.2c-0.01-1.74-1.61-3.49-0.4-5.2,0.14,0.14,0.27,0.36,0.4,0.36,0.14,0,0.27-0.22,0.4-0.36,1.5,2.22,5.15,3.14,5.01,5.99-0.03,0.45-1.11,1.37-0.21,2.01-1.81,1.35-1.87,3.72-2.8,5.6-1.24-0.28-2.45-0.65-3.6-1.2,0.35-1.48,0.24-3.17,1.06-4.49,0.43-0.7,0.14-1.78,0.14-2.71z'][id='path552']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g554']",
|
||||
m("g[fill='#CCC'][id='g554']",
|
||||
m("path[d='m-26.6,129.2s-16.858,10.14-2.8-5.2c8.8-9.6,18.8-15.2,18.8-15.2s10.4-4.4,14-5.6,18.8-6.4,22-6.8,12.8-4.4,19.6-0.4,14.8,8.4,14.8,8.4-16.4-8.4-20-6-10.8,2-16.8,5.2c0,0-14.8,4.4-18,6.4s-13.6,13.6-15.2,12.8,0.4-1.2,1.6-4-0.8-4.4-8.8,2-9.2,8.4-9.2,8.4z'][id='path556']")
|
||||
),
|
||||
m("g[fill='#000'][id='g558']",
|
||||
m("g[fill='#000'][id='g558']",
|
||||
m("path[d='m-19.195,123.23s1.41-13.04,9.888-11.37c0,0,8.226-4.17,10.948-6.14,0,0,8.139-1.7,9.449-2.32,18.479-8.698,33.198-4.179,33.745-5.299,0.546-1.119,20.171,5.999,23.78,10.079,0.391,0.45-10.231-5.59-19.929-7.48-8.273-1.617-29.875,0.24-40.781,5.78-2.973,1.51-11.918,7.29-14.449,7.18s-12.651,9.57-12.651,9.57z'][id='path560']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g562']",
|
||||
m("g[fill='#CCC'][id='g562']",
|
||||
m("path[d='m-23,148.8s-15.2-2.4,1.6-4c0,0,18-2,22-7.2,0,0,13.6-9.2,16.4-9.6s32.8-7.6,33.2-10,6-2.4,7.6-1.6,0.8,2-2,2.8-34,17.2-40.4,18.4-18,8.8-22.8,10-15.6,1.2-15.6,1.2z'][id='path564']")
|
||||
),
|
||||
m("g[fill='#000'][id='g566']",
|
||||
m("g[fill='#000'][id='g566']",
|
||||
m("path[d='m-3.48,141.4s-8.582-0.83,0.019-1.64c0,0,8.816-3.43,10.864-6.09,0,0,6.964-4.71,8.397-4.92,1.434-0.2,15.394-3.89,15.599-5.12s34.271-13.81,38.691-10.62c2.911,2.1-6.99,0.43-16.624,4.84-1.355,0.62-35.208,15.2-38.485,15.82-3.277,0.61-9.216,4.5-11.674,5.12-2.457,0.61-6.787,2.61-6.787,2.61z'][id='path568']")
|
||||
),
|
||||
m("g[fill='#000'][id='g570']",
|
||||
m("g[fill='#000'][id='g570']",
|
||||
m("path[d='m-11.4,143.6s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z'][id='path572']")
|
||||
),
|
||||
m("g[fill='#000'][id='g574']",
|
||||
m("g[fill='#000'][id='g574']",
|
||||
m("path[d='m-18.6,145.2s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z'][id='path576']")
|
||||
),
|
||||
m("g[fill='#000'][id='g578']",
|
||||
m("g[fill='#000'][id='g578']",
|
||||
m("path[d='m-29,146.8s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z'][id='path580']")
|
||||
),
|
||||
m("g[fill='#000'][id='g582']",
|
||||
m("g[fill='#000'][id='g582']",
|
||||
m("path[d='m-36.6,147.6s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z'][id='path584']")
|
||||
),
|
||||
m("g[fill='#000'][id='g586']",
|
||||
m("g[fill='#000'][id='g586']",
|
||||
m("path[d='m1.8,108,3.2,1.6c-1.2,1.6-4.4,1.2-4.4,1.2l1.2-2.8z'][id='path588']")
|
||||
),
|
||||
m("g[fill='#000'][id='g590']",
|
||||
m("g[fill='#000'][id='g590']",
|
||||
m("path[d='m-8.2,113.6s6.506-2.14,4,1.2c-1.2,1.6-3.6,0.8-3.6,0.8l-0.4-2z'][id='path592']")
|
||||
),
|
||||
m("g[fill='#000'][id='g594']",
|
||||
m("g[fill='#000'][id='g594']",
|
||||
m("path[d='m-19.4,118.4s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z'][id='path596']")
|
||||
),
|
||||
m("g[fill='#000'][id='g598']",
|
||||
m("g[fill='#000'][id='g598']",
|
||||
m("path[d='m-27,124.4s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z'][id='path600']")
|
||||
),
|
||||
m("g[fill='#000'][id='g602']",
|
||||
m("g[fill='#000'][id='g602']",
|
||||
m("path[d='m-33.8,129.2s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z'][id='path604']")
|
||||
),
|
||||
m("g[fill='#000'][id='g606']",
|
||||
m("g[fill='#000'][id='g606']",
|
||||
m("path[d='m5.282,135.6s6.921-0.53,5.324,1.6c-1.597,2.12-4.792,1.06-4.792,1.06l-0.532-2.66z'][id='path608']")
|
||||
),
|
||||
m("g[fill='#000'][id='g610']",
|
||||
m("g[fill='#000'][id='g610']",
|
||||
m("path[d='m15.682,130.8s6.921-0.53,5.324,1.6c-1.597,2.12-4.792,1.06-4.792,1.06l-0.532-2.66z'][id='path612']")
|
||||
),
|
||||
m("g[fill='#000'][id='g614']",
|
||||
m("g[fill='#000'][id='g614']",
|
||||
m("path[d='m26.482,126.4s6.921-0.53,5.324,1.6c-1.597,2.12-4.792,1.06-4.792,1.06l-0.532-2.66z'][id='path616']")
|
||||
),
|
||||
m("g[fill='#000'][id='g618']",
|
||||
m("g[fill='#000'][id='g618']",
|
||||
m("path[d='m36.882,121.6s6.921-0.53,5.324,1.6c-1.597,2.12-4.792,1.06-4.792,1.06l-0.532-2.66z'][id='path620']")
|
||||
),
|
||||
m("g[fill='#000'][id='g622']",
|
||||
m("g[fill='#000'][id='g622']",
|
||||
m("path[d='m9.282,103.6s6.921-0.53,5.324,1.6c-1.597,2.12-5.592,1.86-5.592,1.86l0.268-3.46z'][id='path624']")
|
||||
),
|
||||
m("g[fill='#000'][id='g626']",
|
||||
m("g[fill='#000'][id='g626']",
|
||||
m("path[d='m19.282,100.4s6.921-0.534,5.324,1.6c-1.597,2.12-5.992,1.86-5.992,1.86l0.668-3.46z'][id='path628']")
|
||||
),
|
||||
m("g[fill='#000'][id='g630']",
|
||||
m("g[fill='#000'][id='g630']",
|
||||
m("path[d='m-3.4,140.4s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z'][id='path632']")
|
||||
),
|
||||
m("g[fill='#992600'][id='g634']",
|
||||
m("g[fill='#992600'][id='g634']",
|
||||
m("path[d='m-76.6,41.2s-4.4,8.8-4.8,12c0,0,0.8-8.8,2-10.8s2.8-1.2,2.8-1.2z'][id='path636']")
|
||||
),
|
||||
m("g[fill='#992600'][id='g638']",
|
||||
m("g[fill='#992600'][id='g638']",
|
||||
m("path[d='m-95,55.2s-3.2,14.4-2.8,17.2c0,0-1.2-11.6-0.8-12.8s3.6-4.4,3.6-4.4z'][id='path640']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g642']",
|
||||
m("g[fill='#CCC'][id='g642']",
|
||||
m("path[d='m-74.2-19.4-0.2,3.2-2.2,0.2s14.2,12.6,14.8,20.2c0,0,0.8-8.2-12.4-23.6z'][id='path644']")
|
||||
),
|
||||
m("g[fill='#000'][id='g646']",
|
||||
m("g[fill='#000'][id='g646']",
|
||||
m("path[d='m-70.216-18.135c-0.431-0.416-0.212-1.161-0.62-1.421-0.809-0.516,1.298-0.573,1.07-1.289-0.383-1.206-0.196-1.227-0.318-2.503-0.057-0.598,0.531-2.138,0.916-2.578,1.446-1.652,0.122-4.584,1.762-6.135,0.304-0.289,0.68-0.841,0.965-1.259,0.659-0.963,1.843-1.451,2.793-2.279,0.318-0.276,0.117-1.103,0.686-1.011,0.714,0.115,1.955-0.015,1.91,0.826-0.113,2.12-1.442,3.84-2.722,5.508,0.451,0.704-0.007,1.339-0.291,1.896-1.335,2.62-1.146,5.461-1.32,8.301-0.005,0.085-0.312,0.163-0.304,0.216,0.353,2.335,0.937,4.534,1.816,6.763,0.366,0.93,0.837,1.825,0.987,2.752,0.111,0.686,0.214,1.519-0.194,2.224,2.035,2.89,0.726,5.541,1.895,9.072,0.207,0.625,1.899,2.539,1.436,2.378-2.513-0.871-2.625-1.269-2.802-2.022-0.146-0.623-0.476-2-0.713-2.602-0.064-0.164-0.235-2.048-0.313-2.17-1.513-2.382-0.155-2.206-1.525-4.564-1.428-0.68-2.394-1.784-3.517-2.946-0.198-0.204,0.945-0.928,0.764-1.141-1.092-1.289-2.245-2.056-1.909-3.549,0.155-0.69,0.292-1.747-0.452-2.467z'][id='path648']")
|
||||
),
|
||||
m("g[fill='#000'][id='g650']",
|
||||
m("g[fill='#000'][id='g650']",
|
||||
m("path[d='m-73.8-16.4s0.4,6.8,2.8,8.4,1.2,0.8-2-0.4-2-2-2-2-2.8,0.4-0.4,2.4,6,4.4,4.4,4.4-9.2-4-9.2-6.8-1-6.9-1-6.9,1.1-0.8,5.9-0.7c0,0,1.4,0.7,1.5,1.6z'][id='path652']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g654'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g654'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-74.6,2.2s-8.52-2.791-27,0.6c0,0,9.031-2.078,27.8,0.2,10.3,1.25-0.8-0.8-0.8-0.8z'][id='path656']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g658'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g658'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-72.502,2.129s-8.246-3.518-26.951-1.737c0,0,9.178-1.289,27.679,2.603,10.154,2.136-0.728-0.866-0.728-0.866z'][id='path660']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g662'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g662'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-70.714,2.222s-7.962-4.121-26.747-3.736c0,0,9.248-0.604,27.409,4.654,9.966,2.885-0.662-0.918-0.662-0.918z'][id='path664']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g666'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g666'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-69.444,2.445s-6.824-4.307-23.698-5.405c0,0,8.339,0.17,24.22,6.279,8.716,3.353-0.522-0.874-0.522-0.874z'][id='path668']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g670'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g670'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m45.84,12.961s-0.93,0.644-0.716-0.537c0.215-1.181,28.423-14.351,32.037-14.101,0,0-30.248,13.206-31.321,14.638z'][id='path672']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g674'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g674'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m42.446,13.6s-0.876,0.715-0.755-0.479,27.208-16.539,30.83-16.573c0,0-29.117,15.541-30.075,17.052z'][id='path676']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g678'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g678'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m39.16,14.975s-0.828,0.772-0.786-0.428c0.042-1.199,19.859-16.696,29.671-18.57,0,0-18.03,8.127-28.885,18.998z'][id='path680']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g682'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g682'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m36.284,16.838s-0.745,0.694-0.707-0.385c0.038-1.08,17.872-15.027,26.703-16.713,0,0-16.226,7.314-25.996,17.098z'][id='path684']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g686']",
|
||||
m("g[fill='#CCC'][id='g686']",
|
||||
m("path[d='m4.6,164.8s-15.2-2.4,1.6-4c0,0,18-2,22-7.2,0,0,13.6-9.2,16.4-9.6s19.2-4,19.6-6.4,6.4-4.8,8-4,1.6,10-1.2,10.8-21.6,8-28,9.2-18,8.8-22.8,10-15.6,1.2-15.6,1.2z'][id='path688']")
|
||||
),
|
||||
m("g[fill='#000'][id='g690']",
|
||||
m("g[fill='#000'][id='g690']",
|
||||
m("path[d='m77.6,127.4s-3,1.6-4.2,4.2c0,0-6.4,10.6-20.6,13.8,0,0-23,9-30.8,11,0,0-13.4,5-20.8,4.2,0,0-7,0.2-0.8,1.8,0,0,20.2-2,23.6-3.8,0,0,15.6-5.2,18.6-7.8s21.2-7.6,23.4-9.6,12-10.4,11.6-13.8z'][id='path692']")
|
||||
),
|
||||
m("g[fill='#000'][id='g694']",
|
||||
m("g[fill='#000'][id='g694']",
|
||||
m("path[d='m18.882,158.91s5.229-0.23,4.076,1.32-3.601,0.68-3.601,0.68l-0.475-2z'][id='path696']")
|
||||
),
|
||||
m("g[fill='#000'][id='g698']",
|
||||
m("g[fill='#000'][id='g698']",
|
||||
m("path[d='m11.68,160.26s5.228-0.22,4.076,1.33c-1.153,1.55-3.601,0.67-3.601,0.67l-0.475-2z'][id='path700']")
|
||||
),
|
||||
m("g[fill='#000'][id='g702']",
|
||||
m("g[fill='#000'][id='g702']",
|
||||
m("path[d='m1.251,161.51s5.229-0.23,4.076,1.32-3.601,0.68-3.601,0.68l-0.475-2z'][id='path704']")
|
||||
),
|
||||
m("g[fill='#000'][id='g706']",
|
||||
m("g[fill='#000'][id='g706']",
|
||||
m("path[d='m-6.383,162.06s5.229-0.23,4.076,1.32-3.601,0.67-3.601,0.67l-0.475-1.99z'][id='path708']")
|
||||
),
|
||||
m("g[fill='#000'][id='g710']",
|
||||
m("g[fill='#000'][id='g710']",
|
||||
m("path[d='m35.415,151.51s6.96-0.3,5.425,1.76c-1.534,2.07-4.793,0.9-4.793,0.9l-0.632-2.66z'][id='path712']")
|
||||
),
|
||||
m("g[fill='#000'][id='g714']",
|
||||
m("g[fill='#000'][id='g714']",
|
||||
m("path[d='m45.73,147.09s5.959-3.3,5.425,1.76c-0.27,2.55-4.793,0.9-4.793,0.9l-0.632-2.66z'][id='path716']")
|
||||
),
|
||||
m("g[fill='#000'][id='g718']",
|
||||
m("g[fill='#000'][id='g718']",
|
||||
m("path[d='m54.862,144.27s7.159-3.7,5.425,1.77c-0.778,2.44-4.794,0.9-4.794,0.9l-0.631-2.67z'][id='path720']")
|
||||
),
|
||||
m("g[fill='#000'][id='g722']",
|
||||
m("g[fill='#000'][id='g722']",
|
||||
m("path[d='m64.376,139.45s4.359-4.9,5.425,1.76c0.406,2.54-4.793,0.9-4.793,0.9l-0.632-2.66z'][id='path724']")
|
||||
),
|
||||
m("g[fill='#000'][id='g726']",
|
||||
m("g[fill='#000'][id='g726']",
|
||||
m("path[d='m26.834,156s5.228-0.23,4.076,1.32c-1.153,1.55-3.602,0.68-3.602,0.68l-0.474-2z'][id='path728']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g730'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g730'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m62.434,34.603s-0.726,0.665-0.727-0.406c0-1.07,17.484-14.334,26.327-15.718,0,0-16.099,6.729-25.6,16.124z'][id='path732']")
|
||||
),
|
||||
m("g[fill='#000'][id='g734']",
|
||||
m("g[fill='#000'][id='g734']",
|
||||
m("path[d='m65.4,98.4s22.001,22.4,31.201,26c0,0,9.199,11.2,5.199,37.2,0,0-3.199,7.6-6.399-13.2,0,0,3.2-25.2-8-9.2,0,0-8.401-9.9-2.001-9.6,0,0,3.201,2,3.601,0.4s-7.601-15.2-24.801-29.6,1.2-2,1.2-2z'][id='path736']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g738'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g738'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m7,137.2s-0.2-1.8,1.6-1,96,7,127.6,31c0,0-45.199-23.2-129.2-30z'][id='path740']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g742'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g742'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m17.4,132.8s-0.2-1.8,1.6-1,138.4-0.2,162,32.2c0,0-22-25.2-163.6-31.2z'][id='path744']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g746'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g746'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m29,128.8s-0.2-1.8,1.6-1,175.2-12.2,198.8,20.2c0,0-9.6-25.6-200.4-19.2z'][id='path748']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g750'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g750'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m39,124s-0.2-1.8,1.6-1,124-37.8,147.6-5.4c0,0-13.4-24.6-149.2,6.4z'][id='path752']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g754'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g754'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-19,146.8s-0.2-1.8,1.6-1,19.6,3,21.6,41.8c0,0-7.2-42-23.2-40.8z'][id='path756']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g758'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g758'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-27.8,148.4s-0.2-1.8,1.6-1,16-3.8,13.2,35c0,0,1.2-35.2-14.8-34z'][id='path760']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g762'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g762'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-35.8,148.8s-0.2-1.8,1.6-1,17.2,1.4,4.8,23.8c0,0,9.6-24-6.4-22.8z'][id='path764']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g766'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g766'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m11.526,104.46s-0.444,2,1.105,0.79c16.068-12.628,48.51-71.53,104.2-77.164,0,0-38.312-12.11-105.3,76.374z'][id='path768']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g770'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g770'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m22.726,102.66s-1.363-1.19,0.505-1.81c1.868-0.63,114.31-73.13,153.6-65.164,0,0-27.11-7.51-154.1,66.974z'][id='path772']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g774'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g774'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m1.885,108.77s-0.509,1.6,1.202,0.62c8.975-5.12,12.59-62.331,56.167-63.586,0,0-32.411-14.714-57.369,62.966z'][id='path776']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g778'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g778'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-18.038,119.79s-1.077,1.29,0.876,1.03c10.246-1.33,31.651-42.598,76.09-37.519,0,0-31.966-14.346-76.966,36.489z'][id='path780']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g782'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g782'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-6.8,113.67s-0.811,1.47,1.058,0.84c9.799-3.27,22.883-47.885,67.471-51.432,0,0-34.126-7.943-68.529,50.592z'][id='path784']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g786'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g786'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-25.078,124.91s-0.873,1.04,0.709,0.84c8.299-1.08,25.637-34.51,61.633-30.396,0,0-25.893-11.62-62.342,29.556z'][id='path788']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g790'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g790'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-32.677,130.82s-1.005,1.05,0.586,0.93c4.168-0.31,34.806-33.39,53.274-17.89,0,0-12.015-18.721-53.86,16.96z'][id='path792']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g794'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g794'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m36.855,98.898s-1.201-1.355,0.731-1.74c1.932-0.384,122.63-58.097,160.59-45.231,0,0-25.94-10.874-161.32,46.971z'][id='path796']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g798'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g798'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m3.4,163.2s-0.2-1.8,1.6-1,17.2,1.4,4.8,23.8c0,0,9.6-24-6.4-22.8z'][id='path800']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g802'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g802'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m13.8,161.6s-0.2-1.8,1.6-1,19.6,3,21.6,41.8c0,0-7.2-42-23.2-40.8z'][id='path804']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g806'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g806'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m20.6,160s-0.2-1.8,1.6-1,26.4,4.2,50,36.6c0,0-35.6-36.8-51.6-35.6z'][id='path808']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g810'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g810'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m28.225,157.97s-0.437-1.76,1.453-1.2c1.89,0.55,22.324-1.35,60.421,32.83,0,0-46.175-34.94-61.874-31.63z'][id='path812']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g814'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g814'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m38.625,153.57s-0.437-1.76,1.453-1.2c1.89,0.55,36.724,5.05,88.422,40.03,0,0-74.176-42.14-89.875-38.83z'][id='path816']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g818'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g818'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-1.8,142s-0.2-1.8,1.6-1,55.2,3.4,85.6,30.2c0,0-34.901-24.77-87.2-29.2z'][id='path820']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g822'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g822'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m-11.8,146s-0.2-1.8,1.6-1,26.4,4.2,50,36.6c0,0-35.6-36.8-51.6-35.6z'][id='path824']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g826'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g826'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m49.503,148.96s-0.565-1.72,1.361-1.3c1.926,0.41,36.996,2.34,91.116,33.44,0,0-77.663-34.4-92.477-32.14z'][id='path828']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g830'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g830'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m57.903,146.56s-0.565-1.72,1.361-1.3c1.926,0.41,36.996,2.34,91.116,33.44,0,0-77.063-34.8-92.477-32.14z'][id='path832']")
|
||||
),
|
||||
m("g[fill='#FFF'][id='g834'][stroke='#000'][stroke-width='0.1']",
|
||||
m("g[fill='#FFF'][id='g834'][stroke='#000'][stroke-width='0.1']",
|
||||
m("path[d='m67.503,141.56s-0.565-1.72,1.361-1.3c1.926,0.41,44.996,4.74,134.72,39.04,0,0-120.66-40.4-136.08-37.74z'][id='path836']")
|
||||
),
|
||||
m("g[fill='#000'][id='g838']",
|
||||
m("g[fill='#000'][id='g838']",
|
||||
m("path[d='m-43.8,148.4s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z'][id='path840']")
|
||||
),
|
||||
m("g[fill='#000'][id='g842']",
|
||||
m("g[fill='#000'][id='g842']",
|
||||
m("path[d='m-13,162.4s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z'][id='path844']")
|
||||
),
|
||||
m("g[fill='#000'][id='g846']",
|
||||
m("g[fill='#000'][id='g846']",
|
||||
m("path[d='m-21.8,162s5.2-0.4,4,1.2-3.6,0.8-3.6,0.8l-0.4-2z'][id='path848']")
|
||||
),
|
||||
m("g[fill='#000'][id='g850']",
|
||||
m("g[fill='#000'][id='g850']",
|
||||
m("path[d='m-117.17,150.18s5.05,1.32,3.39,2.44-3.67-0.42-3.67-0.42l0.28-2.02z'][id='path852']")
|
||||
),
|
||||
m("g[fill='#000'][id='g854']",
|
||||
m("g[fill='#000'][id='g854']",
|
||||
m("path[d='m-115.17,140.58s5.05,1.32,3.39,2.44-3.67-0.42-3.67-0.42l0.28-2.02z'][id='path856']")
|
||||
),
|
||||
m("g[fill='#000'][id='g858']",
|
||||
m("g[fill='#000'][id='g858']",
|
||||
m("path[d='m-122.37,136.18s5.05,1.32,3.39,2.44-3.67-0.42-3.67-0.42l0.28-2.02z'][id='path860']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g862']",
|
||||
m("g[fill='#CCC'][id='g862']",
|
||||
m("path[d='m-42.6,211.2-5.6,2c-2,0-13.2,3.6-18.8,13.6,0,0,12.4-9.6,24.4-15.6z'][id='path864']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g866']",
|
||||
m("g[fill='#CCC'][id='g866']",
|
||||
m("path[d='m45.116,303.85c0.141,0.25,0.196,0.67,0.488,0.69,0.658,0.04,1.891,0.34,1.766-0.29-0.848-4.31-1.722-9.25-5.855-11.05-0.639-0.28-2.081,0.13-2.155,1.02-0.127,1.52-0.244,2.87,0.065,4.33,0.3,1.43,2.458,1.43,3.375,0.05,0.936,1.67,1.368,3.52,2.316,5.25z'][id='path868']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g870']",
|
||||
m("g[fill='#CCC'][id='g870']",
|
||||
m("path[d='m34.038,308.58c0.748,1.41,0.621,3.27,2.036,3.84,0.74,0.29,2.59-0.68,2.172-1.76-0.802-2.06-1.19-4.3-2.579-6.11-0.2-0.26,0.04-0.79-0.12-1.12-0.594-1.22-1.739-1.96-3.147-1.63-1.115,2.2,0.033,4.33,1.555,6.04,0.136,0.15-0.03,0.53,0.083,0.74z'][id='path872']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g874']",
|
||||
m("g[fill='#CCC'][id='g874']",
|
||||
m("path[d='m-5.564,303.39c-0.108-0.38-0.146-0.84,0.019-1.16,0.531-1.03,1.324-2.15,0.987-3.18-0.348-1.05-1.464-0.87-2.114-0.3-1.135,0.99-1.184,2.82-1.875,4.18-0.196,0.38-0.145,0.96-0.586,1.35-0.474,0.42-0.914,1.94-0.818,2.51,0.053,0.32-0.13,10.22,0.092,9.96,0.619-0.73,3.669-10.47,3.738-11.36,0.057-0.73,0.789-1.19,0.557-2z'][id='path876']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g878']",
|
||||
m("g[fill='#CCC'][id='g878']",
|
||||
m("path[d='m-31.202,296.6c2.634-2.5,5.424-5.46,4.982-9.17-0.116-0.98-1.891-0.45-2.078,0.39-0.802,3.63-2.841,6.29-5.409,8.68-2.196,2.05-4.058,8.39-4.293,8.9,3.697-5.26,5.954-8,6.798-8.8z'][id='path880']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g882']",
|
||||
m("g[fill='#CCC'][id='g882']",
|
||||
m("path[d='m-44.776,290.64c0.523-0.38,0.221-0.87,0.438-1.2,0.953-1.46,2.254-2.7,2.272-4.44,0.003-0.28-0.375-0.59-0.71-0.36-0.277,0.18-0.619,0.31-0.727,0.44-2.03,2.45-3.43,5.12-4.873,7.93-0.183,0.36-1.327,4.85-1.014,4.96,0.239,0.09,1.959-4.09,2.169-4.21,1.263-0.68,1.275-2.3,2.445-3.12z'][id='path884']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g886']",
|
||||
m("g[fill='#CCC'][id='g886']",
|
||||
m("path[d='m-28.043,310.18c0.444-0.87,2.02-2.07,1.907-2.96-0.118-0.93,0.35-2.37-0.562-1.68-1.257,0.94-4.706,2.29-4.976,8.1-0.026,0.57,2.948-2.12,3.631-3.46z'][id='path888']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g890']",
|
||||
m("g[fill='#CCC'][id='g890']",
|
||||
m("path[d='m-13.6,293c0.4-0.67,1.108-0.19,1.567-0.46,0.648-0.37,1.259-0.93,1.551-1.58,0.97-2.14,2.739-3.96,2.882-6.36-1.491-1.4-2.17,0.64-2.8,1.6-1.323-1.65-2.322,0.23-3.622,0.75-0.07,0.03-0.283-0.32-0.358-0.29-1.177,0.44-1.857,1.52-2.855,2.3-0.171,0.13-0.576-0.05-0.723,0.09-0.652,0.6-1.625,0.93-1.905,1.61-1.11,2.7-4.25,4.8-6.137,12.34,0.381,0.91,4.512-6.64,4.999-7.34,0.836-1.2,0.954,1.66,2.23,1,0.051-0.03,0.237,0.21,0.371,0.34,0.194-0.28,0.412-0.51,0.8-0.4,0-0.4-0.134-0.96,0.067-1.11,1.237-0.98,1.153-2.05,1.933-3.29,0.458,0.79,1.519,0.07,2,0.8z'][id='path892']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g894']",
|
||||
m("g[fill='#CCC'][id='g894']",
|
||||
m("path[d='m46.2,347.4s7.4-20.4,3-31.6c0,0,11.4,21.6,6.8,32.8,0,0-0.4-10.4-4.4-15.4,0,0-4,12.8-5.4,14.2z'][id='path896']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g898']",
|
||||
m("g[fill='#CCC'][id='g898']",
|
||||
m("path[d='m31.4,344.8s5.4-8.8-2.6-27.2c0,0-0.8,20.4-7.6,31.4,0,0,14.2-20.2,10.2-4.2z'][id='path900']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g902']",
|
||||
m("g[fill='#CCC'][id='g902']",
|
||||
m("path[d='m21.4,342.8s-0.2-20,0.2-23c0,0-3.8,16.6-14,26.2,0,0,14.4-12,13.8-3.2z'][id='path904']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g906']",
|
||||
m("g[fill='#CCC'][id='g906']",
|
||||
m("path[d='m11.8,310.8s6,13.6-4,32c0,0,6.4-12.2,1.6-19.2,0,0,2.6-3.4,2.4-12.8z'][id='path908']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g910']",
|
||||
m("g[fill='#CCC'][id='g910']",
|
||||
m("path[d='m-7.4,342.4s-1-15.6,0.8-17.8c0,0,0.2-6.4-0.2-7.4,0,0,4-6.2,4.2,1.2,0,0,1.4,7.8,4.2,12.4,0,0,3.6,5.4,3.4,11.8,0,0-10-30.2-12.4-0.2z'][id='path912']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g914']",
|
||||
m("g[fill='#CCC'][id='g914']",
|
||||
m("path[d='m-11,314.8s-6.6,10.8-8.4,29.8c0,0-1.4-6.2,2.4-20.6,0,0,4.2-15.4,6-9.2z'][id='path916']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g918']",
|
||||
m("g[fill='#CCC'][id='g918']",
|
||||
m("path[d='m-32.8,334.6s5-5.4,6.4-10.4c0,0,3.6-15.8-2.8-7.2,0,0,0.2,8-8,15.4,0,0,4.8-2.4,4.4,2.2z'][id='path920']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g922']",
|
||||
m("g[fill='#CCC'][id='g922']",
|
||||
m("path[d='m-38.6,329.6s3.4-17.4,4.2-18.2c0,0,1.8-3.4-1-0.2,0,0-8.8,19.2-12.8,25.8,0,0,8-9.2,9.6-7.4z'][id='path924']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g926']",
|
||||
m("g[fill='#CCC'][id='g926']",
|
||||
m("path[d='m-44.4,313s11.6-22.4-10.2,3.4c0,0,11-9.8,10.2-3.4z'][id='path928']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g930']",
|
||||
m("g[fill='#CCC'][id='g930']",
|
||||
m("path[d='m-59.8,298.4s4.8-18.8,7.4-18.6l1.6,1.6s-6,9.6-5.4,19.4c0,0-0.6-9.6-3.6-2.4z'][id='path932']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g934']",
|
||||
m("g[fill='#CCC'][id='g934']",
|
||||
m("path[d='m270.5,287s-12-10-14.5-13.5c0,0,13.5,18.5,13.5,25.5,0,0,2.5-7.5,1-12z'][id='path936']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g938']",
|
||||
m("g[fill='#CCC'][id='g938']",
|
||||
m("path[d='m276,265s-21-15-24.5-22.5c0,0,26.5,29.5,26.5,34,0,0,0.5-9-2-11.5z'][id='path940']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g942']",
|
||||
m("g[fill='#CCC'][id='g942']",
|
||||
m("path[d='m293,111s-12-8-13.5-6c0,0,10.5,6.5,13,15,0,0-1.5-9,0.5-9z'][id='path944']")
|
||||
),
|
||||
m("g[fill='#CCC'][id='g946']",
|
||||
m("g[fill='#CCC'][id='g946']",
|
||||
m("path[d='m301.5,191.5-17.5-12s19,17,19.5,21l-2-9z'][id='path948']")
|
||||
),
|
||||
m("g[id='g950'][stroke='#000']",
|
||||
m("g[id='g950'][stroke='#000']",
|
||||
m("path[d='m-89.25,169,22,4.75'][id='path952']")
|
||||
),
|
||||
m("g[id='g954'][stroke='#000']",
|
||||
m("g[id='g954'][stroke='#000']",
|
||||
m("path[d='m-39,331s-0.5-3.5-9.5,7'][id='path956']")
|
||||
),
|
||||
m("g[id='g958'][stroke='#000']",
|
||||
m("g[id='g958'][stroke='#000']",
|
||||
m("path[d='m-33.5,336s2-6.5-4.5-2'][id='path960']")
|
||||
),
|
||||
m("g[id='g962'][stroke='#000']",
|
||||
m("g[id='g962'][stroke='#000']",
|
||||
m("path[d='m20.5,344.5s1.5-11-10,2'][id='path964']")
|
||||
)
|
||||
])
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ var api = {
|
|||
home : function() {
|
||||
T.timeEnd("Setup")
|
||||
return request({method: "GET", url: T.apiUrl + "/threads/"})
|
||||
},
|
||||
},
|
||||
thread : function(id) {
|
||||
T.timeEnd("Setup")
|
||||
return request({method: "GET", url: T.apiUrl + "/comments/" + id}).map(T.transformResponse)
|
||||
|
|
@ -80,7 +80,7 @@ var Header = {
|
|||
return [
|
||||
m("p.head_links", [
|
||||
m("a[href='https://github.com/koglerjs/threaditjs/tree/master/examples/mithril']", "Source"),
|
||||
" | ",
|
||||
" | ",
|
||||
m("a[href='http://threaditjs.com']", "ThreaditJS Home"),
|
||||
]),
|
||||
m("h2", [
|
||||
|
|
@ -133,7 +133,7 @@ var Thread = {
|
|||
view: function() {
|
||||
if (current) T.time("Thread render")
|
||||
return [
|
||||
m(Header),
|
||||
m(Header),
|
||||
current ? m(".main", {oncreate: function() {T.timeEnd("Thread render")}}, [
|
||||
m(ThreadNode, {node: current.root})
|
||||
]) : null
|
||||
|
|
@ -142,7 +142,7 @@ var Thread = {
|
|||
}
|
||||
var ThreadNode = {
|
||||
view: function(vnode) {
|
||||
return m(".comment", [
|
||||
return m(".comment", [
|
||||
m("p", m.trust(vnode.attrs.node.text)),
|
||||
m(".reply", m(Reply, vnode.attrs)),
|
||||
m(".children", [
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ html {background-color:#f5f5f5;}
|
|||
a {color:#161;text-decoration:none;}
|
||||
a:hover {text-decoration:underline;}
|
||||
|
||||
input[type=submit] {background-color:#5A5;color:#fff;border:0;font-weight:bold;}
|
||||
input[type=submit] {background-color:#5A5;color:#fff;border:0;font-weight:bold;}
|
||||
|
|
|
|||
|
|
@ -14,4 +14,4 @@
|
|||
<script src="../../mithril.js"></script>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ var api = {
|
|||
home : function() {
|
||||
T.timeEnd("Setup")
|
||||
return request({method: "GET", url: T.apiUrl + "/threads/"})
|
||||
},
|
||||
},
|
||||
thread : function(id) {
|
||||
T.timeEnd("Setup")
|
||||
return request({method: "GET", url: T.apiUrl + "/comments/" + id}).map(T.transformResponse)
|
||||
|
|
@ -87,7 +87,7 @@ var Header = {
|
|||
return [
|
||||
m("p.head_links", [
|
||||
m("a[href='https://github.com/koglerjs/threaditjs/tree/master/examples/mithril']", "Source"),
|
||||
" | ",
|
||||
" | ",
|
||||
m("a[href='http://threaditjs.com']", "ThreaditJS Home"),
|
||||
]),
|
||||
m("h2", [
|
||||
|
|
@ -140,7 +140,7 @@ var Thread = {
|
|||
view: function() {
|
||||
if (current) T.time("Thread render")
|
||||
return [
|
||||
m(Header),
|
||||
m(Header),
|
||||
current ? m(".main", {oncreate: function() {T.timeEnd("Thread render")}}, [
|
||||
m(ThreadNode, {node: current.root})
|
||||
]) : null
|
||||
|
|
@ -149,7 +149,7 @@ var Thread = {
|
|||
}
|
||||
var ThreadNode = {
|
||||
view: function(vnode) {
|
||||
return m(".comment", [
|
||||
return m(".comment", [
|
||||
m("p", trust(vnode.attrs.node.text)),
|
||||
m(".reply", m(Reply, vnode.attrs)),
|
||||
m(".children", [
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ html {background-color:#f5f5f5;}
|
|||
a {color:#161;text-decoration:none;}
|
||||
a:hover {text-decoration:underline;}
|
||||
|
||||
input[type=submit] {background-color:#5A5;color:#fff;border:0;font-weight:bold;}
|
||||
input[type=submit] {background-color:#5A5;color:#fff;border:0;font-weight:bold;}
|
||||
|
|
|
|||
|
|
@ -22,4 +22,4 @@
|
|||
<script src="../../request/request.js"></script>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -21,4 +21,4 @@
|
|||
<script src="../../router/router.js"></script>
|
||||
<script src="todomvc.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
2
index.js
2
index.js
|
|
@ -27,4 +27,4 @@ m.redraw = redrawService.publish
|
|||
if (typeof module === "object") module.exports = m
|
||||
else window.m = m
|
||||
|
||||
})()
|
||||
})()
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ Assertions may have descriptions:
|
|||
```javascript
|
||||
o("addition", function() {
|
||||
o(1 + 1).equals(2)("addition should work")
|
||||
|
||||
|
||||
/* in ES6, the following syntax is also possible
|
||||
o(1 + 1).equals(2) `addition should work`
|
||||
*/
|
||||
|
|
@ -110,7 +110,7 @@ o.spec("call()", function() {
|
|||
o("works", function() {
|
||||
var spy = o.spy()
|
||||
call(spy, 1)
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
o(spy.args[0]).equals(1)
|
||||
})
|
||||
|
|
@ -132,7 +132,7 @@ By default, asynchronous tests time out after 20ms. This can be changed on a per
|
|||
```javascript
|
||||
o("setTimeout calls callback", function(done, timeout) {
|
||||
timeout(50) //wait 50ms before bailing out of the test
|
||||
|
||||
|
||||
setTimeout(done, 30)
|
||||
})
|
||||
```
|
||||
|
|
@ -151,15 +151,15 @@ o.spec("math", function() {
|
|||
o.beforeEach(function() {
|
||||
acc = 0
|
||||
})
|
||||
|
||||
|
||||
o("addition", function() {
|
||||
acc += 1
|
||||
|
||||
|
||||
o(acc).equals(1)
|
||||
})
|
||||
o("subtraction", function() {
|
||||
acc -= 1
|
||||
|
||||
|
||||
o(acc).equals(-1)
|
||||
})
|
||||
})
|
||||
|
|
@ -180,16 +180,16 @@ o.spec("math", function() {
|
|||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
//tests only run after async hooks complete
|
||||
o("addition", function() {
|
||||
acc += 1
|
||||
|
||||
|
||||
o(acc).equals(1)
|
||||
})
|
||||
o("subtraction", function() {
|
||||
acc -= 1
|
||||
|
||||
|
||||
o(acc).equals(-1)
|
||||
})
|
||||
})
|
||||
|
|
@ -204,7 +204,7 @@ o.spec("math", function() {
|
|||
o("addition", function() {
|
||||
o(1 + 1).equals(2)
|
||||
})
|
||||
|
||||
|
||||
//only this test will be run, regardless of how many groups there are
|
||||
o.only("subtraction", function() {
|
||||
o(1 - 1).notEquals(2)
|
||||
|
|
|
|||
|
|
@ -43,4 +43,4 @@ traverseDirectory(".", function(pathname, stat, children) {
|
|||
|
||||
process.on("unhandledRejection", function(e) {
|
||||
console.log("Uncaught (in promise) " + e.stack)
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
node ospec
|
||||
node ospec
|
||||
|
|
|
|||
|
|
@ -32,21 +32,21 @@ module.exports = new function init() {
|
|||
o.run = function() {
|
||||
start = new Date
|
||||
test(spec, [], [], report)
|
||||
|
||||
|
||||
function test(spec, pre, post, finalize) {
|
||||
pre = [].concat(pre, spec["__beforeEach"] || [])
|
||||
post = [].concat(spec["__afterEach"] || [], post)
|
||||
series([].concat(spec["__before"] || [], Object.keys(spec).map(function(key) {
|
||||
return function(done, timeout) {
|
||||
timeout(Infinity)
|
||||
|
||||
|
||||
if (key.slice(0, 2) === "__") return done()
|
||||
if (only !== null && spec[key] !== only && typeof only === typeof spec[key]) return done()
|
||||
subjects.push(key)
|
||||
var type = typeof spec[key]
|
||||
if (type === "object") test(spec[key], pre, post, pop)
|
||||
if (type === "function") series([].concat(pre, spec[key], post, pop))
|
||||
|
||||
|
||||
function pop() {
|
||||
subjects.pop()
|
||||
done()
|
||||
|
|
@ -58,11 +58,11 @@ module.exports = new function init() {
|
|||
function series(fns) {
|
||||
var cursor = 0
|
||||
next()
|
||||
|
||||
|
||||
function next() {
|
||||
stack++
|
||||
if (cursor === fns.length) return
|
||||
|
||||
|
||||
var fn = fns[cursor++]
|
||||
if (fn.length > 0) {
|
||||
var timeout = 0, delay = 40, s = new Date
|
||||
|
|
@ -109,12 +109,12 @@ module.exports = new function init() {
|
|||
ctx[name] = predicate
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
define("equals", "should equal", function(a, b) {return a === b})
|
||||
define("notEquals", "should not equal", function(a, b) {return a !== b})
|
||||
define("deepEquals", "should deep equal", deepEqual)
|
||||
define("notDeepEquals", "should not deep equal", function(a, b) {return !deepEqual(a, b)})
|
||||
|
||||
|
||||
function isArguments(a) {
|
||||
if ("callee" in a) {
|
||||
for (var i in a) if (i === "callee") return false
|
||||
|
|
@ -185,7 +185,7 @@ module.exports = new function init() {
|
|||
function highlight(message) {
|
||||
return hasProcess ? "\x1b[31m" + message + "\x1b[0m" : "%c" + message + "%c "
|
||||
}
|
||||
|
||||
|
||||
function report() {
|
||||
var status = 0
|
||||
for (var i = 0, r; r = results[i]; i++) {
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@
|
|||
<body>
|
||||
<script src="../../module/module.js"></script>
|
||||
<script src="../../test-utils/callAsync.js"></script>
|
||||
|
||||
|
||||
<script src="../../ospec/ospec.js"></script>
|
||||
<script src="test-ospec.js"></script>
|
||||
<script>require("../../ospec/ospec").run()</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -21,22 +21,22 @@ new function(o) {
|
|||
o.spec("ospec", function() {
|
||||
o.spec("sync", function() {
|
||||
var a = 0, b = 0
|
||||
|
||||
|
||||
o.before(function test() {a = 1})
|
||||
o.after(function test() {a = 0})
|
||||
|
||||
|
||||
o.beforeEach(function test() {b = 1})
|
||||
o.afterEach(function test() {b = 0})
|
||||
|
||||
|
||||
o("assertions", function test() {
|
||||
var spy = o.spy()
|
||||
spy(a)
|
||||
|
||||
|
||||
o(a).equals(b)
|
||||
o(a).notEquals(2)
|
||||
o({a: [1, 2], b: 3}).deepEquals({a: [1, 2], b: 3})
|
||||
o([{a: 1, b: 2}, {c: 3}]).deepEquals([{a: 1, b: 2}, {c: 3}])
|
||||
|
||||
|
||||
var values = ["a", "", 1, 0, true, false, null, undefined, Date(0), ["a"], [], function() {return arguments}.call(), new Uint8Array(), {a: 1}, {}]
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
for (var j = 0; j < values.length; j++) {
|
||||
|
|
@ -44,7 +44,7 @@ o.spec("ospec", function() {
|
|||
else o(values[i]).notDeepEquals(values[j])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
o(spy.args.length).equals(1)
|
||||
o(spy.args[0]).equals(1)
|
||||
|
|
@ -52,7 +52,7 @@ o.spec("ospec", function() {
|
|||
})
|
||||
o.spec("async", function() {
|
||||
var a = 0, b = 0
|
||||
|
||||
|
||||
o.before(function test(done) {
|
||||
callAsync(function() {
|
||||
a = 1
|
||||
|
|
@ -65,7 +65,7 @@ o.spec("ospec", function() {
|
|||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.beforeEach(function test(done) {
|
||||
callAsync(function() {
|
||||
b = 1
|
||||
|
|
@ -78,15 +78,15 @@ o.spec("ospec", function() {
|
|||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o("async hooks", function test(done) {
|
||||
callAsync(function() {
|
||||
var spy = o.spy()
|
||||
spy(a)
|
||||
|
||||
|
||||
o(a).equals(b)
|
||||
o(a).equals(1)("a and b should be initialized")
|
||||
|
||||
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
var Promise = function(executor) {
|
||||
if (!(this instanceof Promise)) throw new Error("Promise must be called with `new`")
|
||||
if (typeof executor !== "function") throw new TypeError("executor must be a function")
|
||||
|
||||
|
||||
var self = this, resolvers = [], rejectors = [], resolveCurrent = handler(resolvers, true), rejectCurrent = handler(rejectors, false)
|
||||
var instance = self._instance = {resolvers: resolvers, rejectors: rejectors}
|
||||
var callAsync = typeof setImmediate === "function" ? setImmediate : setTimeout
|
||||
|
|
@ -41,7 +41,7 @@ var Promise = function(executor) {
|
|||
var onerror = run(rejectCurrent)
|
||||
try {then(run(resolveCurrent), onerror)} catch (e) {onerror(e)}
|
||||
}
|
||||
|
||||
|
||||
executeOnce(executor)
|
||||
}
|
||||
Promise.prototype.then = function(onFulfilled, onRejection) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<script src="../../promise/promise.js"></script>
|
||||
<script src="test-promise.js"></script>
|
||||
|
||||
|
||||
<script>require("../../ospec/ospec").run()</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -24,31 +24,31 @@ o.spec("promise", function() {
|
|||
o.spec("return value", function() {
|
||||
o("static resolve returns promise", function() {
|
||||
var promise = Promise.resolve()
|
||||
|
||||
|
||||
o(promise instanceof Promise).equals(true)
|
||||
})
|
||||
o("static resolve returns promise", function() {
|
||||
var promise = Promise.reject()
|
||||
promise.catch(function() {})
|
||||
|
||||
|
||||
o(promise instanceof Promise).equals(true)
|
||||
})
|
||||
o("static resolve with promise input returns same promise", function() {
|
||||
var resolved = Promise.resolve(1)
|
||||
var promise = Promise.resolve(resolved)
|
||||
|
||||
|
||||
o(promise).equals(resolved)
|
||||
})
|
||||
o("then returns promise", function(done) {
|
||||
var promise = Promise.resolve(1)
|
||||
|
||||
|
||||
promise.then(function(value) {
|
||||
o(value).equals(1)
|
||||
}).then(done)
|
||||
})
|
||||
o("catch returns promise", function(done) {
|
||||
var promise = Promise.reject(1)
|
||||
|
||||
|
||||
promise.catch(function(value) {
|
||||
o(value).equals(1)
|
||||
}).then(done)
|
||||
|
|
@ -62,10 +62,10 @@ o.spec("promise", function() {
|
|||
resolve(2)
|
||||
callAsync(function() {resolve(3)})
|
||||
})
|
||||
|
||||
|
||||
promise.then(function(value) {
|
||||
callCount++
|
||||
|
||||
|
||||
o(value).equals(1)
|
||||
o(callCount).equals(1)
|
||||
done()
|
||||
|
|
@ -77,7 +77,7 @@ o.spec("promise", function() {
|
|||
reject(2)
|
||||
callAsync(function() {reject(3)})
|
||||
})
|
||||
|
||||
|
||||
promise.then(function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -85,9 +85,9 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("resolves asynchronously", function(done) {
|
||||
var state = 0
|
||||
|
||||
|
||||
var promise = Promise.resolve()
|
||||
|
||||
|
||||
state = 1
|
||||
promise.then(function(value) {
|
||||
o(state).equals(2)
|
||||
|
|
@ -97,7 +97,7 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("resolves via static method", function(done) {
|
||||
var promise = Promise.resolve(1)
|
||||
|
||||
|
||||
promise.then(function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -107,7 +107,7 @@ o.spec("promise", function() {
|
|||
var promise = new Promise(function(resolve, reject) {
|
||||
callAsync(function() {resolve(1)})
|
||||
})
|
||||
|
||||
|
||||
promise.then(function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -117,7 +117,7 @@ o.spec("promise", function() {
|
|||
var promise = Promise.resolve(1)
|
||||
var a = promise.then(function(value) {return value + 1})
|
||||
var b = promise.then(function(value) {return value + 2})
|
||||
|
||||
|
||||
a.then(function(aValue) {
|
||||
b.then(function(bValue) {
|
||||
o(aValue).equals(2)
|
||||
|
|
@ -130,12 +130,12 @@ o.spec("promise", function() {
|
|||
var promise = new Promise(function(resolve) {
|
||||
callAsync(function() {resolve(promise)})
|
||||
})
|
||||
|
||||
|
||||
promise.then(null, done)
|
||||
})
|
||||
o("non-function onFulfilled is ignored", function(done) {
|
||||
var promise = Promise.resolve(1)
|
||||
|
||||
|
||||
promise.then(null, null).then(function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -143,7 +143,7 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("non-function onFulfilled is ignored", function(done) {
|
||||
var promise = Promise.resolve(1)
|
||||
|
||||
|
||||
promise.then(null).then(function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -158,10 +158,10 @@ o.spec("promise", function() {
|
|||
reject(2)
|
||||
callAsync(function() {reject(3)})
|
||||
})
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
callCount++
|
||||
|
||||
|
||||
o(value).equals(1)
|
||||
o(callCount).equals(1)
|
||||
done()
|
||||
|
|
@ -173,7 +173,7 @@ o.spec("promise", function() {
|
|||
resolve(2)
|
||||
callAsync(function() {resolve(3)})
|
||||
})
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -181,9 +181,9 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("rejects asynchronously", function(done) {
|
||||
var state = 0
|
||||
|
||||
|
||||
var promise = Promise.reject()
|
||||
|
||||
|
||||
state = 1
|
||||
promise.then(null, function(value) {
|
||||
o(state).equals(2)
|
||||
|
|
@ -194,7 +194,7 @@ o.spec("promise", function() {
|
|||
o("does not catch itself", function(done) {
|
||||
var callCount = 0
|
||||
var promise = Promise.resolve().then(function() {throw 1}, function() {callCount++})
|
||||
|
||||
|
||||
promise.then(null, function() {
|
||||
o(callCount).equals(0)
|
||||
done()
|
||||
|
|
@ -202,7 +202,7 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("rejects via static method", function(done) {
|
||||
var promise = Promise.reject(1)
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value).equals(1)
|
||||
return value
|
||||
|
|
@ -215,7 +215,7 @@ o.spec("promise", function() {
|
|||
var promise = new Promise(function(resolve, reject) {
|
||||
reject(1)
|
||||
})
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -225,7 +225,7 @@ o.spec("promise", function() {
|
|||
var promise = new Promise(function(resolve, reject) {
|
||||
callAsync(function() {reject(1)})
|
||||
})
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -235,7 +235,7 @@ o.spec("promise", function() {
|
|||
var promise = new Promise(function(resolve, reject) {
|
||||
throw 1
|
||||
})
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -243,7 +243,7 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("rejects on fulfillment error", function(done) {
|
||||
var promise = Promise.resolve()
|
||||
|
||||
|
||||
promise.then(function() {
|
||||
throw 1
|
||||
}).then(null, function(value) {
|
||||
|
|
@ -253,7 +253,7 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("rejects on rejection error", function(done) {
|
||||
var promise = Promise.resolve()
|
||||
|
||||
|
||||
promise.then(function() {
|
||||
throw 1
|
||||
}).then(null, function() {
|
||||
|
|
@ -265,7 +265,7 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("non-function onRejected is ignored", function(done) {
|
||||
var promise = Promise.reject(1)
|
||||
|
||||
|
||||
promise.then(function() {}, null).then(null, function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -275,7 +275,7 @@ o.spec("promise", function() {
|
|||
o.spec("promise absorption", function() {
|
||||
o("absorbs resolved promise via static resolver", function(done) {
|
||||
var promise = Promise.resolve(Promise.resolve(1))
|
||||
|
||||
|
||||
promise.then(function(value) {
|
||||
o(value).equals(1)
|
||||
}).then(done)
|
||||
|
|
@ -285,7 +285,7 @@ o.spec("promise", function() {
|
|||
var p = Promise.resolve(1)
|
||||
resolve(p)
|
||||
})
|
||||
|
||||
|
||||
promise.then(function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -293,7 +293,7 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("absorbs resolved promise on fulfillment", function(done) {
|
||||
var promise = Promise.resolve()
|
||||
|
||||
|
||||
promise.then(function() {
|
||||
return Promise.resolve(1)
|
||||
}).then(function(value) {
|
||||
|
|
@ -303,7 +303,7 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("absorbs rejected promise via static resolver", function(done) {
|
||||
var promise = Promise.resolve(Promise.reject(1))
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -313,7 +313,7 @@ o.spec("promise", function() {
|
|||
var promise = new Promise(function(resolve, reject) {
|
||||
resolve(Promise.reject(1))
|
||||
})
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -321,7 +321,7 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("absorbs rejected promise on fulfillment", function(done) {
|
||||
var promise = Promise.resolve()
|
||||
|
||||
|
||||
promise.then(function() {
|
||||
return Promise.reject(1)
|
||||
}).then(null, function(value) {
|
||||
|
|
@ -334,7 +334,7 @@ o.spec("promise", function() {
|
|||
setTimeout(function() {resolve(1)}, 10)
|
||||
})
|
||||
var promise = Promise.resolve(pending)
|
||||
|
||||
|
||||
promise.then(function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -347,7 +347,7 @@ o.spec("promise", function() {
|
|||
var promise = new Promise(function(resolve, reject) {
|
||||
resolve(pending)
|
||||
})
|
||||
|
||||
|
||||
promise.then(function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -358,7 +358,7 @@ o.spec("promise", function() {
|
|||
setTimeout(function() {resolve(1)}, 10)
|
||||
})
|
||||
var promise = Promise.resolve()
|
||||
|
||||
|
||||
promise.then(function() {
|
||||
return pending
|
||||
}).then(function(value) {
|
||||
|
|
@ -371,7 +371,7 @@ o.spec("promise", function() {
|
|||
setTimeout(function() {reject(1)}, 10)
|
||||
})
|
||||
var promise = Promise.resolve(pending)
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -384,7 +384,7 @@ o.spec("promise", function() {
|
|||
var promise = new Promise(function(resolve, reject) {
|
||||
resolve(pending)
|
||||
})
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -395,7 +395,7 @@ o.spec("promise", function() {
|
|||
setTimeout(function() {reject(1)}, 10)
|
||||
})
|
||||
var promise = Promise.resolve()
|
||||
|
||||
|
||||
promise.then(function() {
|
||||
return pending
|
||||
}).then(null, function(value) {
|
||||
|
|
@ -405,7 +405,7 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("does not absorb resolved promise via static rejector", function(done) {
|
||||
var promise = Promise.reject(Promise.resolve(1))
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value instanceof Promise).equals(true)
|
||||
done()
|
||||
|
|
@ -415,7 +415,7 @@ o.spec("promise", function() {
|
|||
var rejected = Promise.reject(1)
|
||||
rejected.catch(function() {})
|
||||
var promise = Promise.reject(rejected)
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value instanceof Promise).equals(true)
|
||||
done()
|
||||
|
|
@ -425,7 +425,7 @@ o.spec("promise", function() {
|
|||
var promise = new Promise(function(resolve, reject) {
|
||||
reject(Promise.resolve(1))
|
||||
})
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value instanceof Promise).equals(true)
|
||||
done()
|
||||
|
|
@ -437,7 +437,7 @@ o.spec("promise", function() {
|
|||
rejected.catch(function() {})
|
||||
reject(rejected)
|
||||
})
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value instanceof Promise).equals(true)
|
||||
done()
|
||||
|
|
@ -445,7 +445,7 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("does not absorb resolved promise on fulfillment error", function(done) {
|
||||
var promise = Promise.resolve()
|
||||
|
||||
|
||||
promise.then(function() {
|
||||
throw Promise.resolve(1)
|
||||
}).then(null, function(value) {
|
||||
|
|
@ -455,7 +455,7 @@ o.spec("promise", function() {
|
|||
})
|
||||
o("does not absorb rejected promise on fulfillment error", function(done) {
|
||||
var promise = Promise.resolve()
|
||||
|
||||
|
||||
promise.then(function() {
|
||||
var rejected = Promise.reject(1)
|
||||
rejected.catch(function() {})
|
||||
|
|
@ -468,7 +468,7 @@ o.spec("promise", function() {
|
|||
o("promise stays pending if absorbed promise is pending", function(done) {
|
||||
var promise = new Promise(function(resolve) {resolve()})
|
||||
var fulfilled = false, rejected = false
|
||||
|
||||
|
||||
promise.then(function() {
|
||||
return new Promise(function() {})
|
||||
}).then(function() {
|
||||
|
|
@ -476,7 +476,7 @@ o.spec("promise", function() {
|
|||
}, function() {
|
||||
rejected = false
|
||||
})
|
||||
|
||||
|
||||
setTimeout(function() {
|
||||
o(fulfilled).equals(false)
|
||||
o(rejected).equals(false)
|
||||
|
|
@ -490,7 +490,7 @@ o.spec("promise", function() {
|
|||
resolve(resolved)
|
||||
}, 10)
|
||||
})
|
||||
|
||||
|
||||
promise.then(function(value) {
|
||||
o(value).equals(1)
|
||||
done()
|
||||
|
|
@ -573,7 +573,7 @@ o.spec("promise", function() {
|
|||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
promise.then(function(value) {
|
||||
o(readCount).equals(1)
|
||||
done()
|
||||
|
|
@ -590,7 +590,7 @@ o.spec("promise", function() {
|
|||
res(1)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
promise.then(function(value) {
|
||||
o(value).equals(2)
|
||||
done()
|
||||
|
|
@ -605,11 +605,11 @@ o.spec("promise", function() {
|
|||
})
|
||||
throw 3
|
||||
})
|
||||
|
||||
|
||||
promise.then(null, function(value) {
|
||||
o(value).equals(2)
|
||||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
module.exports = function(object) {
|
||||
if (Object.prototype.toString.call(object) !== "[object Object]") return ""
|
||||
|
||||
|
||||
var args = []
|
||||
for (var key in object) {
|
||||
destructure(key, object[key])
|
||||
}
|
||||
return args.join("&")
|
||||
|
||||
|
||||
function destructure(key, value) {
|
||||
if (value instanceof Array) {
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
|
|
@ -22,4 +22,4 @@ module.exports = function(object) {
|
|||
}
|
||||
else args.push(encodeURIComponent(key) + (value != null && value !== "" ? "=" + encodeURIComponent(value) : ""))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,13 @@
|
|||
module.exports = function(string) {
|
||||
if (string === "" || string == null) return {}
|
||||
if (string.charAt(0) === "?") string = string.slice(1)
|
||||
|
||||
|
||||
var entries = string.split("&"), data = {}, counters = {}
|
||||
for (var i = 0; i < entries.length; i++) {
|
||||
var entry = entries[i].split("=")
|
||||
var key = decodeURIComponent(entry[0])
|
||||
var value = entry.length === 2 ? decodeURIComponent(entry[1]) : ""
|
||||
|
||||
|
||||
//TODO refactor out
|
||||
var number = Number(value)
|
||||
if (value !== "" && !isNaN(number) || value === "NaN") value = number
|
||||
|
|
@ -19,7 +19,7 @@ module.exports = function(string) {
|
|||
var date = new Date(value)
|
||||
if (!isNaN(date.getTime())) value = date
|
||||
}
|
||||
|
||||
|
||||
var levels = key.split(/\]\[?|\[/)
|
||||
var cursor = data
|
||||
if (key.indexOf("[") > -1) levels.pop()
|
||||
|
|
@ -39,4 +39,4 @@ module.exports = function(string) {
|
|||
}
|
||||
}
|
||||
return data
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
<script src="../../querystring/build.js"></script>
|
||||
<script src="test-parseQueryString.js"></script>
|
||||
<script src="test-buildQueryString.js"></script>
|
||||
|
||||
|
||||
<script>require("../../ospec/ospec").run()</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -6,77 +6,77 @@ var buildQueryString = require("../../querystring/build")
|
|||
o.spec("buildQueryString", function() {
|
||||
o("handles flat object", function() {
|
||||
var string = buildQueryString({a: "b", c: 1})
|
||||
|
||||
|
||||
o(string).equals("a=b&c=1")
|
||||
})
|
||||
o("handles escaped values", function() {
|
||||
var data = buildQueryString({";:@&=+$,/?%#": ";:@&=+$,/?%#"})
|
||||
|
||||
|
||||
o(data).equals("%3B%3A%40%26%3D%2B%24%2C%2F%3F%25%23=%3B%3A%40%26%3D%2B%24%2C%2F%3F%25%23")
|
||||
})
|
||||
o("handles unicode", function() {
|
||||
var data = buildQueryString({"ö": "ö"})
|
||||
|
||||
|
||||
o(data).equals("%C3%B6=%C3%B6")
|
||||
})
|
||||
o("handles nested object", function() {
|
||||
var string = buildQueryString({a: {b: 1, c: 2}})
|
||||
|
||||
|
||||
o(string).equals("a%5Bb%5D=1&a%5Bc%5D=2")
|
||||
})
|
||||
o("handles deep nested object", function() {
|
||||
var string = buildQueryString({a: {b: {c: 1, d: 2}}})
|
||||
|
||||
|
||||
o(string).equals("a%5Bb%5D%5Bc%5D=1&a%5Bb%5D%5Bd%5D=2")
|
||||
})
|
||||
o("handles nested array", function() {
|
||||
var string = buildQueryString({a: ["x", "y"]})
|
||||
|
||||
|
||||
o(string).equals("a%5B0%5D=x&a%5B1%5D=y")
|
||||
})
|
||||
o("handles deep nested array", function() {
|
||||
var string = buildQueryString({a: [["x", "y"]]})
|
||||
|
||||
|
||||
o(string).equals("a%5B0%5D%5B0%5D=x&a%5B0%5D%5B1%5D=y")
|
||||
})
|
||||
o("handles deep nested array in object", function() {
|
||||
var string = buildQueryString({a: {b: ["x", "y"]}})
|
||||
|
||||
|
||||
o(string).equals("a%5Bb%5D%5B0%5D=x&a%5Bb%5D%5B1%5D=y")
|
||||
})
|
||||
o("handles deep nested object in array", function() {
|
||||
var string = buildQueryString({a: [{b: 1, c: 2}]})
|
||||
|
||||
|
||||
o(string).equals("a%5B0%5D%5Bb%5D=1&a%5B0%5D%5Bc%5D=2")
|
||||
})
|
||||
o("handles date", function() {
|
||||
var string = buildQueryString({a: new Date(0)})
|
||||
|
||||
|
||||
o(string).equals("a=" + encodeURIComponent(new Date(0).toString()))
|
||||
})
|
||||
o("turns null into value-less string (like jQuery)", function() {
|
||||
var string = buildQueryString({a: null})
|
||||
|
||||
|
||||
o(string).equals("a")
|
||||
})
|
||||
o("turns undefined into value-less string (like jQuery)", function() {
|
||||
var string = buildQueryString({a: undefined})
|
||||
|
||||
|
||||
o(string).equals("a")
|
||||
})
|
||||
o("turns empty string into value-less string (like jQuery)", function() {
|
||||
var string = buildQueryString({a: ""})
|
||||
|
||||
|
||||
o(string).equals("a")
|
||||
})
|
||||
o("handles zero", function() {
|
||||
var string = buildQueryString({a: 0})
|
||||
|
||||
|
||||
o(string).equals("a=0")
|
||||
})
|
||||
o("handles false", function() {
|
||||
var string = buildQueryString({a: false})
|
||||
|
||||
|
||||
o(string).equals("a=false")
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ function hyperscript(selector) {
|
|||
}
|
||||
if (children instanceof Array && children.length == 1 && children[0] != null && children[0].tag === "#") text = children[0].children
|
||||
else childList = children
|
||||
|
||||
|
||||
return Node(tag || "div", attrs.key, hasAttrs ? attrs : undefined, childList, text, undefined)
|
||||
}
|
||||
}
|
||||
|
|
@ -57,9 +57,9 @@ function hyperscript(selector) {
|
|||
children = []
|
||||
for (var i = childrenIndex; i < arguments.length; i++) children.push(arguments[i])
|
||||
}
|
||||
|
||||
|
||||
if (typeof selector === "string") return selectorCache[selector](attrs || {}, Node.normalizeChildren(children))
|
||||
|
||||
|
||||
return Node(selector, attrs && attrs.key, attrs || {}, Node.normalizeChildren(children), undefined, undefined)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,4 +13,4 @@ Node.normalizeChildren = function normalizeChildren(children) {
|
|||
return children
|
||||
}
|
||||
|
||||
module.exports = Node
|
||||
module.exports = Node
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ module.exports = function($window) {
|
|||
|
||||
var onevent
|
||||
function setEventCallback(callback) {return onevent = callback}
|
||||
|
||||
|
||||
//create
|
||||
function createNodes(parent, vnodes, start, end, hooks, nextSibling, ns) {
|
||||
for (var i = start; i < end; i++) {
|
||||
|
|
@ -38,7 +38,7 @@ module.exports = function($window) {
|
|||
var match = vnode.children.match(/^\s*?<(\w+)/im) || []
|
||||
var parent = {caption: "table", thead: "table", tbody: "table", tfoot: "table", tr: "tbody", th: "tr", td: "tr", colgroup: "table", col: "colgroup"}[match[1]] || "div"
|
||||
var temp = $doc.createElement(parent)
|
||||
|
||||
|
||||
temp.innerHTML = vnode.children
|
||||
vnode.dom = temp.firstChild
|
||||
vnode.domSize = temp.childNodes.length
|
||||
|
|
@ -65,24 +65,24 @@ module.exports = function($window) {
|
|||
case "svg": ns = "http://www.w3.org/2000/svg"; break
|
||||
case "math": ns = "http://www.w3.org/1998/Math/MathML"; break
|
||||
}
|
||||
|
||||
|
||||
var attrs = vnode.attrs
|
||||
var is = attrs && attrs.is
|
||||
|
||||
|
||||
var element = ns ?
|
||||
is ? $doc.createElementNS(ns, tag, is) : $doc.createElementNS(ns, tag) :
|
||||
is ? $doc.createElement(tag, is) : $doc.createElement(tag)
|
||||
vnode.dom = element
|
||||
|
||||
|
||||
if (attrs != null) {
|
||||
setAttrs(vnode, attrs, ns)
|
||||
}
|
||||
|
||||
|
||||
if (vnode.text != null) {
|
||||
if (vnode.text !== "") element.textContent = vnode.text
|
||||
else vnode.children = [Node("#", undefined, undefined, vnode.text, undefined, undefined)]
|
||||
}
|
||||
|
||||
|
||||
if (vnode.children != null) {
|
||||
var children = vnode.children
|
||||
createNodes(element, children, 0, children.length, hooks, null, ns)
|
||||
|
|
@ -92,7 +92,7 @@ module.exports = function($window) {
|
|||
}
|
||||
function createComponent(vnode, hooks, ns) {
|
||||
vnode.state = copy(vnode.tag)
|
||||
|
||||
|
||||
initLifecycle(vnode.tag, vnode, hooks)
|
||||
vnode.instance = Node.normalize(vnode.tag.view.call(vnode.state, vnode))
|
||||
if (vnode.instance != null) {
|
||||
|
|
@ -112,7 +112,7 @@ module.exports = function($window) {
|
|||
else {
|
||||
var recycling = isRecyclable(old, vnodes)
|
||||
if (recycling) old = old.concat(old.pool)
|
||||
|
||||
|
||||
var oldStart = 0, start = 0, oldEnd = old.length - 1, end = vnodes.length - 1, map
|
||||
while (oldEnd >= oldStart && end >= start) {
|
||||
var o = old[oldStart], v = vnodes[start]
|
||||
|
|
@ -321,7 +321,7 @@ module.exports = function($window) {
|
|||
}
|
||||
if (expected > 0) return
|
||||
}
|
||||
|
||||
|
||||
onremove(vnode)
|
||||
if (vnode.dom) {
|
||||
var count = vnode.domSize || 1
|
||||
|
|
@ -341,7 +341,7 @@ module.exports = function($window) {
|
|||
function onremove(vnode) {
|
||||
if (vnode.attrs && vnode.attrs.onremove) vnode.attrs.onremove.call(vnode.state, vnode)
|
||||
if (typeof vnode.tag !== "string" && vnode.tag.onremove) vnode.tag.onremove.call(vnode.state, vnode)
|
||||
|
||||
|
||||
var children = vnode.children
|
||||
if (children instanceof Array) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
|
|
@ -412,7 +412,7 @@ module.exports = function($window) {
|
|||
function hasIntegrationMethods(source) {
|
||||
return source != null && (source.oncreate || source.onupdate || source.onbeforeremove || source.onremove)
|
||||
}
|
||||
|
||||
|
||||
//style
|
||||
function updateStyle(element, old, style) {
|
||||
if (old === style) element.style = "", old = null
|
||||
|
|
@ -430,7 +430,7 @@ module.exports = function($window) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//event
|
||||
function updateEvent(vnode, key, value) {
|
||||
var element = vnode.dom
|
||||
|
|
@ -470,7 +470,7 @@ module.exports = function($window) {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
function copy(data) {
|
||||
if (data instanceof Array) {
|
||||
var output = []
|
||||
|
|
@ -489,7 +489,7 @@ module.exports = function($window) {
|
|||
var hooks = []
|
||||
var active = $doc.activeElement
|
||||
if (dom.vnodes == null) dom.vnodes = []
|
||||
|
||||
|
||||
if (!(vnodes instanceof Array)) vnodes = [vnodes]
|
||||
updateNodes(dom, dom.vnodes, Node.normalizeChildren(vnodes), hooks, null, undefined)
|
||||
for (var i = 0; i < hooks.length; i++) hooks[i]()
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@
|
|||
<script src="test-input.js"></script>
|
||||
<script src="test-textContent.js"></script>
|
||||
<script src="test-component.js"></script>
|
||||
|
||||
|
||||
<script>require("../../ospec/ospec").run()</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -15,47 +15,47 @@ o.spec("attributes", function() {
|
|||
o.spec("input readonly", function() {
|
||||
o("when input readonly is true, attribute is present", function() {
|
||||
var a = {tag: "input", attrs: {readonly: true}}
|
||||
|
||||
|
||||
render(root, [a])
|
||||
|
||||
|
||||
o(a.dom.attributes["readonly"].nodeValue).equals("")
|
||||
})
|
||||
o("when input readonly is false, attribute is not present", function() {
|
||||
var a = {tag: "input", attrs: {readonly: false}}
|
||||
|
||||
|
||||
render(root, [a])
|
||||
|
||||
|
||||
o(a.dom.attributes["readonly"]).equals(undefined)
|
||||
})
|
||||
})
|
||||
o.spec("input checked", function() {
|
||||
o("when input checked is true, attribute is not present", function() {
|
||||
var a = {tag: "input", attrs: {checked: true}}
|
||||
|
||||
|
||||
render(root, [a])
|
||||
|
||||
|
||||
o(a.dom.checked).equals(true)
|
||||
o(a.dom.attributes["checked"]).equals(undefined)
|
||||
})
|
||||
o("when input checked is false, attribute is not present", function() {
|
||||
var a = {tag: "input", attrs: {checked: false}}
|
||||
|
||||
|
||||
render(root, [a])
|
||||
|
||||
|
||||
o(a.dom.checked).equals(false)
|
||||
o(a.dom.attributes["checked"]).equals(undefined)
|
||||
})
|
||||
o("after input checked is changed by 3rd party, it can still be changed by render", function() {
|
||||
var a = {tag: "input", attrs: {checked: false}}
|
||||
var b = {tag: "input", attrs: {checked: true}}
|
||||
|
||||
|
||||
render(root, [a])
|
||||
|
||||
|
||||
a.dom.checked = true //setting the javascript property makes the value no longer track the state of the attribute
|
||||
a.dom.checked = false
|
||||
|
||||
|
||||
render(root, [b])
|
||||
|
||||
|
||||
o(a.dom.checked).equals(true)
|
||||
o(a.dom.attributes["checked"]).equals(undefined)
|
||||
})
|
||||
|
|
@ -63,16 +63,16 @@ o.spec("attributes", function() {
|
|||
o.spec("link href", function() {
|
||||
o("when link href is true, attribute is present", function() {
|
||||
var a = {tag: "a", attrs: {href: true}}
|
||||
|
||||
|
||||
render(root, [a])
|
||||
|
||||
|
||||
o(a.dom.attributes["href"]).notEquals(undefined)
|
||||
})
|
||||
o("when link href is false, attribute is not present", function() {
|
||||
var a = {tag: "a", attrs: {href: false}}
|
||||
|
||||
|
||||
render(root, [a])
|
||||
|
||||
|
||||
o(a.dom.attributes["href"]).equals(undefined)
|
||||
})
|
||||
})
|
||||
|
|
@ -85,4 +85,4 @@ o.spec("attributes", function() {
|
|||
o(a.dom.attributes["class"].nodeValue).equals("test")
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -20,9 +20,9 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
var node = {tag: component}
|
||||
|
||||
|
||||
render(root, [node])
|
||||
|
||||
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("a")
|
||||
o(root.firstChild.firstChild.nodeValue).equals("b")
|
||||
|
|
@ -34,9 +34,9 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
var node = {tag: component, attrs: {id: "a"}, text: "b"}
|
||||
|
||||
|
||||
render(root, [node])
|
||||
|
||||
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("a")
|
||||
o(root.firstChild.firstChild.nodeValue).equals("b")
|
||||
|
|
@ -49,7 +49,7 @@ o.spec("component", function() {
|
|||
}
|
||||
render(root, [{tag: component, attrs: {id: "a"}, text: "b"}])
|
||||
render(root, [{tag: component, attrs: {id: "c"}, text: "d"}])
|
||||
|
||||
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("c")
|
||||
o(root.firstChild.firstChild.nodeValue).equals("d")
|
||||
|
|
@ -63,7 +63,7 @@ o.spec("component", function() {
|
|||
var div = {tag: "div", key: 2}
|
||||
render(root, [{tag: component, key: 1}, div])
|
||||
render(root, [{tag: "div", key: 2}])
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild).equals(div.dom)
|
||||
})
|
||||
|
|
@ -74,7 +74,7 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
render(root, [{tag: "svg", children: [{tag: component}]}])
|
||||
|
||||
|
||||
o(root.firstChild.firstChild.namespaceURI).equals("http://www.w3.org/2000/svg")
|
||||
})
|
||||
o("svg works when updating across component boundary", function() {
|
||||
|
|
@ -85,7 +85,7 @@ o.spec("component", function() {
|
|||
}
|
||||
render(root, [{tag: "svg", children: [{tag: component}]}])
|
||||
render(root, [{tag: "svg", children: [{tag: component}]}])
|
||||
|
||||
|
||||
o(root.firstChild.firstChild.namespaceURI).equals("http://www.w3.org/2000/svg")
|
||||
})
|
||||
})
|
||||
|
|
@ -100,7 +100,7 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(root.childNodes[0].nodeName).equals("LABEL")
|
||||
o(root.childNodes[1].nodeName).equals("INPUT")
|
||||
|
|
@ -112,7 +112,7 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(root.firstChild.nodeType).equals(3)
|
||||
o(root.firstChild.nodeValue).equals("a")
|
||||
})
|
||||
|
|
@ -123,7 +123,7 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(root.firstChild.nodeType).equals(3)
|
||||
o(root.firstChild.nodeValue).equals("")
|
||||
})
|
||||
|
|
@ -134,7 +134,7 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(root.firstChild.nodeType).equals(3)
|
||||
o(root.firstChild.nodeValue).equals("1")
|
||||
})
|
||||
|
|
@ -145,7 +145,7 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(root.firstChild.nodeType).equals(3)
|
||||
o(root.firstChild.nodeValue).equals("0")
|
||||
})
|
||||
|
|
@ -156,7 +156,7 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(root.firstChild.nodeType).equals(3)
|
||||
o(root.firstChild.nodeValue).equals("true")
|
||||
})
|
||||
|
|
@ -167,7 +167,7 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(root.firstChild.nodeType).equals(3)
|
||||
o(root.firstChild.nodeValue).equals("false")
|
||||
})
|
||||
|
|
@ -178,7 +178,7 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(0)
|
||||
})
|
||||
o("can return undefined", function() {
|
||||
|
|
@ -188,7 +188,7 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(0)
|
||||
})
|
||||
o("can update when returning fragments", function() {
|
||||
|
|
@ -202,7 +202,7 @@ o.spec("component", function() {
|
|||
}
|
||||
render(root, [{tag: component}])
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(root.childNodes[0].nodeName).equals("LABEL")
|
||||
o(root.childNodes[1].nodeName).equals("INPUT")
|
||||
|
|
@ -215,7 +215,7 @@ o.spec("component", function() {
|
|||
}
|
||||
render(root, [{tag: component}])
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(root.firstChild.nodeType).equals(3)
|
||||
o(root.firstChild.nodeValue).equals("a")
|
||||
})
|
||||
|
|
@ -227,7 +227,7 @@ o.spec("component", function() {
|
|||
}
|
||||
render(root, [{tag: component}])
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(0)
|
||||
})
|
||||
o("can remove when returning fragments", function() {
|
||||
|
|
@ -241,9 +241,9 @@ o.spec("component", function() {
|
|||
}
|
||||
var div = {tag: "div", key: 2}
|
||||
render(root, [{tag: component, key: 1}, div])
|
||||
|
||||
|
||||
render(root, [{tag: "div", key: 2}])
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild).equals(div.dom)
|
||||
})
|
||||
|
|
@ -255,9 +255,9 @@ o.spec("component", function() {
|
|||
}
|
||||
var div = {tag: "div", key: 2}
|
||||
render(root, [{tag: component, key: 1}, div])
|
||||
|
||||
|
||||
render(root, [{tag: "div", key: 2}])
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild).equals(div.dom)
|
||||
})
|
||||
|
|
@ -268,7 +268,7 @@ o.spec("component", function() {
|
|||
var component = {
|
||||
oninit: function(vnode) {
|
||||
called++
|
||||
|
||||
|
||||
o(vnode.tag).equals(component)
|
||||
o(vnode.dom).equals(undefined)
|
||||
o(root.childNodes.length).equals(0)
|
||||
|
|
@ -278,9 +278,9 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
var node = {tag: component}
|
||||
|
||||
|
||||
render(root, [node])
|
||||
|
||||
|
||||
o(called).equals(1)
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("a")
|
||||
|
|
@ -291,7 +291,7 @@ o.spec("component", function() {
|
|||
var component = {
|
||||
oninit: function(vnode) {
|
||||
called++
|
||||
|
||||
|
||||
o(vnode.tag).equals(component)
|
||||
o(vnode.dom).equals(undefined)
|
||||
o(root.childNodes.length).equals(0)
|
||||
|
|
@ -301,9 +301,9 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
var node = {tag: component}
|
||||
|
||||
|
||||
render(root, [node])
|
||||
|
||||
|
||||
o(called).equals(1)
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("a")
|
||||
|
|
@ -311,7 +311,7 @@ o.spec("component", function() {
|
|||
})
|
||||
o("calls oninit before view", function() {
|
||||
var viewCalled = false
|
||||
|
||||
|
||||
render(root, {
|
||||
tag: {
|
||||
view: function() {
|
||||
|
|
@ -332,14 +332,14 @@ o.spec("component", function() {
|
|||
},
|
||||
oninit: init,
|
||||
}
|
||||
|
||||
|
||||
function view() {
|
||||
return {tag: component}
|
||||
}
|
||||
|
||||
|
||||
render(root, view())
|
||||
render(root, view())
|
||||
|
||||
|
||||
o(init.callCount).equals(1)
|
||||
})
|
||||
o("calls oncreate", function() {
|
||||
|
|
@ -347,7 +347,7 @@ o.spec("component", function() {
|
|||
var component = {
|
||||
oncreate: function(vnode) {
|
||||
called++
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(undefined)
|
||||
o(vnode.dom).equals(root.firstChild)
|
||||
o(root.childNodes.length).equals(1)
|
||||
|
|
@ -357,9 +357,9 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
var node = {tag: component}
|
||||
|
||||
|
||||
render(root, [node])
|
||||
|
||||
|
||||
o(called).equals(1)
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("a")
|
||||
|
|
@ -373,14 +373,14 @@ o.spec("component", function() {
|
|||
},
|
||||
oncreate: create,
|
||||
}
|
||||
|
||||
|
||||
function view() {
|
||||
return {tag: component}
|
||||
}
|
||||
|
||||
|
||||
render(root, view())
|
||||
render(root, view())
|
||||
|
||||
|
||||
o(create.callCount).equals(1)
|
||||
})
|
||||
o("calls oncreate when returning fragment", function() {
|
||||
|
|
@ -388,7 +388,7 @@ o.spec("component", function() {
|
|||
var component = {
|
||||
oncreate: function(vnode) {
|
||||
called++
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(undefined)
|
||||
o(vnode.dom).equals(root.firstChild)
|
||||
o(root.childNodes.length).equals(1)
|
||||
|
|
@ -398,9 +398,9 @@ o.spec("component", function() {
|
|||
}
|
||||
}
|
||||
var node = {tag: component}
|
||||
|
||||
|
||||
render(root, [node])
|
||||
|
||||
|
||||
o(called).equals(1)
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("a")
|
||||
|
|
@ -411,7 +411,7 @@ o.spec("component", function() {
|
|||
var component = {
|
||||
onupdate: function(vnode) {
|
||||
called++
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(undefined)
|
||||
o(vnode.dom).equals(root.firstChild)
|
||||
o(root.childNodes.length).equals(1)
|
||||
|
|
@ -420,13 +420,13 @@ o.spec("component", function() {
|
|||
return {tag: "div", attrs: {id: "a"}, text: "b"}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(called).equals(0)
|
||||
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(called).equals(1)
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("a")
|
||||
|
|
@ -437,7 +437,7 @@ o.spec("component", function() {
|
|||
var component = {
|
||||
onupdate: function(vnode) {
|
||||
called++
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(undefined)
|
||||
o(vnode.dom).equals(root.firstChild)
|
||||
o(root.childNodes.length).equals(1)
|
||||
|
|
@ -446,13 +446,13 @@ o.spec("component", function() {
|
|||
return [{tag: "div", attrs: {id: "a"}, text: "b"}]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(called).equals(0)
|
||||
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(called).equals(1)
|
||||
o(root.firstChild.nodeName).equals("DIV")
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("a")
|
||||
|
|
@ -463,7 +463,7 @@ o.spec("component", function() {
|
|||
var component = {
|
||||
onremove: function(vnode) {
|
||||
called++
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(undefined)
|
||||
o(vnode.dom).equals(root.firstChild)
|
||||
o(root.childNodes.length).equals(1)
|
||||
|
|
@ -472,13 +472,13 @@ o.spec("component", function() {
|
|||
return {tag: "div", attrs: {id: "a"}, text: "b"}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(called).equals(0)
|
||||
|
||||
render(root, [])
|
||||
|
||||
|
||||
o(called).equals(1)
|
||||
o(root.childNodes.length).equals(0)
|
||||
})
|
||||
|
|
@ -487,7 +487,7 @@ o.spec("component", function() {
|
|||
var component = {
|
||||
onremove: function(vnode) {
|
||||
called++
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(undefined)
|
||||
o(vnode.dom).equals(root.firstChild)
|
||||
o(root.childNodes.length).equals(1)
|
||||
|
|
@ -496,13 +496,13 @@ o.spec("component", function() {
|
|||
return [{tag: "div", attrs: {id: "a"}, text: "b"}]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(called).equals(0)
|
||||
|
||||
render(root, [])
|
||||
|
||||
|
||||
o(called).equals(1)
|
||||
o(root.childNodes.length).equals(0)
|
||||
})
|
||||
|
|
@ -511,24 +511,24 @@ o.spec("component", function() {
|
|||
var component = {
|
||||
onbeforeremove: function(vnode, done) {
|
||||
called++
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(undefined)
|
||||
o(vnode.dom).equals(root.firstChild)
|
||||
o(root.childNodes.length).equals(1)
|
||||
|
||||
|
||||
done()
|
||||
},
|
||||
view: function() {
|
||||
return {tag: "div", attrs: {id: "a"}, text: "b"}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(called).equals(0)
|
||||
|
||||
render(root, [])
|
||||
|
||||
|
||||
o(called).equals(1)
|
||||
o(root.childNodes.length).equals(0)
|
||||
})
|
||||
|
|
@ -537,24 +537,24 @@ o.spec("component", function() {
|
|||
var component = {
|
||||
onbeforeremove: function(vnode, done) {
|
||||
called++
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(undefined)
|
||||
o(vnode.dom).equals(root.firstChild)
|
||||
o(root.childNodes.length).equals(1)
|
||||
|
||||
|
||||
done()
|
||||
},
|
||||
view: function() {
|
||||
return [{tag: "div", attrs: {id: "a"}, text: "b"}]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
o(called).equals(0)
|
||||
|
||||
render(root, [])
|
||||
|
||||
|
||||
o(called).equals(1)
|
||||
o(root.childNodes.length).equals(0)
|
||||
})
|
||||
|
|
@ -568,11 +568,11 @@ o.spec("component", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: component, key: 1}
|
||||
var updated = {tag: component, key: 1}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(updated.dom)
|
||||
})
|
||||
})
|
||||
|
|
@ -586,12 +586,12 @@ o.spec("component", function() {
|
|||
return ""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
render(root, [{tag: component}])
|
||||
|
||||
|
||||
function init(vnode) {
|
||||
o(vnode.state.data).deepEquals([{a: 1}])
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -15,13 +15,13 @@ o.spec("createElement", function() {
|
|||
o("creates element", function() {
|
||||
var vnode = {tag: "div"}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("DIV")
|
||||
})
|
||||
o("creates attr", function() {
|
||||
var vnode = {tag: "div", attrs: {id: "a", title: "b"}}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("DIV")
|
||||
o(vnode.dom.attributes["id"].nodeValue).equals("a")
|
||||
o(vnode.dom.attributes["title"].nodeValue).equals("b")
|
||||
|
|
@ -29,14 +29,14 @@ o.spec("createElement", function() {
|
|||
o("creates style", function() {
|
||||
var vnode = {tag: "div", attrs: {style: {backgroundColor: "red"}}}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("DIV")
|
||||
o(vnode.dom.style.backgroundColor).equals("red")
|
||||
})
|
||||
o("creates children", function() {
|
||||
var vnode = {tag: "div", children: [{tag: "a"}, {tag: "b"}]}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("DIV")
|
||||
o(vnode.dom.childNodes.length).equals(2)
|
||||
o(vnode.dom.childNodes[0].nodeName).equals("A")
|
||||
|
|
@ -45,7 +45,7 @@ o.spec("createElement", function() {
|
|||
o("creates attrs and children", function() {
|
||||
var vnode = {tag: "div", attrs: {id: "a", title: "b"}, children: [{tag: "a"}, {tag: "b"}]}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("DIV")
|
||||
o(vnode.dom.attributes["id"].nodeValue).equals("a")
|
||||
o(vnode.dom.attributes["title"].nodeValue).equals("b")
|
||||
|
|
@ -56,7 +56,7 @@ o.spec("createElement", function() {
|
|||
o("creates svg", function() {
|
||||
var vnode = {tag: "svg", ns: "http://www.w3.org/2000/svg", children: [{tag: "a", ns: "http://www.w3.org/2000/svg", attrs: {"xlink:href": "javascript:;"}}]}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("svg")
|
||||
o(vnode.dom.namespaceURI).equals("http://www.w3.org/2000/svg")
|
||||
o(vnode.dom.firstChild.nodeName).equals("a")
|
||||
|
|
@ -67,13 +67,13 @@ o.spec("createElement", function() {
|
|||
o("sets attributes correctly for svg", function() {
|
||||
var vnode = {tag: "svg", ns: "http://www.w3.org/2000/svg", attrs: {viewBox: "0 0 100 100"}}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.attributes["viewBox"].nodeValue).equals("0 0 100 100")
|
||||
})
|
||||
o("creates mathml", function() {
|
||||
var vnode = {tag: "math", ns: "http://www.w3.org/1998/Math/MathML", children: [{tag: "mrow", ns: "http://www.w3.org/1998/Math/MathML"}]}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("math")
|
||||
o(vnode.dom.namespaceURI).equals("http://www.w3.org/1998/Math/MathML")
|
||||
o(vnode.dom.firstChild.nodeName).equals("mrow")
|
||||
|
|
|
|||
|
|
@ -15,27 +15,27 @@ o.spec("createFragment", function() {
|
|||
o("creates fragment", function() {
|
||||
var vnode = {tag: "[", children: [{tag: "a"}]}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("A")
|
||||
})
|
||||
o("handles empty fragment", function() {
|
||||
var vnode = {tag: "[", children: []}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom).equals(null)
|
||||
o(vnode.domSize).equals(0)
|
||||
})
|
||||
o("handles childless fragment", function() {
|
||||
var vnode = {tag: "["}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom).equals(null)
|
||||
o(vnode.domSize).equals(0)
|
||||
})
|
||||
o("handles multiple children", function() {
|
||||
var vnode = {tag: "[", children: [{tag: "a"}, {tag: "b"}]}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.domSize).equals(2)
|
||||
o(vnode.dom.nodeName).equals("A")
|
||||
o(vnode.dom.nextSibling.nodeName).equals("B")
|
||||
|
|
@ -43,7 +43,7 @@ o.spec("createFragment", function() {
|
|||
o("handles td", function() {
|
||||
var vnode = {tag: "[", children: [{tag: "td"}]}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(null)
|
||||
o(vnode.dom.nodeName).equals("TD")
|
||||
})
|
||||
|
|
|
|||
|
|
@ -15,26 +15,26 @@ o.spec("createHTML", function() {
|
|||
o("creates HTML", function() {
|
||||
var vnode = {tag: "<", children: "<a></a>"}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("A")
|
||||
})
|
||||
o("creates text HTML", function() {
|
||||
var vnode = {tag: "<", children: "a"}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeValue).equals("a")
|
||||
})
|
||||
o("handles empty HTML", function() {
|
||||
var vnode = {tag: "<", children: ""}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom).equals(null)
|
||||
o(vnode.domSize).equals(0)
|
||||
})
|
||||
o("handles multiple children", function() {
|
||||
var vnode = {tag: "<", children: "<a></a><b></b>"}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.domSize).equals(2)
|
||||
o(vnode.dom.nodeName).equals("A")
|
||||
o(vnode.dom.nextSibling.nodeName).equals("B")
|
||||
|
|
@ -43,11 +43,11 @@ o.spec("createHTML", function() {
|
|||
//FIXME body,head,html,frame,frameset are not supported
|
||||
//FIXME keygen is broken in Firefox
|
||||
var tags = ["a", "abbr", "acronym", "address", "applet", "area", "article", "aside", "audio", "b", "base", "basefont", "bdi", "bdo", "big", "blockquote", /*"body",*/ "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "datalist", "dd", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "font", "footer", "form", /*"frame", "frameset",*/ "h1", "h2", "h3", "h4", "h5", "h6", /*"head",*/ "header", "hr", /*"html",*/ "i", "iframe", "img", "input", "ins", "kbd", /*"keygen", */"label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noframes", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "title", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]
|
||||
|
||||
|
||||
tags.forEach(function(tag) {
|
||||
var vnode = {tag: "<", children: "<" + tag + " />"}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals(tag.toUpperCase())
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ o.spec("createNodes", function() {
|
|||
{tag: "[", children: [{tag: "#", children: "d"}]},
|
||||
]
|
||||
render(root, vnodes)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(4)
|
||||
o(root.childNodes[0].nodeName).equals("A")
|
||||
o(root.childNodes[1].nodeValue).equals("b")
|
||||
|
|
@ -36,7 +36,7 @@ o.spec("createNodes", function() {
|
|||
{tag: "[", children: [{tag: "#", children: "d"}]},
|
||||
]
|
||||
render(root, vnodes)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(4)
|
||||
o(root.childNodes[0].nodeName).equals("A")
|
||||
o(root.childNodes[1].nodeValue).equals("b")
|
||||
|
|
@ -52,7 +52,7 @@ o.spec("createNodes", function() {
|
|||
{tag: "[", children: [{tag: "#", children: "d"}]},
|
||||
]
|
||||
render(root, vnodes)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(4)
|
||||
o(root.childNodes[0].nodeName).equals("A")
|
||||
o(root.childNodes[1].nodeValue).equals("b")
|
||||
|
|
|
|||
|
|
@ -15,56 +15,56 @@ o.spec("createText", function() {
|
|||
o("creates string", function() {
|
||||
var vnode = {tag: "#", children: "a"}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("#text")
|
||||
o(vnode.dom.nodeValue).equals("a")
|
||||
})
|
||||
o("creates falsy string", function() {
|
||||
var vnode = {tag: "#", children: ""}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("#text")
|
||||
o(vnode.dom.nodeValue).equals("")
|
||||
})
|
||||
o("creates number", function() {
|
||||
var vnode = {tag: "#", children: 1}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("#text")
|
||||
o(vnode.dom.nodeValue).equals("1")
|
||||
})
|
||||
o("creates falsy number", function() {
|
||||
var vnode = {tag: "#", children: 0}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("#text")
|
||||
o(vnode.dom.nodeValue).equals("0")
|
||||
})
|
||||
o("creates boolean", function() {
|
||||
var vnode = {tag: "#", children: true}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("#text")
|
||||
o(vnode.dom.nodeValue).equals("true")
|
||||
})
|
||||
o("creates falsy boolean", function() {
|
||||
var vnode = {tag: "#", children: false}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("#text")
|
||||
o(vnode.dom.nodeValue).equals("false")
|
||||
})
|
||||
o("creates spaces", function() {
|
||||
var vnode = {tag: "#", children: " "}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("#text")
|
||||
o(vnode.dom.nodeValue).equals(" ")
|
||||
})
|
||||
o("ignores html", function() {
|
||||
var vnode = {tag: "#", children: "<a></a>™"}
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.nodeName).equals("#text")
|
||||
o(vnode.dom.nodeValue).equals("<a></a>™")
|
||||
})
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ o.spec("event", function() {
|
|||
var div = {tag: "div", attrs: {onclick: spy}}
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
e.initEvent("click", true, true)
|
||||
|
||||
|
||||
render(root, [div])
|
||||
div.dom.dispatchEvent(e)
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
o(spy.this).equals(div.dom)
|
||||
o(spy.args[0].type).equals("click")
|
||||
|
|
@ -40,11 +40,11 @@ o.spec("event", function() {
|
|||
var updated = {tag: "div", attrs: {id: "b", onclick: spy}}
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
e.initEvent("click", true, true)
|
||||
|
||||
|
||||
render(root, [div])
|
||||
render(root, [updated])
|
||||
div.dom.dispatchEvent(e)
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
o(spy.this).equals(div.dom)
|
||||
o(spy.args[0].type).equals("click")
|
||||
|
|
@ -62,10 +62,10 @@ o.spec("event", function() {
|
|||
var div = {tag: "div", attrs: {ontransitionend: spy}}
|
||||
var e = $window.document.createEvent("HTMLEvents")
|
||||
e.initEvent("transitionend", true, true)
|
||||
|
||||
|
||||
render(root, [div])
|
||||
div.dom.dispatchEvent(e)
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
o(spy.this).equals(div.dom)
|
||||
o(spy.args[0].type).equals("transitionend")
|
||||
|
|
@ -75,4 +75,4 @@ o.spec("event", function() {
|
|||
o(onevent.args[0].type).equals("transitionend")
|
||||
o(onevent.args[0].target).equals(div.dom)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -5,55 +5,55 @@ o.spec("hyperscript", function() {
|
|||
o.spec("selector", function() {
|
||||
o("handles tag in selector", function() {
|
||||
var vnode = m("a")
|
||||
|
||||
|
||||
o(vnode.tag).equals("a")
|
||||
})
|
||||
o("handles class in selector", function() {
|
||||
var vnode = m(".a")
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.className).equals("a")
|
||||
})
|
||||
o("handles many classes in selector", function() {
|
||||
var vnode = m(".a.b.c")
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.className).equals("a b c")
|
||||
})
|
||||
o("handles id in selector", function() {
|
||||
var vnode = m("#a")
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.id).equals("a")
|
||||
})
|
||||
o("handles attr in selector", function() {
|
||||
var vnode = m("[a=b]")
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("b")
|
||||
})
|
||||
o("handles many attrs in selector", function() {
|
||||
var vnode = m("[a=b][c=d]")
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.attrs.c).equals("d")
|
||||
})
|
||||
o("handles attr w/ spaces in selector", function() {
|
||||
var vnode = m("[a = b]")
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("b")
|
||||
})
|
||||
o("handles attr w/ quotes in selector", function() {
|
||||
var vnode = m("[a='b']")
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("b")
|
||||
})
|
||||
o("handles attr w/ quoted square bracket", function() {
|
||||
var vnode = m("[x][a='[b]'].c")
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.x).equals(true)
|
||||
o(vnode.attrs.a).equals("[b]")
|
||||
|
|
@ -61,55 +61,55 @@ o.spec("hyperscript", function() {
|
|||
})
|
||||
o("handles attr w/ unmatched square bracket", function() {
|
||||
var vnode = m("[a=']'].c")
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("]")
|
||||
o(vnode.attrs.className).equals("c")
|
||||
})
|
||||
o("handles attr w/ quoted square bracket and quote", function() {
|
||||
var vnode = m("[a='[b\"\\']'].c") // `[a='[b"\']']`
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("[b\"']") // `[b"']`
|
||||
o(vnode.attrs.className).equals("c")
|
||||
})
|
||||
o("handles attr w/ quoted square containing escaped square bracket", function() {
|
||||
var vnode = m("[a='[\\]]'].c") // `[a='[\]]']`
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("[\\]]") // `[\]]`
|
||||
o(vnode.attrs.className).equals("c")
|
||||
})
|
||||
o("handles attr w/ backslashes", function() {
|
||||
var vnode = m("[a='\\\\'].c") // `[a='\\']`
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("\\")
|
||||
o(vnode.attrs.className).equals("c")
|
||||
})
|
||||
o("handles attr w/ quotes and spaces in selector", function() {
|
||||
var vnode = m("[a = 'b']")
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("b")
|
||||
})
|
||||
o("handles many attr w/ quotes and spaces in selector", function() {
|
||||
var vnode = m("[a = 'b'][c = 'd']")
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.attrs.c).equals("d")
|
||||
})
|
||||
o("handles tag, class, attrs in selector", function() {
|
||||
var vnode = m("a.b[c = 'd']")
|
||||
|
||||
|
||||
o(vnode.tag).equals("a")
|
||||
o(vnode.attrs.className).equals("b")
|
||||
o(vnode.attrs.c).equals("d")
|
||||
})
|
||||
o("handles tag, mixed classes, attrs in selector", function() {
|
||||
var vnode = m("a.b[c = 'd'].e[f = 'g']")
|
||||
|
||||
|
||||
o(vnode.tag).equals("a")
|
||||
o(vnode.attrs.className).equals("b e")
|
||||
o(vnode.attrs.c).equals("d")
|
||||
|
|
@ -117,7 +117,7 @@ o.spec("hyperscript", function() {
|
|||
})
|
||||
o("handles attr without value", function() {
|
||||
var vnode = m("[a]")
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals(true)
|
||||
})
|
||||
|
|
@ -125,102 +125,102 @@ o.spec("hyperscript", function() {
|
|||
o.spec("attrs", function() {
|
||||
o("handles string attr", function() {
|
||||
var vnode = m("div", {a: "b"})
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("b")
|
||||
})
|
||||
o("handles falsy string attr", function() {
|
||||
var vnode = m("div", {a: ""})
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("")
|
||||
})
|
||||
o("handles number attr", function() {
|
||||
var vnode = m("div", {a: 1})
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals(1)
|
||||
})
|
||||
o("handles falsy number attr", function() {
|
||||
var vnode = m("div", {a: 0})
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals(0)
|
||||
})
|
||||
o("handles boolean attr", function() {
|
||||
var vnode = m("div", {a: true})
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals(true)
|
||||
})
|
||||
o("handles falsy boolean attr", function() {
|
||||
var vnode = m("div", {a: false})
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals(false)
|
||||
})
|
||||
o("handles many attrs", function() {
|
||||
var vnode = m("div", {a: "b", c: "d"})
|
||||
|
||||
|
||||
o(vnode.tag).equals("div")
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.attrs.c).equals("d")
|
||||
})
|
||||
o("handles merging classes w/ class property", function() {
|
||||
var vnode = m(".a", {class: "b"})
|
||||
|
||||
|
||||
o(vnode.attrs.className).equals("a b")
|
||||
})
|
||||
o("handles merging classes w/ className property", function() {
|
||||
var vnode = m(".a", {className: "b"})
|
||||
|
||||
|
||||
o(vnode.attrs.className).equals("a b")
|
||||
})
|
||||
})
|
||||
o.spec("children", function() {
|
||||
o("handles string single child", function() {
|
||||
var vnode = m("div", {}, ["a"])
|
||||
|
||||
|
||||
o(vnode.text).equals("a")
|
||||
})
|
||||
o("handles falsy string single child", function() {
|
||||
var vnode = m("div", {}, [""])
|
||||
|
||||
|
||||
o(vnode.text).equals("")
|
||||
})
|
||||
o("handles number single child", function() {
|
||||
var vnode = m("div", {}, [1])
|
||||
|
||||
|
||||
o(vnode.text).equals(1)
|
||||
})
|
||||
o("handles falsy number single child", function() {
|
||||
var vnode = m("div", {}, [0])
|
||||
|
||||
|
||||
o(vnode.text).equals(0)
|
||||
})
|
||||
o("handles boolean single child", function() {
|
||||
var vnode = m("div", {}, [true])
|
||||
|
||||
|
||||
o(vnode.text).equals(true)
|
||||
})
|
||||
o("handles falsy boolean single child", function() {
|
||||
var vnode = m("div", {}, [false])
|
||||
|
||||
|
||||
o(vnode.text).equals(false)
|
||||
})
|
||||
o("handles null single child", function() {
|
||||
var vnode = m("div", {}, [null])
|
||||
|
||||
|
||||
o(vnode.children[0]).equals(null)
|
||||
})
|
||||
o("handles undefined single child", function() {
|
||||
var vnode = m("div", {}, [undefined])
|
||||
|
||||
|
||||
o(vnode.children[0]).equals(undefined)
|
||||
})
|
||||
o("handles multiple string children", function() {
|
||||
var vnode = m("div", {}, ["", "a"])
|
||||
|
||||
|
||||
o(vnode.children[0].tag).equals("#")
|
||||
o(vnode.children[0].children).equals("")
|
||||
o(vnode.children[1].tag).equals("#")
|
||||
|
|
@ -228,7 +228,7 @@ o.spec("hyperscript", function() {
|
|||
})
|
||||
o("handles multiple number children", function() {
|
||||
var vnode = m("div", {}, [0, 1])
|
||||
|
||||
|
||||
o(vnode.children[0].tag).equals("#")
|
||||
o(vnode.children[0].children).equals(0)
|
||||
o(vnode.children[1].tag).equals("#")
|
||||
|
|
@ -236,7 +236,7 @@ o.spec("hyperscript", function() {
|
|||
})
|
||||
o("handles multiple boolean children", function() {
|
||||
var vnode = m("div", {}, [false, true])
|
||||
|
||||
|
||||
o(vnode.children[0].tag).equals("#")
|
||||
o(vnode.children[0].children).equals(false)
|
||||
o(vnode.children[1].tag).equals("#")
|
||||
|
|
@ -244,7 +244,7 @@ o.spec("hyperscript", function() {
|
|||
})
|
||||
o("handles multiple null/undefined child", function() {
|
||||
var vnode = m("div", {}, [null, undefined])
|
||||
|
||||
|
||||
o(vnode.children[0]).equals(null)
|
||||
o(vnode.children[1]).equals(undefined)
|
||||
})
|
||||
|
|
@ -252,47 +252,47 @@ o.spec("hyperscript", function() {
|
|||
o.spec("permutations", function() {
|
||||
o("handles null attr and children", function() {
|
||||
var vnode = m("div", null, [m("a"), m("b")])
|
||||
|
||||
|
||||
o(vnode.children.length).equals(2)
|
||||
o(vnode.children[0].tag).equals("a")
|
||||
o(vnode.children[1].tag).equals("b")
|
||||
})
|
||||
o("handles null attr and child unwrapped", function() {
|
||||
var vnode = m("div", null, m("a"))
|
||||
|
||||
|
||||
o(vnode.children.length).equals(1)
|
||||
o(vnode.children[0].tag).equals("a")
|
||||
})
|
||||
o("handles null attr and children unwrapped", function() {
|
||||
var vnode = m("div", null, m("a"), m("b"))
|
||||
|
||||
|
||||
o(vnode.children.length).equals(2)
|
||||
o(vnode.children[0].tag).equals("a")
|
||||
o(vnode.children[1].tag).equals("b")
|
||||
})
|
||||
o("handles attr and children", function() {
|
||||
var vnode = m("div", {a: "b"}, [m("i"), m("s")])
|
||||
|
||||
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.children[0].tag).equals("i")
|
||||
o(vnode.children[1].tag).equals("s")
|
||||
})
|
||||
o("handles attr and child unwrapped", function() {
|
||||
var vnode = m("div", {a: "b"}, m("i"))
|
||||
|
||||
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.children[0].tag).equals("i")
|
||||
})
|
||||
o("handles attr and children unwrapped", function() {
|
||||
var vnode = m("div", {a: "b"}, m("i"), m("s"))
|
||||
|
||||
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.children[0].tag).equals("i")
|
||||
o(vnode.children[1].tag).equals("s")
|
||||
})
|
||||
o("handles attr and text children", function() {
|
||||
var vnode = m("div", {a: "b"}, ["c", "d"])
|
||||
|
||||
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.children[0].tag).equals("#")
|
||||
o(vnode.children[0].children).equals("c")
|
||||
|
|
@ -301,49 +301,49 @@ o.spec("hyperscript", function() {
|
|||
})
|
||||
o("handles attr and single string text child", function() {
|
||||
var vnode = m("div", {a: "b"}, ["c"])
|
||||
|
||||
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.text).equals("c")
|
||||
})
|
||||
o("handles attr and single falsy string text child", function() {
|
||||
var vnode = m("div", {a: "b"}, [""])
|
||||
|
||||
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.text).equals("")
|
||||
})
|
||||
o("handles attr and single number text child", function() {
|
||||
var vnode = m("div", {a: "b"}, [1])
|
||||
|
||||
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.text).equals(1)
|
||||
})
|
||||
o("handles attr and single falsy number text child", function() {
|
||||
var vnode = m("div", {a: "b"}, [0])
|
||||
|
||||
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.text).equals(0)
|
||||
})
|
||||
o("handles attr and single boolean text child", function() {
|
||||
var vnode = m("div", {a: "b"}, [true])
|
||||
|
||||
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.text).equals(true)
|
||||
})
|
||||
o("handles attr and single falsy boolean text child", function() {
|
||||
var vnode = m("div", {a: "b"}, [false])
|
||||
|
||||
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.text).equals(false)
|
||||
})
|
||||
o("handles attr and single text child unwrapped", function() {
|
||||
var vnode = m("div", {a: "b"}, "c")
|
||||
|
||||
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.text).equals("c")
|
||||
})
|
||||
o("handles attr and text children unwrapped", function() {
|
||||
var vnode = m("div", {a: "b"}, "c", "d")
|
||||
|
||||
|
||||
o(vnode.attrs.a).equals("b")
|
||||
o(vnode.children[0].tag).equals("#")
|
||||
o(vnode.children[0].children).equals("c")
|
||||
|
|
@ -352,27 +352,27 @@ o.spec("hyperscript", function() {
|
|||
})
|
||||
o("handles children without attr", function() {
|
||||
var vnode = m("div", [m("i"), m("s")])
|
||||
|
||||
|
||||
o(vnode.attrs).equals(undefined)
|
||||
o(vnode.children[0].tag).equals("i")
|
||||
o(vnode.children[1].tag).equals("s")
|
||||
})
|
||||
o("handles child without attr unwrapped", function() {
|
||||
var vnode = m("div", m("i"))
|
||||
|
||||
|
||||
o(vnode.attrs).equals(undefined)
|
||||
o(vnode.children[0].tag).equals("i")
|
||||
})
|
||||
o("handles children without attr unwrapped", function() {
|
||||
var vnode = m("div", m("i"), m("s"))
|
||||
|
||||
|
||||
o(vnode.attrs).equals(undefined)
|
||||
o(vnode.children[0].tag).equals("i")
|
||||
o(vnode.children[1].tag).equals("s")
|
||||
})
|
||||
o("handles fragment children without attr unwrapped", function() {
|
||||
var vnode = m("div", [m("i")], [m("s")])
|
||||
|
||||
|
||||
o(vnode.children[0].tag).equals("[")
|
||||
o(vnode.children[0].children[0].tag).equals("i")
|
||||
o(vnode.children[1].tag).equals("[")
|
||||
|
|
@ -380,14 +380,14 @@ o.spec("hyperscript", function() {
|
|||
})
|
||||
o("handles children with nested array", function() {
|
||||
var vnode = m("div", [[m("i"), m("s")]])
|
||||
|
||||
|
||||
o(vnode.children[0].tag).equals("[")
|
||||
o(vnode.children[0].children[0].tag).equals("i")
|
||||
o(vnode.children[0].children[1].tag).equals("s")
|
||||
})
|
||||
o("handles children with deeply nested array", function() {
|
||||
var vnode = m("div", [[[m("i"), m("s")]]])
|
||||
|
||||
|
||||
o(vnode.children[0].tag).equals("[")
|
||||
o(vnode.children[0].children[0].tag).equals("[")
|
||||
o(vnode.children[0].children[0].children[0].tag).equals("i")
|
||||
|
|
@ -402,7 +402,7 @@ o.spec("hyperscript", function() {
|
|||
}
|
||||
}
|
||||
var vnode = m(component, {id: "a"}, "b")
|
||||
|
||||
|
||||
o(vnode.tag).equals(component)
|
||||
o(vnode.attrs.id).equals("a")
|
||||
o(vnode.children.length).equals(1)
|
||||
|
|
@ -410,4 +410,4 @@ o.spec("hyperscript", function() {
|
|||
o(vnode.children[0].children).equals("b")
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -22,86 +22,86 @@ o.spec("form inputs", function() {
|
|||
var input = {tag: "input", key: 1}
|
||||
var a = {tag: "a", key: 2}
|
||||
var b = {tag: "b", key: 3}
|
||||
|
||||
|
||||
render(root, [input, a, b])
|
||||
input.dom.focus()
|
||||
render(root, [a, input, b])
|
||||
|
||||
|
||||
o($window.document.activeElement).equals(input.dom)
|
||||
})
|
||||
|
||||
|
||||
o("syncs input value if DOM value differs from vdom value", function() {
|
||||
var input = {tag: "input", attrs: {value: "aaa", oninput: function() {}}}
|
||||
var updated = {tag: "input", attrs: {value: "aaa", oninput: function() {}}}
|
||||
|
||||
|
||||
render(root, [input])
|
||||
|
||||
|
||||
//simulate user typing
|
||||
var e = $window.document.createEvent("KeyboardEvent")
|
||||
e.initEvent("input", true, true)
|
||||
input.dom.focus()
|
||||
input.dom.value += "a"
|
||||
input.dom.dispatchEvent(e)
|
||||
|
||||
|
||||
//re-render may use same vdom value as previous render call
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.value).equals("aaa")
|
||||
})
|
||||
|
||||
|
||||
o("syncs input checked attribute if DOM value differs from vdom value", function() {
|
||||
var input = {tag: "input", attrs: {type: "checkbox", checked: true, onclick: function() {}}}
|
||||
var updated = {tag: "input", attrs: {type: "checkbox", checked: true, onclick: function() {}}}
|
||||
|
||||
|
||||
render(root, [input])
|
||||
|
||||
|
||||
//simulate user clicking checkbox
|
||||
var e = $window.document.createEvent("MouseEvents")
|
||||
e.initEvent("click", true, true)
|
||||
input.dom.focus()
|
||||
input.dom.dispatchEvent(e)
|
||||
|
||||
|
||||
//re-render may use same vdom value as previous render call
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.checked).equals(true)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("select", function() {
|
||||
o("select works without attributes", function() {
|
||||
var select = {tag: "select", children: [
|
||||
{tag: "option", attrs: {value: "a"}, text: "aaa"},
|
||||
]}
|
||||
|
||||
|
||||
render(root, [select])
|
||||
|
||||
|
||||
o(select.dom.value).equals("a")
|
||||
o(select.dom.selectedIndex).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("select yields invalid value without children", function() {
|
||||
var select = {tag: "select", attrs: {value: "a"}}
|
||||
|
||||
|
||||
render(root, [select])
|
||||
|
||||
|
||||
o(select.dom.value).equals("")
|
||||
o(select.dom.selectedIndex).equals(-1)
|
||||
})
|
||||
|
||||
|
||||
o("select value is set correctly on first render", function() {
|
||||
var select = {tag: "select", attrs: {value: "b"}, children: [
|
||||
{tag: "option", attrs: {value: "a"}, text: "aaa"},
|
||||
{tag: "option", attrs: {value: "b"}, text: "bbb"},
|
||||
{tag: "option", attrs: {value: "c"}, text: "ccc"},
|
||||
]}
|
||||
|
||||
|
||||
render(root, [select])
|
||||
|
||||
|
||||
o(select.dom.value).equals("b")
|
||||
o(select.dom.selectedIndex).equals(1)
|
||||
})
|
||||
|
||||
|
||||
o("syncs select value if DOM value differs from vdom value", function() {
|
||||
function makeSelect() {
|
||||
return {tag: "select", attrs: {value: "b"}, children: [
|
||||
|
|
@ -110,33 +110,33 @@ o.spec("form inputs", function() {
|
|||
{tag: "option", attrs: {value: "c"}, text: "ccc"},
|
||||
]}
|
||||
}
|
||||
|
||||
|
||||
render(root, [makeSelect()])
|
||||
|
||||
|
||||
//simulate user selecting option
|
||||
root.firstChild.value = "c"
|
||||
root.firstChild.focus()
|
||||
|
||||
|
||||
//re-render may use same vdom value as previous render call
|
||||
render(root, [makeSelect()])
|
||||
|
||||
|
||||
o(root.firstChild.value).equals("b")
|
||||
o(root.firstChild.selectedIndex).equals(1)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("textarea", function() {
|
||||
o("updates after user input", function() {
|
||||
render(root, [{tag: "textarea", text: "aaa"}])
|
||||
|
||||
|
||||
//simulate typing
|
||||
root.firstChild.value = "bbb"
|
||||
|
||||
|
||||
//re-render may occur after value attribute is touched
|
||||
render(root, [{tag: "textarea", text: "ccc"}])
|
||||
|
||||
|
||||
o(root.firstChild.value).equals("ccc")
|
||||
//FIXME should fail if fix is commented out
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ var Node = require("../../render/node")
|
|||
o.spec("normalize", function() {
|
||||
o("normalizes array into fragment", function() {
|
||||
var node = Node.normalize([])
|
||||
|
||||
|
||||
o(node.tag).equals("[")
|
||||
o(node.children.length).equals(0)
|
||||
})
|
||||
o("normalizes nested array into fragment", function() {
|
||||
var node = Node.normalize([[]])
|
||||
|
||||
|
||||
o(node.tag).equals("[")
|
||||
o(node.children.length).equals(1)
|
||||
o(node.children[0].tag).equals("[")
|
||||
|
|
@ -20,39 +20,38 @@ o.spec("normalize", function() {
|
|||
})
|
||||
o("normalizes string into text node", function() {
|
||||
var node = Node.normalize("a")
|
||||
|
||||
|
||||
o(node.tag).equals("#")
|
||||
o(node.children).equals("a")
|
||||
})
|
||||
o("normalizes falsy string into text node", function() {
|
||||
var node = Node.normalize("")
|
||||
|
||||
|
||||
o(node.tag).equals("#")
|
||||
o(node.children).equals("")
|
||||
})
|
||||
o("normalizes number into text node", function() {
|
||||
var node = Node.normalize(1)
|
||||
|
||||
|
||||
o(node.tag).equals("#")
|
||||
o(node.children).equals(1)
|
||||
})
|
||||
o("normalizes falsy number into text node", function() {
|
||||
var node = Node.normalize(0)
|
||||
|
||||
|
||||
o(node.tag).equals("#")
|
||||
o(node.children).equals(0)
|
||||
})
|
||||
o("normalizes boolean into text node", function() {
|
||||
var node = Node.normalize(true)
|
||||
|
||||
|
||||
o(node.tag).equals("#")
|
||||
o(node.children).equals(true)
|
||||
})
|
||||
o("normalizes falsy boolean into text node", function() {
|
||||
var node = Node.normalize(false)
|
||||
|
||||
|
||||
o(node.tag).equals("#")
|
||||
o(node.children).equals(false)
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -6,15 +6,14 @@ var Node = require("../../render/node")
|
|||
o.spec("normalizeChildren", function() {
|
||||
o("normalizes arrays into fragments", function() {
|
||||
var children = Node.normalizeChildren([[]])
|
||||
|
||||
|
||||
o(children[0].tag).equals("[")
|
||||
o(children[0].children.length).equals(0)
|
||||
})
|
||||
o("normalizes strings into text nodes", function() {
|
||||
var children = Node.normalizeChildren(["a"])
|
||||
|
||||
|
||||
o(children[0].tag).equals("#")
|
||||
o(children[0].children).equals("a")
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@ o.spec("onbeforeremove", function() {
|
|||
var create = o.spy()
|
||||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onbeforeremove: create}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
})
|
||||
o("does not call onbeforeremove when updating", function() {
|
||||
|
|
@ -27,29 +27,29 @@ o.spec("onbeforeremove", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onbeforeremove: create}}
|
||||
var updated = {tag: "div", attrs: {onbeforeremove: update}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(0)
|
||||
})
|
||||
o("calls onbeforeremove when removing element", function(done) {
|
||||
var vnode = {tag: "div", attrs: {onbeforeremove: remove}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
|
||||
|
||||
function remove(node, complete) {
|
||||
o(node).equals(vnode)
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild).equals(vnode.dom)
|
||||
|
||||
|
||||
callAsync(function() {
|
||||
o(root.childNodes.length).equals(1)
|
||||
|
||||
|
||||
complete()
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(0)
|
||||
|
||||
done()
|
||||
|
|
@ -58,20 +58,20 @@ o.spec("onbeforeremove", function() {
|
|||
})
|
||||
o("calls onbeforeremove when removing text", function(done) {
|
||||
var vnode = {tag: "#", attrs: {onbeforeremove: remove}, children: "a"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
|
||||
|
||||
function remove(node, complete) {
|
||||
o(node).equals(vnode)
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild).equals(vnode.dom)
|
||||
|
||||
|
||||
callAsync(function() {
|
||||
o(root.childNodes.length).equals(1)
|
||||
|
||||
|
||||
complete()
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(0)
|
||||
|
||||
done()
|
||||
|
|
@ -80,20 +80,20 @@ o.spec("onbeforeremove", function() {
|
|||
})
|
||||
o("calls onbeforeremove when removing fragment", function(done) {
|
||||
var vnode = {tag: "[", attrs: {onbeforeremove: remove}, children: [{tag: "div"}]}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
|
||||
|
||||
function remove(node, complete) {
|
||||
o(node).equals(vnode)
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild).equals(vnode.dom)
|
||||
|
||||
|
||||
callAsync(function() {
|
||||
o(root.childNodes.length).equals(1)
|
||||
|
||||
|
||||
complete()
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(0)
|
||||
|
||||
done()
|
||||
|
|
@ -102,20 +102,20 @@ o.spec("onbeforeremove", function() {
|
|||
})
|
||||
o("calls onbeforeremove when removing html", function(done) {
|
||||
var vnode = {tag: "<", attrs: {onbeforeremove: remove}, children: "a"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
|
||||
|
||||
function remove(node, complete) {
|
||||
o(node).equals(vnode)
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild).equals(vnode.dom)
|
||||
|
||||
|
||||
callAsync(function() {
|
||||
o(root.childNodes.length).equals(1)
|
||||
|
||||
|
||||
complete()
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(0)
|
||||
|
||||
done()
|
||||
|
|
@ -125,21 +125,21 @@ o.spec("onbeforeremove", function() {
|
|||
o("calls remove after onbeforeremove resolves", function(done) {
|
||||
var spy = o.spy()
|
||||
var vnode = {tag: "<", attrs: {onbeforeremove: remove, onremove: spy}, children: "a"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
|
||||
|
||||
function remove(node, complete) {
|
||||
o(node).equals(vnode)
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(root.firstChild).equals(vnode.dom)
|
||||
|
||||
|
||||
callAsync(function() {
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(spy.callCount).equals(0)
|
||||
|
||||
|
||||
complete()
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(0)
|
||||
o(spy.callCount).equals(1)
|
||||
|
||||
|
|
@ -150,9 +150,9 @@ o.spec("onbeforeremove", function() {
|
|||
o("does not set onbeforeremove as an event handler", function() {
|
||||
var remove = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onbeforeremove: remove}, children: []}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.onbeforeremove).equals(undefined)
|
||||
o(vnode.dom.attributes["onbeforeremove"]).equals(undefined)
|
||||
})
|
||||
|
|
@ -160,11 +160,11 @@ o.spec("onbeforeremove", function() {
|
|||
var remove = function(vnode, done) {done()}
|
||||
var vnode = {tag: "div", key: 1, attrs: {onbeforeremove: remove}}
|
||||
var updated = {tag: "div", key: 1, attrs: {onbeforeremove: remove}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(updated.dom)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -11,51 +11,51 @@ o.spec("onbeforeupdate", function() {
|
|||
root = $window.document.createElement("div")
|
||||
render = vdom($window).render
|
||||
})
|
||||
|
||||
|
||||
o("prevents update in element", function() {
|
||||
var onbeforeupdate = function() {return false}
|
||||
var vnode = {tag: "div", attrs: {id: "a", onbeforeupdate: onbeforeupdate}}
|
||||
var updated = {tag: "div", attrs: {id: "b", onbeforeupdate: onbeforeupdate}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("a")
|
||||
})
|
||||
|
||||
|
||||
o("prevents update in text", function() {
|
||||
var onbeforeupdate = function() {return false}
|
||||
var vnode = {tag: "#", attrs: {onbeforeupdate: onbeforeupdate}, children: "a"}
|
||||
var updated = {tag: "#", attrs: {onbeforeupdate: onbeforeupdate}, children: "b"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(root.firstChild.nodeValue).equals("a")
|
||||
})
|
||||
|
||||
|
||||
o("prevents update in html", function() {
|
||||
var onbeforeupdate = function() {return false}
|
||||
var vnode = {tag: "<", attrs: {onbeforeupdate: onbeforeupdate}, children: "a"}
|
||||
var updated = {tag: "<", attrs: {onbeforeupdate: onbeforeupdate}, children: "b"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(root.firstChild.nodeValue).equals("a")
|
||||
})
|
||||
|
||||
|
||||
o("prevents update in fragment", function() {
|
||||
var onbeforeupdate = function() {return false}
|
||||
var vnode = {tag: "[", attrs: {onbeforeupdate: onbeforeupdate}, children: [{tag: "#", children: "a"}]}
|
||||
var updated = {tag: "[", attrs: {onbeforeupdate: onbeforeupdate}, children: [{tag: "#", children: "b"}]}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(root.firstChild.nodeValue).equals("a")
|
||||
})
|
||||
|
||||
|
||||
o("prevents update in component", function() {
|
||||
var component = {
|
||||
onbeforeupdate: function() {return false},
|
||||
|
|
@ -65,13 +65,13 @@ o.spec("onbeforeupdate", function() {
|
|||
}
|
||||
var vnode = {tag: component, children: [{tag: "#", children: "a"}]}
|
||||
var updated = {tag: component, children: [{tag: "#", children: "b"}]}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(root.firstChild.firstChild.nodeValue).equals("a")
|
||||
})
|
||||
|
||||
|
||||
o("prevents update if returning false in component and false in vnode", function() {
|
||||
var component = {
|
||||
onbeforeupdate: function() {return false},
|
||||
|
|
@ -81,13 +81,13 @@ o.spec("onbeforeupdate", function() {
|
|||
}
|
||||
var vnode = {tag: component, attrs: {id: "a", onbeforeupdate: function() {return false}}}
|
||||
var updated = {tag: component, attrs: {id: "b", onbeforeupdate: function() {return false}}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("a")
|
||||
})
|
||||
|
||||
|
||||
o("does not prevent update if returning true in component and true in vnode", function() {
|
||||
var component = {
|
||||
onbeforeupdate: function() {return true},
|
||||
|
|
@ -97,13 +97,13 @@ o.spec("onbeforeupdate", function() {
|
|||
}
|
||||
var vnode = {tag: component, attrs: {id: "a", onbeforeupdate: function() {return true}}}
|
||||
var updated = {tag: component, attrs: {id: "b", onbeforeupdate: function() {return true}}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("b")
|
||||
})
|
||||
|
||||
|
||||
o("does not prevent update if returning false in component but true in vnode", function() {
|
||||
var component = {
|
||||
onbeforeupdate: function() {return false},
|
||||
|
|
@ -113,13 +113,13 @@ o.spec("onbeforeupdate", function() {
|
|||
}
|
||||
var vnode = {tag: component, attrs: {id: "a", onbeforeupdate: function() {return true}}}
|
||||
var updated = {tag: component, attrs: {id: "b", onbeforeupdate: function() {return true}}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("b")
|
||||
})
|
||||
|
||||
|
||||
o("does not prevent update if returning true in component but false in vnode", function() {
|
||||
var component = {
|
||||
onbeforeupdate: function() {return true},
|
||||
|
|
@ -129,24 +129,24 @@ o.spec("onbeforeupdate", function() {
|
|||
}
|
||||
var vnode = {tag: component, attrs: {id: "a", onbeforeupdate: function() {return false}}}
|
||||
var updated = {tag: component, attrs: {id: "b", onbeforeupdate: function() {return false}}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("b")
|
||||
})
|
||||
|
||||
|
||||
o("does not prevent update if returning true", function() {
|
||||
var onbeforeupdate = function() {return true}
|
||||
var vnode = {tag: "div", attrs: {id: "a", onbeforeupdate: onbeforeupdate}}
|
||||
var updated = {tag: "div", attrs: {id: "b", onbeforeupdate: onbeforeupdate}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("b")
|
||||
})
|
||||
|
||||
|
||||
o("does not prevent update if returning true from component", function() {
|
||||
var component = {
|
||||
onbeforeupdate: function() {return true},
|
||||
|
|
@ -156,34 +156,34 @@ o.spec("onbeforeupdate", function() {
|
|||
}
|
||||
var vnode = {tag: component, attrs: {id: "a"}}
|
||||
var updated = {tag: component, attrs: {id: "b"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("b")
|
||||
})
|
||||
|
||||
|
||||
o("accepts arguments for comparison", function() {
|
||||
var count = 0
|
||||
var vnode = {tag: "div", attrs: {id: "a", onbeforeupdate: onbeforeupdate}}
|
||||
var updated = {tag: "div", attrs: {id: "b", onbeforeupdate: onbeforeupdate}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
function onbeforeupdate(vnode, old) {
|
||||
count++
|
||||
|
||||
|
||||
o(old.attrs.id).equals("a")
|
||||
o(vnode.attrs.id).equals("b")
|
||||
|
||||
|
||||
return old.attrs.id !== vnode.attrs.id
|
||||
}
|
||||
|
||||
|
||||
o(count).equals(1)
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("b")
|
||||
})
|
||||
|
||||
|
||||
o("accepts arguments for comparison in component", function() {
|
||||
var component = {
|
||||
onbeforeupdate: onbeforeupdate,
|
||||
|
|
@ -194,38 +194,38 @@ o.spec("onbeforeupdate", function() {
|
|||
var count = 0
|
||||
var vnode = {tag: component, attrs: {id: "a"}}
|
||||
var updated = {tag: component, attrs: {id: "b"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
function onbeforeupdate(vnode, old) {
|
||||
count++
|
||||
|
||||
|
||||
o(old.attrs.id).equals("a")
|
||||
o(vnode.attrs.id).equals("b")
|
||||
|
||||
|
||||
return old.attrs.id !== vnode.attrs.id
|
||||
}
|
||||
|
||||
|
||||
o(count).equals(1)
|
||||
o(root.firstChild.attributes["id"].nodeValue).equals("b")
|
||||
})
|
||||
|
||||
|
||||
o("is not called on creation", function() {
|
||||
var count = 0
|
||||
var vnode = {tag: "div", attrs: {id: "a", onbeforeupdate: onbeforeupdate}}
|
||||
var updated = {tag: "div", attrs: {id: "b", onbeforeupdate: onbeforeupdate}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
function onbeforeupdate(vnode, old) {
|
||||
count++
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
o(count).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("is not called on component creation", function() {
|
||||
var component = {
|
||||
onbeforeupdate: onbeforeupdate,
|
||||
|
|
@ -233,37 +233,37 @@ o.spec("onbeforeupdate", function() {
|
|||
return {tag: "div", attrs: vnode.attrs}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
var count = 0
|
||||
var vnode = {tag: "div", attrs: {id: "a"}}
|
||||
var updated = {tag: "div", attrs: {id: "b"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
function onbeforeupdate(vnode, old) {
|
||||
count++
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
o(count).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("is called only once on update", function() {
|
||||
var count = 0
|
||||
var vnode = {tag: "div", attrs: {id: "a", onbeforeupdate: onbeforeupdate}}
|
||||
var updated = {tag: "div", attrs: {id: "b", onbeforeupdate: onbeforeupdate}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
function onbeforeupdate(vnode, old) {
|
||||
count++
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
o(count).equals(1)
|
||||
})
|
||||
|
||||
|
||||
o("is called only once on component update", function() {
|
||||
var component = {
|
||||
onbeforeupdate: onbeforeupdate,
|
||||
|
|
@ -271,19 +271,19 @@ o.spec("onbeforeupdate", function() {
|
|||
return {tag: "div", attrs: vnode.attrs}
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
var count = 0
|
||||
var vnode = {tag: component, attrs: {id: "a"}}
|
||||
var updated = {tag: component, attrs: {id: "b"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
function onbeforeupdate(vnode, old) {
|
||||
count++
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
o(count).equals(1)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ o.spec("oncreate", function() {
|
|||
o("calls oncreate when creating element", function() {
|
||||
var callback = o.spy()
|
||||
var vnode = {tag: "div", attrs: {oncreate: callback}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(callback.callCount).equals(1)
|
||||
o(callback.this).equals(vnode.state)
|
||||
o(callback.args[0]).equals(vnode)
|
||||
|
|
@ -25,9 +25,9 @@ o.spec("oncreate", function() {
|
|||
o("calls oncreate when creating text", function() {
|
||||
var callback = o.spy()
|
||||
var vnode = {tag: "#", attrs: {oncreate: callback}, children: "a", state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(callback.callCount).equals(1)
|
||||
o(callback.this).equals(vnode.state)
|
||||
o(callback.args[0]).equals(vnode)
|
||||
|
|
@ -35,9 +35,9 @@ o.spec("oncreate", function() {
|
|||
o("calls oncreate when creating fragment", function() {
|
||||
var callback = o.spy()
|
||||
var vnode = {tag: "[", attrs: {oncreate: callback}, children: [], state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(callback.callCount).equals(1)
|
||||
o(callback.this).equals(vnode.state)
|
||||
o(callback.args[0]).equals(vnode)
|
||||
|
|
@ -45,9 +45,9 @@ o.spec("oncreate", function() {
|
|||
o("calls oncreate when creating html", function() {
|
||||
var callback = o.spy()
|
||||
var vnode = {tag: "<", attrs: {oncreate: callback}, children: "a", state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(callback.callCount).equals(1)
|
||||
o(callback.this).equals(vnode.state)
|
||||
o(callback.args[0]).equals(vnode)
|
||||
|
|
@ -57,10 +57,10 @@ o.spec("oncreate", function() {
|
|||
var createA = o.spy()
|
||||
var vnode = {tag: "div", key: 1, attrs: {oncreate: createDiv}, state: {}}
|
||||
var updated = {tag: "a", key: 1, attrs: {oncreate: createA}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(createDiv.callCount).equals(1)
|
||||
o(createDiv.this).equals(vnode.state)
|
||||
o(createDiv.args[0]).equals(vnode)
|
||||
|
|
@ -73,10 +73,10 @@ o.spec("oncreate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {oncreate: create}, state: {}}
|
||||
var updated = {tag: "div", attrs: {oncreate: update}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
o(create.args[0]).equals(vnode)
|
||||
|
|
@ -87,10 +87,10 @@ o.spec("oncreate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {oncreate: create}, state: {}}
|
||||
var updated = {tag: "div", attrs: {oncreate: update, id: "a"}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
o(create.args[0]).equals(vnode)
|
||||
|
|
@ -101,10 +101,10 @@ o.spec("oncreate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {oncreate: create}, children: [{tag: "a"}], state: {}}
|
||||
var updated = {tag: "div", attrs: {oncreate: update}, children: [{tag: "b"}], state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
o(create.args[0]).equals(vnode)
|
||||
|
|
@ -117,10 +117,10 @@ o.spec("oncreate", function() {
|
|||
var otherVnode = {tag: "a", key: 2}
|
||||
var updated = {tag: "div", key: 1, attrs: {oncreate: update}, state: {}}
|
||||
var otherUpdated = {tag: "a", key: 2}
|
||||
|
||||
|
||||
render(root, [vnode, otherVnode])
|
||||
render(root, [otherUpdated, updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
o(create.args[0]).equals(vnode)
|
||||
|
|
@ -130,10 +130,10 @@ o.spec("oncreate", function() {
|
|||
var create = o.spy()
|
||||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {oncreate: create}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
|
||||
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
o(create.args[0]).equals(vnode)
|
||||
|
|
@ -143,11 +143,11 @@ o.spec("oncreate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", key: 1, attrs: {oncreate: create}, state: {}}
|
||||
var updated = {tag: "div", key: 1, attrs: {oncreate: update}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(updated.dom)
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
|
|
@ -162,10 +162,10 @@ o.spec("oncreate", function() {
|
|||
var callback = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onupdate: create}, children: [], state: {}}
|
||||
var updated = {tag: "div", attrs: {onupdate: update}, children: [{tag: "a", attrs: {oncreate: callback}, state: {}}], state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(1)
|
||||
o(update.this).equals(vnode.state)
|
||||
|
|
@ -181,12 +181,12 @@ o.spec("oncreate", function() {
|
|||
{tag: "b"}
|
||||
]}
|
||||
]}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
function create(vnode) {
|
||||
created = true
|
||||
|
||||
|
||||
o(vnode.dom.parentNode).notEquals(null)
|
||||
o(vnode.dom.childNodes.length).equals(1)
|
||||
}
|
||||
|
|
@ -195,9 +195,9 @@ o.spec("oncreate", function() {
|
|||
o("does not set oncreate as an event handler", function() {
|
||||
var create = o.spy()
|
||||
var vnode = {tag: "div", attrs: {oncreate: create}, children: []}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.oncreate).equals(undefined)
|
||||
o(vnode.dom.attributes["oncreate"]).equals(undefined)
|
||||
})
|
||||
|
|
@ -206,11 +206,11 @@ o.spec("oncreate", function() {
|
|||
var vnodes = [{tag: "div", key: 1, attrs: {oncreate: create}}]
|
||||
var temp = []
|
||||
var updated = [{tag: "div", key: 1, attrs: {oncreate: create}}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(create.callCount).equals(2)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -15,9 +15,9 @@ o.spec("oninit", function() {
|
|||
o("calls oninit when creating element", function() {
|
||||
var callback = o.spy()
|
||||
var vnode = {tag: "div", attrs: {oninit: callback}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(callback.callCount).equals(1)
|
||||
o(callback.this).equals(vnode.state)
|
||||
o(callback.args[0]).equals(vnode)
|
||||
|
|
@ -25,9 +25,9 @@ o.spec("oninit", function() {
|
|||
o("calls oninit when creating text", function() {
|
||||
var callback = o.spy()
|
||||
var vnode = {tag: "#", attrs: {oninit: callback}, children: "a", state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(callback.callCount).equals(1)
|
||||
o(callback.this).equals(vnode.state)
|
||||
o(callback.args[0]).equals(vnode)
|
||||
|
|
@ -35,9 +35,9 @@ o.spec("oninit", function() {
|
|||
o("calls oninit when creating fragment", function() {
|
||||
var callback = o.spy()
|
||||
var vnode = {tag: "[", attrs: {oninit: callback}, children: [], state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(callback.callCount).equals(1)
|
||||
o(callback.this).equals(vnode.state)
|
||||
o(callback.args[0]).equals(vnode)
|
||||
|
|
@ -45,9 +45,9 @@ o.spec("oninit", function() {
|
|||
o("calls oninit when creating html", function() {
|
||||
var callback = o.spy()
|
||||
var vnode = {tag: "<", attrs: {oninit: callback}, children: "a", state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(callback.callCount).equals(1)
|
||||
o(callback.this).equals(vnode.state)
|
||||
o(callback.args[0]).equals(vnode)
|
||||
|
|
@ -57,10 +57,10 @@ o.spec("oninit", function() {
|
|||
var createA = o.spy()
|
||||
var vnode = {tag: "div", key: 1, attrs: {oninit: createDiv}, state: {}}
|
||||
var updated = {tag: "a", key: 1, attrs: {oninit: createA}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(createDiv.callCount).equals(1)
|
||||
o(createDiv.this).equals(vnode.state)
|
||||
o(createDiv.args[0]).equals(vnode)
|
||||
|
|
@ -73,10 +73,10 @@ o.spec("oninit", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {oninit: create}, state: {}}
|
||||
var updated = {tag: "div", attrs: {oninit: update}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
o(create.args[0]).equals(vnode)
|
||||
|
|
@ -87,10 +87,10 @@ o.spec("oninit", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {oninit: create}, state: {}}
|
||||
var updated = {tag: "div", attrs: {oninit: update, id: "a"}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
o(create.args[0]).equals(vnode)
|
||||
|
|
@ -101,10 +101,10 @@ o.spec("oninit", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {oninit: create}, children: [{tag: "a"}], state: {}}
|
||||
var updated = {tag: "div", attrs: {oninit: update}, children: [{tag: "b"}], state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
o(create.args[0]).equals(vnode)
|
||||
|
|
@ -117,10 +117,10 @@ o.spec("oninit", function() {
|
|||
var otherVnode = {tag: "a", key: 2}
|
||||
var updated = {tag: "div", key: 1, attrs: {oninit: update}, state: {}}
|
||||
var otherUpdated = {tag: "a", key: 2}
|
||||
|
||||
|
||||
render(root, [vnode, otherVnode])
|
||||
render(root, [otherUpdated, updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
o(create.args[0]).equals(vnode)
|
||||
|
|
@ -130,10 +130,10 @@ o.spec("oninit", function() {
|
|||
var create = o.spy()
|
||||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {oninit: create}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
|
||||
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
o(create.args[0]).equals(vnode)
|
||||
|
|
@ -143,11 +143,11 @@ o.spec("oninit", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", key: 1, attrs: {oninit: create}, state: {}}
|
||||
var updated = {tag: "div", key: 1, attrs: {oninit: update}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(vnode.dom).equals(updated.dom)
|
||||
o(create.callCount).equals(1)
|
||||
o(create.this).equals(vnode.state)
|
||||
|
|
@ -162,10 +162,10 @@ o.spec("oninit", function() {
|
|||
var callback = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onupdate: create}, children: [], state: {}}
|
||||
var updated = {tag: "div", attrs: {onupdate: update}, children: [{tag: "a", attrs: {oninit: callback}, state: {}}], state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(1)
|
||||
o(update.this).equals(vnode.state)
|
||||
|
|
@ -181,12 +181,12 @@ o.spec("oninit", function() {
|
|||
{tag: "b"}
|
||||
]}
|
||||
]}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
function create(vnode) {
|
||||
called = true
|
||||
|
||||
|
||||
o(vnode.dom).equals(undefined)
|
||||
o(root.childNodes.length).equals(0)
|
||||
}
|
||||
|
|
@ -195,9 +195,9 @@ o.spec("oninit", function() {
|
|||
o("does not set oninit as an event handler", function() {
|
||||
var create = o.spy()
|
||||
var vnode = {tag: "div", attrs: {oninit: create}, children: []}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.oninit).equals(undefined)
|
||||
o(vnode.dom.attributes["oninit"]).equals(undefined)
|
||||
})
|
||||
|
|
@ -206,11 +206,11 @@ o.spec("oninit", function() {
|
|||
var vnodes = [{tag: "div", key: 1, attrs: {oninit: create}}]
|
||||
var temp = []
|
||||
var updated = [{tag: "div", key: 1, attrs: {oninit: create}}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(create.callCount).equals(2)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ o.spec("onremove", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onremove: create}}
|
||||
var updated = {tag: "div", attrs: {onremove: update}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
})
|
||||
o("does not call onremove when updating", function() {
|
||||
|
|
@ -28,20 +28,20 @@ o.spec("onremove", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onremove: create}}
|
||||
var updated = {tag: "div", attrs: {onremove: update}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(0)
|
||||
})
|
||||
o("calls onremove when removing element", function() {
|
||||
var remove = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onremove: remove}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
|
||||
|
||||
o(remove.callCount).equals(1)
|
||||
o(remove.this).equals(vnode.state)
|
||||
o(remove.args[0]).equals(vnode)
|
||||
|
|
@ -49,10 +49,10 @@ o.spec("onremove", function() {
|
|||
o("calls onremove when removing text", function() {
|
||||
var remove = o.spy()
|
||||
var vnode = {tag: "#", attrs: {onremove: remove}, children: "a", state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
|
||||
|
||||
o(remove.callCount).equals(1)
|
||||
o(remove.this).equals(vnode.state)
|
||||
o(remove.args[0]).equals(vnode)
|
||||
|
|
@ -60,10 +60,10 @@ o.spec("onremove", function() {
|
|||
o("calls onremove when removing fragment", function() {
|
||||
var remove = o.spy()
|
||||
var vnode = {tag: "[", attrs: {onremove: remove}, children: [], state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
|
||||
|
||||
o(remove.callCount).equals(1)
|
||||
o(remove.this).equals(vnode.state)
|
||||
o(remove.args[0]).equals(vnode)
|
||||
|
|
@ -71,10 +71,10 @@ o.spec("onremove", function() {
|
|||
o("calls onremove when removing html", function() {
|
||||
var remove = o.spy()
|
||||
var vnode = {tag: "<", attrs: {onremove: remove}, children: "a", state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
|
||||
|
||||
o(remove.callCount).equals(1)
|
||||
o(remove.this).equals(vnode.state)
|
||||
o(remove.args[0]).equals(vnode)
|
||||
|
|
@ -82,9 +82,9 @@ o.spec("onremove", function() {
|
|||
o("does not set onremove as an event handler", function() {
|
||||
var remove = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onremove: remove}, children: []}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.onremove).equals(undefined)
|
||||
o(vnode.dom.attributes["onremove"]).equals(undefined)
|
||||
})
|
||||
|
|
@ -93,22 +93,22 @@ o.spec("onremove", function() {
|
|||
var vnodes = [{tag: "div", key: 1}]
|
||||
var temp = [{tag: "div", key: 2, attrs: {onremove: remove}}]
|
||||
var updated = [{tag: "div", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(remove.callCount).equals(1)
|
||||
})
|
||||
o("does not recycle when there's an onremove", function() {
|
||||
var remove = o.spy()
|
||||
var vnode = {tag: "div", key: 1, attrs: {onremove: remove}}
|
||||
var updated = {tag: "div", key: 1, attrs: {onremove: remove}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(updated.dom)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ o.spec("onupdate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onupdate: create}, state: {}}
|
||||
var updated = {tag: "div", attrs: {onupdate: update}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(1)
|
||||
o(update.this).equals(vnode.state)
|
||||
|
|
@ -29,10 +29,10 @@ o.spec("onupdate", function() {
|
|||
o("does not call onupdate when removing element", function() {
|
||||
var create = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onupdate: create}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
})
|
||||
o("does not call onupdate when replacing keyed element", function() {
|
||||
|
|
@ -42,7 +42,7 @@ o.spec("onupdate", function() {
|
|||
var updated = {tag: "a", key: 1, attrs: {onupdate: update}}
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(0)
|
||||
})
|
||||
|
|
@ -50,11 +50,11 @@ o.spec("onupdate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", key: 1, attrs: {onupdate: update}}
|
||||
var updated = {tag: "div", key: 1, attrs: {onupdate: update}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(vnode.dom).notEquals(updated.dom)
|
||||
})
|
||||
o("does not call old onupdate when removing the onupdate property in new vnode", function() {
|
||||
|
|
@ -62,10 +62,10 @@ o.spec("onupdate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "a", attrs: {onupdate: create}}
|
||||
var updated = {tag: "a"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
})
|
||||
o("calls onupdate when noop", function() {
|
||||
|
|
@ -73,10 +73,10 @@ o.spec("onupdate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onupdate: create}, state: {}}
|
||||
var updated = {tag: "div", attrs: {onupdate: update}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(1)
|
||||
o(update.this).equals(vnode.state)
|
||||
|
|
@ -87,10 +87,10 @@ o.spec("onupdate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onupdate: create}, state: {}}
|
||||
var updated = {tag: "div", attrs: {onupdate: update, id: "a"}, state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(1)
|
||||
o(update.this).equals(vnode.state)
|
||||
|
|
@ -101,10 +101,10 @@ o.spec("onupdate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onupdate: create}, children: [{tag: "a"}], state: {}}
|
||||
var updated = {tag: "div", attrs: {onupdate: update}, children: [{tag: "b"}], state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(1)
|
||||
o(update.this).equals(vnode.state)
|
||||
|
|
@ -115,10 +115,10 @@ o.spec("onupdate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "#", attrs: {onupdate: create}, children: "a", state: {}}
|
||||
var updated = {tag: "#", attrs: {onupdate: update}, children: "a", state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(1)
|
||||
o(update.this).equals(vnode.state)
|
||||
|
|
@ -129,10 +129,10 @@ o.spec("onupdate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "[", attrs: {onupdate: create}, children: [], state: {}}
|
||||
var updated = {tag: "[", attrs: {onupdate: update}, children: [], state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(1)
|
||||
o(update.this).equals(vnode.state)
|
||||
|
|
@ -143,10 +143,10 @@ o.spec("onupdate", function() {
|
|||
var update = o.spy()
|
||||
var vnode = {tag: "<", attrs: {onupdate: create}, children: "a", state: {}}
|
||||
var updated = {tag: "<", attrs: {onupdate: update}, children: "a", state: {}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(create.callCount).equals(0)
|
||||
o(update.callCount).equals(1)
|
||||
o(update.this).equals(vnode.state)
|
||||
|
|
@ -164,13 +164,13 @@ o.spec("onupdate", function() {
|
|||
{tag: "b", attrs: {id: "33"}}
|
||||
]}
|
||||
]}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
function update(vnode) {
|
||||
called = true
|
||||
|
||||
|
||||
o(vnode.dom.parentNode.attributes["id"].nodeValue).equals("11")
|
||||
o(vnode.dom.attributes["id"].nodeValue).equals("22")
|
||||
o(vnode.dom.childNodes[0].attributes["id"].nodeValue).equals("33")
|
||||
|
|
@ -180,10 +180,10 @@ o.spec("onupdate", function() {
|
|||
o("does not set onupdate as an event handler", function() {
|
||||
var update = o.spy()
|
||||
var vnode = {tag: "div", attrs: {onupdate: update}, children: []}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
o(vnode.dom.onupdate).equals(undefined)
|
||||
o(vnode.dom.attributes["onupdate"]).equals(undefined)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -14,27 +14,27 @@ o.spec("textContent", function() {
|
|||
|
||||
o("ignores null", function() {
|
||||
var vnodes = [{tag: "a", text: null}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(0)
|
||||
o(vnodes[0].dom).equals(root.childNodes[0])
|
||||
})
|
||||
o("ignores undefined", function() {
|
||||
var vnodes = [{tag: "a", text: undefined}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(0)
|
||||
o(vnodes[0].dom).equals(root.childNodes[0])
|
||||
})
|
||||
o("creates string", function() {
|
||||
var vnodes = [{tag: "a", text: "a"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("a")
|
||||
|
|
@ -42,9 +42,9 @@ o.spec("textContent", function() {
|
|||
})
|
||||
o("creates falsy string", function() {
|
||||
var vnodes = [{tag: "a", text: ""}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("")
|
||||
|
|
@ -52,9 +52,9 @@ o.spec("textContent", function() {
|
|||
})
|
||||
o("creates number", function() {
|
||||
var vnodes = [{tag: "a", text: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("1")
|
||||
|
|
@ -62,9 +62,9 @@ o.spec("textContent", function() {
|
|||
})
|
||||
o("creates falsy number", function() {
|
||||
var vnodes = [{tag: "a", text: 0}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("0")
|
||||
|
|
@ -72,9 +72,9 @@ o.spec("textContent", function() {
|
|||
})
|
||||
o("creates boolean", function() {
|
||||
var vnodes = [{tag: "a", text: true}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("true")
|
||||
|
|
@ -82,9 +82,9 @@ o.spec("textContent", function() {
|
|||
})
|
||||
o("creates falsy boolean", function() {
|
||||
var vnodes = [{tag: "a", text: false}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("false")
|
||||
|
|
@ -93,10 +93,10 @@ o.spec("textContent", function() {
|
|||
o("updates to string", function() {
|
||||
var vnodes = [{tag: "a", text: "a"}]
|
||||
var updated = [{tag: "a", text: "b"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("b")
|
||||
|
|
@ -105,10 +105,10 @@ o.spec("textContent", function() {
|
|||
o("updates to falsy string", function() {
|
||||
var vnodes = [{tag: "a", text: "a"}]
|
||||
var updated = [{tag: "a", text: ""}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("")
|
||||
|
|
@ -117,10 +117,10 @@ o.spec("textContent", function() {
|
|||
o("updates to number", function() {
|
||||
var vnodes = [{tag: "a", text: "a"}]
|
||||
var updated = [{tag: "a", text: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("1")
|
||||
|
|
@ -129,10 +129,10 @@ o.spec("textContent", function() {
|
|||
o("updates to falsy number", function() {
|
||||
var vnodes = [{tag: "a", text: "a"}]
|
||||
var updated = [{tag: "a", text: 0}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("0")
|
||||
|
|
@ -141,10 +141,10 @@ o.spec("textContent", function() {
|
|||
o("updates to boolean", function() {
|
||||
var vnodes = [{tag: "a", text: "a"}]
|
||||
var updated = [{tag: "a", text: true}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("true")
|
||||
|
|
@ -153,10 +153,10 @@ o.spec("textContent", function() {
|
|||
o("updates to falsy boolean", function() {
|
||||
var vnodes = [{tag: "a", text: "a"}]
|
||||
var updated = [{tag: "a", text: false}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("false")
|
||||
|
|
@ -165,10 +165,10 @@ o.spec("textContent", function() {
|
|||
o("updates with typecasting", function() {
|
||||
var vnodes = [{tag: "a", text: "1"}]
|
||||
var updated = [{tag: "a", text: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("1")
|
||||
|
|
@ -177,10 +177,10 @@ o.spec("textContent", function() {
|
|||
o("updates from without text to with text", function() {
|
||||
var vnodes = [{tag: "a"}]
|
||||
var updated = [{tag: "a", text: "b"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes[0].nodeValue).equals("b")
|
||||
|
|
@ -189,12 +189,12 @@ o.spec("textContent", function() {
|
|||
o("updates from with text to without text", function() {
|
||||
var vnodes = [{tag: "a", text: "a"}]
|
||||
var updated = [{tag: "a"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(vnodes[0].dom.childNodes.length).equals(0)
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -6,14 +6,14 @@ var trust = require("../../render/trust")
|
|||
o.spec("trust", function() {
|
||||
o("works with html", function() {
|
||||
var vnode = trust("<a></a>")
|
||||
|
||||
|
||||
o(vnode.tag).equals("<")
|
||||
o(vnode.children).equals("<a></a>")
|
||||
})
|
||||
o("works with text", function() {
|
||||
var vnode = trust("abc")
|
||||
|
||||
|
||||
o(vnode.tag).equals("<")
|
||||
o(vnode.children).equals("abc")
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ o.spec("updateElement", function() {
|
|||
o("updates attr", function() {
|
||||
var vnode = {tag: "a", attrs: {id: "b"}}
|
||||
var updated = {tag: "a", attrs: {id: "c"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.attributes["id"].nodeValue).equals("c")
|
||||
|
|
@ -26,10 +26,10 @@ o.spec("updateElement", function() {
|
|||
o("adds attr", function() {
|
||||
var vnode = {tag: "a", attrs: {id: "b"}}
|
||||
var updated = {tag: "a", attrs: {id: "c", title: "d"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.attributes["title"].nodeValue).equals("d")
|
||||
|
|
@ -37,10 +37,10 @@ o.spec("updateElement", function() {
|
|||
o("adds attr from empty attrs", function() {
|
||||
var vnode = {tag: "a"}
|
||||
var updated = {tag: "a", attrs: {title: "d"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.attributes["title"].nodeValue).equals("d")
|
||||
|
|
@ -48,10 +48,10 @@ o.spec("updateElement", function() {
|
|||
o("removes attr", function() {
|
||||
var vnode = {tag: "a", attrs: {id: "b", title: "d"}}
|
||||
var updated = {tag: "a", attrs: {id: "c"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o("title" in updated.dom.attributes).equals(false)
|
||||
|
|
@ -59,145 +59,145 @@ o.spec("updateElement", function() {
|
|||
o("creates style object", function() {
|
||||
var vnode = {tag: "a", attrs: {}}
|
||||
var updated = {tag: "a", attrs: {style: {backgroundColor: "green"}}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("green")
|
||||
})
|
||||
o("creates style string", function() {
|
||||
var vnode = {tag: "a", attrs: {}}
|
||||
var updated = {tag: "a", attrs: {style: "background-color:green"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("green")
|
||||
})
|
||||
o("updates style from object to object", function() {
|
||||
var vnode = {tag: "a", attrs: {style: {backgroundColor: "red"}}}
|
||||
var updated = {tag: "a", attrs: {style: {backgroundColor: "green"}}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("green")
|
||||
})
|
||||
o("updates style from object to string", function() {
|
||||
var vnode = {tag: "a", attrs: {style: {backgroundColor: "red"}}}
|
||||
var updated = {tag: "a", attrs: {style: "background-color:green;"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("green")
|
||||
})
|
||||
o("handles noop style change when style is string", function() {
|
||||
var vnode = {tag: "a", attrs: {style: "background-color:green;"}}
|
||||
var updated = {tag: "a", attrs: {style: "background-color:green;"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("green")
|
||||
})
|
||||
o("handles noop style change when style is object", function() {
|
||||
var vnode = {tag: "a", attrs: {style: {backgroundColor: "red"}}}
|
||||
var updated = {tag: "a", attrs: {style: {backgroundColor: "red"}}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("red")
|
||||
})
|
||||
o("updates style from string to object", function() {
|
||||
var vnode = {tag: "a", attrs: {style: "background-color:red;"}}
|
||||
var updated = {tag: "a", attrs: {style: {backgroundColor: "green"}}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("green")
|
||||
})
|
||||
o("updates style from string to string", function() {
|
||||
var vnode = {tag: "a", attrs: {style: "background-color:red;"}}
|
||||
var updated = {tag: "a", attrs: {style: "background-color:green;"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("green")
|
||||
})
|
||||
o("removes style from object to object", function() {
|
||||
var vnode = {tag: "a", attrs: {style: {backgroundColor: "red", border: "1px solid red"}}}
|
||||
var updated = {tag: "a", attrs: {style: {backgroundColor: "red"}}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("red")
|
||||
o(updated.dom.style.border).equals("")
|
||||
})
|
||||
o("removes style from string to object", function() {
|
||||
var vnode = {tag: "a", attrs: {style: "background-color:red;border:1px solid red"}}
|
||||
var updated = {tag: "a", attrs: {style: {backgroundColor: "red"}}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("red")
|
||||
o(updated.dom.style.border).notEquals("1px solid red")
|
||||
})
|
||||
o("removes style from object to string", function() {
|
||||
var vnode = {tag: "a", attrs: {style: {backgroundColor: "red", border: "1px solid red"}}}
|
||||
var updated = {tag: "a", attrs: {style: "background-color:red"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("red")
|
||||
o(updated.dom.style.border).equals("")
|
||||
})
|
||||
o("removes style from string to string", function() {
|
||||
var vnode = {tag: "a", attrs: {style: "background-color:red;border:1px solid red"}}
|
||||
var updated = {tag: "a", attrs: {style: "background-color:red"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("red")
|
||||
o(updated.dom.style.border).equals("")
|
||||
})
|
||||
o("updates style when it's same object but mutated", function() {
|
||||
var style = {backgroundColor: "red", color: "gold"}
|
||||
var vnode = {tag: "a", attrs: {style: style}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
|
||||
|
||||
delete style.backgroundColor
|
||||
var updated = {tag: "a", attrs: {style: style}}
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.style.backgroundColor).equals("")
|
||||
o(updated.dom.style.color).equals("gold")
|
||||
})
|
||||
o("replaces el", function() {
|
||||
var vnode = {tag: "a"}
|
||||
var updated = {tag: "b"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeName).equals("B")
|
||||
})
|
||||
o("updates svg class", function() {
|
||||
var vnode = {tag: "svg", attrs: {className: "a"}}
|
||||
var updated = {tag: "svg", attrs: {className: "b"}}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom.attributes["class"].nodeValue).equals("b")
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -15,20 +15,20 @@ o.spec("updateFragment", function() {
|
|||
o("updates fragment", function() {
|
||||
var vnode = {tag: "[", children: [{tag: "a"}]}
|
||||
var updated = {tag: "[", children: [{tag: "b"}]}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeName).equals("B")
|
||||
})
|
||||
o("adds els", function() {
|
||||
var vnode = {tag: "[", children: []}
|
||||
var updated = {tag: "[", children: [{tag: "a"}, {tag: "b"}]}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.domSize).equals(2)
|
||||
o(root.childNodes.length).equals(2)
|
||||
|
|
@ -38,10 +38,10 @@ o.spec("updateFragment", function() {
|
|||
o("removes els", function() {
|
||||
var vnode = {tag: "[", children: [{tag: "a"}, {tag: "b"}]}
|
||||
var updated = {tag: "[", children: []}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(null)
|
||||
o(updated.domSize).equals(0)
|
||||
o(root.childNodes.length).equals(0)
|
||||
|
|
@ -49,20 +49,20 @@ o.spec("updateFragment", function() {
|
|||
o("updates from childless fragment", function() {
|
||||
var vnode = {tag: "["}
|
||||
var updated = {tag: "[", children: [{tag: "a"}]}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeName).equals("A")
|
||||
})
|
||||
o("updates to childless fragment", function() {
|
||||
var vnode = {tag: "[", children: [{tag: "a"}]}
|
||||
var updated = {tag: "["}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(null)
|
||||
o(root.childNodes.length).equals(0)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -15,20 +15,20 @@ o.spec("updateHTML", function() {
|
|||
o("updates html", function() {
|
||||
var vnode = {tag: "<", children: "a"}
|
||||
var updated = {tag: "<", children: "b"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeValue).equals("b")
|
||||
})
|
||||
o("adds html", function() {
|
||||
var vnode = {tag: "<", children: ""}
|
||||
var updated = {tag: "<", children: "<a></a><b></b>"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.domSize).equals(2)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(root.childNodes.length).equals(2)
|
||||
|
|
@ -38,10 +38,10 @@ o.spec("updateHTML", function() {
|
|||
o("removes html", function() {
|
||||
var vnode = {tag: "<", children: "<a></a><b></b>"}
|
||||
var updated = {tag: "<", children: ""}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(null)
|
||||
o(updated.domSize).equals(0)
|
||||
o(root.childNodes.length).equals(0)
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ o.spec("updateNodes", function() {
|
|||
o("handles el noop", function() {
|
||||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var updated = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -28,10 +28,10 @@ o.spec("updateNodes", function() {
|
|||
o("handles el noop without key", function() {
|
||||
var vnodes = [{tag: "a"}, {tag: "b"}]
|
||||
var updated = [{tag: "a"}, {tag: "b"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -41,10 +41,10 @@ o.spec("updateNodes", function() {
|
|||
o("handles text noop", function() {
|
||||
var vnodes = [{tag: "#", children: "a"}]
|
||||
var updated = [{tag: "#", children: "a"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(updated[0].dom.nodeValue).equals("a")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -52,10 +52,10 @@ o.spec("updateNodes", function() {
|
|||
o("handles text noop w/ type casting", function() {
|
||||
var vnodes = [{tag: "#", children: 1}]
|
||||
var updated = [{tag: "#", children: "1"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(updated[0].dom.nodeValue).equals("1")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -63,10 +63,10 @@ o.spec("updateNodes", function() {
|
|||
o("handles falsy text noop w/ type casting", function() {
|
||||
var vnodes = [{tag: "#", children: 0}]
|
||||
var updated = [{tag: "#", children: "0"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(updated[0].dom.nodeValue).equals("0")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -74,10 +74,10 @@ o.spec("updateNodes", function() {
|
|||
o("handles html noop", function() {
|
||||
var vnodes = [{tag: "<", children: "a"}]
|
||||
var updated = [{tag: "<", children: "a"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(updated[0].dom.nodeValue).equals("a")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -85,10 +85,10 @@ o.spec("updateNodes", function() {
|
|||
o("handles fragment noop", function() {
|
||||
var vnodes = [{tag: "[", children: [{tag: "a"}]}]
|
||||
var updated = [{tag: "[", children: [{tag: "a"}]}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -96,10 +96,10 @@ o.spec("updateNodes", function() {
|
|||
o("handles fragment noop w/ text child", function() {
|
||||
var vnodes = [{tag: "[", children: [{tag: "#", children: "a"}]}]
|
||||
var updated = [{tag: "[", children: [{tag: "#", children: "a"}]}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(updated[0].dom.nodeValue).equals("a")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -107,10 +107,10 @@ o.spec("updateNodes", function() {
|
|||
o("reverses els w/ even count", function() {
|
||||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}, {tag: "i", key: 3}, {tag: "s", key: 4}]
|
||||
var updated = [{tag: "s", key: 4}, {tag: "i", key: 3}, {tag: "b", key: 2}, {tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(4)
|
||||
o(updated[0].dom.nodeName).equals("S")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -124,10 +124,10 @@ o.spec("updateNodes", function() {
|
|||
o("reverses els w/ odd count", function() {
|
||||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}, {tag: "i", key: 3}]
|
||||
var updated = [{tag: "i", key: 3}, {tag: "b", key: 2}, {tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].dom.nodeName).equals("I")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -139,10 +139,10 @@ o.spec("updateNodes", function() {
|
|||
o("creates el at start", function() {
|
||||
var vnodes = [{tag: "a", key: 1}]
|
||||
var updated = [{tag: "b", key: 2}, {tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("B")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -152,10 +152,10 @@ o.spec("updateNodes", function() {
|
|||
o("creates el at end", function() {
|
||||
var vnodes = [{tag: "a", key: 1}]
|
||||
var updated = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -165,10 +165,10 @@ o.spec("updateNodes", function() {
|
|||
o("creates el in middle", function() {
|
||||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var updated = [{tag: "a", key: 1}, {tag: "i", key: 3}, {tag: "b", key: 2}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
o(updated[1].dom.nodeName).equals("I")
|
||||
|
|
@ -179,10 +179,10 @@ o.spec("updateNodes", function() {
|
|||
o("creates el while reversing", function() {
|
||||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var updated = [{tag: "b", key: 2}, {tag: "i", key: 3}, {tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].dom.nodeName).equals("B")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -194,10 +194,10 @@ o.spec("updateNodes", function() {
|
|||
o("deletes el at start", function() {
|
||||
var vnodes = [{tag: "b", key: 2}, {tag: "a", key: 1}]
|
||||
var updated = [{tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -205,10 +205,10 @@ o.spec("updateNodes", function() {
|
|||
o("deletes el at end", function() {
|
||||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var updated = [{tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -216,10 +216,10 @@ o.spec("updateNodes", function() {
|
|||
o("deletes el at middle", function() {
|
||||
var vnodes = [{tag: "a", key: 1}, {tag: "i", key: 3}, {tag: "b", key: 2}]
|
||||
var updated = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -229,10 +229,10 @@ o.spec("updateNodes", function() {
|
|||
o("deletes el while reversing", function() {
|
||||
var vnodes = [{tag: "a", key: 1}, {tag: "i", key: 3}, {tag: "b", key: 2}]
|
||||
var updated = [{tag: "b", key: 2}, {tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("B")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -242,10 +242,10 @@ o.spec("updateNodes", function() {
|
|||
o("creates, deletes, reverses els at same time", function() {
|
||||
var vnodes = [{tag: "a", key: 1}, {tag: "i", key: 3}, {tag: "b", key: 2}]
|
||||
var updated = [{tag: "b", key: 2}, {tag: "a", key: 1}, {tag: "s", key: 4}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].dom.nodeName).equals("B")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -257,10 +257,10 @@ o.spec("updateNodes", function() {
|
|||
o("adds to empty array followed by el", function() {
|
||||
var vnodes = [{tag: "[", key: 1, children: []}, {tag: "b", key: 2}]
|
||||
var updated = [{tag: "[", key: 1, children: [{tag: "a"}]}, {tag: "b", key: 2}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].children[0].dom.nodeName).equals("A")
|
||||
o(updated[0].children[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -270,10 +270,10 @@ o.spec("updateNodes", function() {
|
|||
o("reverses followed by el", function() {
|
||||
var vnodes = [{tag: "[", key: 1, children: [{tag: "a", key: 2}, {tag: "b", key: 3}]}, {tag: "i", key: 4}]
|
||||
var updated = [{tag: "[", key: 1, children: [{tag: "b", key: 3}, {tag: "a", key: 2}]}, {tag: "i", key: 4}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].children[0].dom.nodeName).equals("B")
|
||||
o(updated[0].children[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -285,10 +285,10 @@ o.spec("updateNodes", function() {
|
|||
o("updates empty array to html with same key", function() {
|
||||
var vnodes = [{tag: "[", key: 1, children: []}]
|
||||
var updated = [{tag: "<", key: 1, children: "<a></a><b></b>"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -299,10 +299,10 @@ o.spec("updateNodes", function() {
|
|||
o("updates empty html to array with same key", function() {
|
||||
var vnodes = [{tag: "<", key: 1, children: ""}]
|
||||
var updated = [{tag: "[", key: 1, children: [{tag: "a"}, {tag: "b"}]}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -313,10 +313,10 @@ o.spec("updateNodes", function() {
|
|||
o("updates empty array to html without key", function() {
|
||||
var vnodes = [{tag: "[", children: []}]
|
||||
var updated = [{tag: "<", children: "<a></a><b></b>"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -327,10 +327,10 @@ o.spec("updateNodes", function() {
|
|||
o("updates empty html to array without key", function() {
|
||||
var vnodes = [{tag: "<", children: ""}]
|
||||
var updated = [{tag: "[", children: [{tag: "a"}, {tag: "b"}]}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -341,10 +341,10 @@ o.spec("updateNodes", function() {
|
|||
o("updates array to html with same key", function() {
|
||||
var vnodes = [{tag: "[", key: 1, children: [{tag: "a"}, {tag: "b"}]}]
|
||||
var updated = [{tag: "<", key: 1, children: "<i></i><s></s>"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("I")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -355,10 +355,10 @@ o.spec("updateNodes", function() {
|
|||
o("updates html to array with same key", function() {
|
||||
var vnodes = [{tag: "<", key: 1, children: "<a></a><b></b>"}]
|
||||
var updated = [{tag: "[", key: 1, children: [{tag: "i"}, {tag: "s"}]}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("I")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -369,10 +369,10 @@ o.spec("updateNodes", function() {
|
|||
o("updates array to html without key", function() {
|
||||
var vnodes = [{tag: "[", children: [{tag: "a"}, {tag: "b"}]}]
|
||||
var updated = [{tag: "<", children: "<i></i><s></s>"}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("I")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -383,10 +383,10 @@ o.spec("updateNodes", function() {
|
|||
o("updates html to array without key", function() {
|
||||
var vnodes = [{tag: "<", children: "<a></a><b></b>"}]
|
||||
var updated = [{tag: "[", children: [{tag: "i"}, {tag: "s"}]}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("I")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -397,10 +397,10 @@ o.spec("updateNodes", function() {
|
|||
o("updates empty array to html with same key followed by el", function() {
|
||||
var vnodes = [{tag: "[", key: 1, children: []}, {tag: "i", key: 2}]
|
||||
var updated = [{tag: "<", key: 1, children: "<a></a><b></b>"}, {tag: "i", key: 2}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -413,10 +413,10 @@ o.spec("updateNodes", function() {
|
|||
o("updates empty html to array with same key followed by el", function() {
|
||||
var vnodes = [{tag: "[", key: 1, children: []}, {tag: "i", key: 2}]
|
||||
var updated = [{tag: "<", key: 1, children: "<a></a><b></b>"}, {tag: "i", key: 2}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -429,10 +429,10 @@ o.spec("updateNodes", function() {
|
|||
o("populates array followed by null then el", function() {
|
||||
var vnodes = [{tag: "[", key: 1, children: []}, null, {tag: "i", key: 2}]
|
||||
var updated = [{tag: "[", key: 1, children: [{tag: "a"}, {tag: "b"}]}, null, {tag: "i", key: 2}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -445,10 +445,10 @@ o.spec("updateNodes", function() {
|
|||
o("populates childless array followed by el", function() {
|
||||
var vnodes = [{tag: "[", key: 1}, {tag: "i", key: 2}]
|
||||
var updated = [{tag: "[", key: 1, children: [{tag: "a"}, {tag: "b"}]}, {tag: "i", key: 2}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -461,10 +461,10 @@ o.spec("updateNodes", function() {
|
|||
o("populates childless array followed by null then el", function() {
|
||||
var vnodes = [{tag: "[", key: 1}, null, {tag: "i", key: 2}]
|
||||
var updated = [{tag: "[", key: 1, children: [{tag: "a"}, {tag: "b"}]}, null, {tag: "i", key: 2}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -477,10 +477,10 @@ o.spec("updateNodes", function() {
|
|||
o("moves from end to start", function() {
|
||||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}, {tag: "i", key: 3}, {tag: "s", key: 4}]
|
||||
var updated = [{tag: "s", key: 4}, {tag: "a", key: 1}, {tag: "b", key: 2}, {tag: "i", key: 3}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(4)
|
||||
o(updated[0].dom.nodeName).equals("S")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -494,10 +494,10 @@ o.spec("updateNodes", function() {
|
|||
o("moves from start to end", function() {
|
||||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}, {tag: "i", key: 3}, {tag: "s", key: 4}]
|
||||
var updated = [{tag: "b", key: 2}, {tag: "i", key: 3}, {tag: "s", key: 4}, {tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(4)
|
||||
o(updated[0].dom.nodeName).equals("B")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -512,11 +512,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}, {tag: "i", key: 3}, {tag: "s", key: 4}]
|
||||
var temp = []
|
||||
var updated = [{tag: "a", key: 1}, {tag: "b", key: 2}, {tag: "i", key: 3}, {tag: "s", key: 4}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(4)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -531,11 +531,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}, {tag: "i", key: 3}, {tag: "s", key: 4}]
|
||||
var temp = []
|
||||
var updated = [{tag: "s", key: 4}, {tag: "i", key: 3}, {tag: "b", key: 2}, {tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(4)
|
||||
o(updated[0].dom.nodeName).equals("S")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -550,11 +550,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var temp = []
|
||||
var updated = [{tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -563,11 +563,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var temp = []
|
||||
var updated = [{tag: "a", key: 1}, {tag: "b", key: 2}, {tag: "i", key: 3}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -580,11 +580,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var temp = []
|
||||
var updated = [{tag: "i", key: 3}, {tag: "s", key: 4}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("I")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -595,11 +595,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var temp = []
|
||||
var updated = [{tag: "i", key: 3}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(1)
|
||||
o(updated[0].dom.nodeName).equals("I")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -608,11 +608,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var temp = []
|
||||
var updated = [{tag: "i", key: 3}, {tag: "s", key: 4}, {tag: "div", key: 5}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].dom.nodeName).equals("I")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -625,11 +625,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var temp = []
|
||||
var updated = [{tag: "a", key: 1}, {tag: "s", key: 4}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -640,11 +640,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var temp = []
|
||||
var updated = [{tag: "s", key: 4}, {tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("S")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -655,11 +655,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}, {tag: "i", key: 3}]
|
||||
var temp = []
|
||||
var updated = [{tag: "a", key: 1}, {tag: "s", key: 4}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -670,11 +670,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}, {tag: "i", key: 3}]
|
||||
var temp = []
|
||||
var updated = [{tag: "s", key: 4}, {tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("S")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -685,11 +685,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var temp = []
|
||||
var updated = [{tag: "a", key: 1}, {tag: "i", key: 3}, {tag: "s", key: 4}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -702,11 +702,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1}, {tag: "b", key: 2}]
|
||||
var temp = []
|
||||
var updated = [{tag: "s", key: 4}, {tag: "i", key: 3}, {tag: "a", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(3)
|
||||
o(updated[0].dom.nodeName).equals("S")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -720,12 +720,12 @@ o.spec("updateNodes", function() {
|
|||
var temp1 = []
|
||||
var temp2 = [{tag: "a", key: 1, children: [{tag: "i", key: 3}, {tag: "s", key: 4}]}, {tag: "b", key: 2}]
|
||||
var updated = [{tag: "a", key: 1, children: [{tag: "s", key: 4}, {tag: "i", key: 3}]}, {tag: "b", key: 2}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp1)
|
||||
render(root, temp2)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(updated[0].dom.nodeName).equals("A")
|
||||
o(updated[0].dom).equals(root.childNodes[0])
|
||||
|
|
@ -739,11 +739,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "a", key: 1, children: [{tag: "a", key: 3, children: [{tag: "a", key: 5}]}, {tag: "a", key: 4, children: [{tag: "a", key: 5}]}]}, {tag: "a", key: 2}]
|
||||
var temp = []
|
||||
var updated = [{tag: "a", key: 1, children: [{tag: "a", key: 3, children: [{tag: "a", key: 5}]}, {tag: "a", key: 4, children: [{tag: "a", key: 5}]}]}, {tag: "a", key: 2}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(root.childNodes.length).equals(2)
|
||||
o(root.childNodes[0].childNodes.length).equals(2)
|
||||
o(root.childNodes[0].childNodes[0].childNodes.length).equals(1)
|
||||
|
|
@ -754,11 +754,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "div", key: 1}]
|
||||
var temp = []
|
||||
var updated = [{tag: "div", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(vnodes[0].dom).equals(updated[0].dom)
|
||||
o(updated[0].dom.nodeName).equals("DIV")
|
||||
})
|
||||
|
|
@ -766,11 +766,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "div", key: 1}]
|
||||
var temp = [{tag: "div"}]
|
||||
var updated = [{tag: "div", key: 1}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(vnodes[0].dom).equals(updated[0].dom)
|
||||
o(updated[0].dom.nodeName).equals("DIV")
|
||||
})
|
||||
|
|
@ -778,11 +778,11 @@ o.spec("updateNodes", function() {
|
|||
var vnodes = [{tag: "div", children: [{tag: "a", key: 1}]}]
|
||||
var temp = [{tag: "div"}]
|
||||
var updated = [{tag: "div", children: [{tag: "a", key: 1}]}]
|
||||
|
||||
|
||||
render(root, vnodes)
|
||||
render(root, temp)
|
||||
render(root, updated)
|
||||
|
||||
|
||||
o(vnodes[0].dom.firstChild).equals(updated[0].dom.firstChild)
|
||||
o(updated[0].dom.firstChild.nodeName).equals("A")
|
||||
})
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ o.spec("updateText", function() {
|
|||
o("updates to string", function() {
|
||||
var vnode = {tag: "#", children: "a"}
|
||||
var updated = {tag: "#", children: "b"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeValue).equals("b")
|
||||
|
|
@ -26,10 +26,10 @@ o.spec("updateText", function() {
|
|||
o("updates to falsy string", function() {
|
||||
var vnode = {tag: "#", children: "a"}
|
||||
var updated = {tag: "#", children: ""}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeValue).equals("")
|
||||
|
|
@ -37,10 +37,10 @@ o.spec("updateText", function() {
|
|||
o("updates from falsy string", function() {
|
||||
var vnode = {tag: "#", children: ""}
|
||||
var updated = {tag: "#", children: "b"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeValue).equals("b")
|
||||
|
|
@ -48,10 +48,10 @@ o.spec("updateText", function() {
|
|||
o("updates to number", function() {
|
||||
var vnode = {tag: "#", children: "a"}
|
||||
var updated = {tag: "#", children: 1}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeValue).equals("1")
|
||||
|
|
@ -59,10 +59,10 @@ o.spec("updateText", function() {
|
|||
o("updates to falsy number", function() {
|
||||
var vnode = {tag: "#", children: "a"}
|
||||
var updated = {tag: "#", children: 0}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeValue).equals("0")
|
||||
|
|
@ -70,10 +70,10 @@ o.spec("updateText", function() {
|
|||
o("updates from falsy number", function() {
|
||||
var vnode = {tag: "#", children: 0}
|
||||
var updated = {tag: "#", children: "b"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeValue).equals("b")
|
||||
|
|
@ -81,10 +81,10 @@ o.spec("updateText", function() {
|
|||
o("updates to boolean", function() {
|
||||
var vnode = {tag: "#", children: "a"}
|
||||
var updated = {tag: "#", children: true}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeValue).equals("true")
|
||||
|
|
@ -92,10 +92,10 @@ o.spec("updateText", function() {
|
|||
o("updates to falsy boolean", function() {
|
||||
var vnode = {tag: "#", children: "a"}
|
||||
var updated = {tag: "#", children: false}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeValue).equals("false")
|
||||
|
|
@ -103,10 +103,10 @@ o.spec("updateText", function() {
|
|||
o("updates from falsy boolean", function() {
|
||||
var vnode = {tag: "#", children: false}
|
||||
var updated = {tag: "#", children: "b"}
|
||||
|
||||
|
||||
render(root, [vnode])
|
||||
render(root, [updated])
|
||||
|
||||
|
||||
o(updated.dom).equals(vnode.dom)
|
||||
o(updated.dom).equals(root.firstChild)
|
||||
o(updated.dom.nodeValue).equals("b")
|
||||
|
|
|
|||
|
|
@ -4,4 +4,4 @@ var Node = require("../render/node")
|
|||
|
||||
module.exports = function(html) {
|
||||
return Node("<", undefined, undefined, html, undefined, undefined)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ module.exports = function($window) {
|
|||
|
||||
function interpolate(url, data) {
|
||||
if (data == null) return url
|
||||
|
||||
|
||||
var tokens = url.match(/:[^\/]+/gi) || []
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
var key = tokens[i].slice(1)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
<script src="../../request/request.js"></script>
|
||||
<script src="test-xhr.js"></script>
|
||||
<script src="test-jsonp.js"></script>
|
||||
|
||||
|
||||
<script>require("../../ospec/ospec").run()</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ o.spec("jsonp", function() {
|
|||
mock = xhrMock()
|
||||
jsonp = new Request(mock).jsonp
|
||||
})
|
||||
|
||||
|
||||
o("works", function(done) {
|
||||
mock.$defineRoutes({
|
||||
"GET /item": function(request) {
|
||||
|
|
@ -52,4 +52,4 @@ o.spec("jsonp", function() {
|
|||
done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ o.spec("xhr", function() {
|
|||
mock = xhrMock()
|
||||
xhr = new Request(mock).xhr
|
||||
})
|
||||
|
||||
|
||||
o.spec("success", function() {
|
||||
o("works via GET", function(done) {
|
||||
var s = new Date
|
||||
|
|
@ -119,7 +119,7 @@ o.spec("xhr", function() {
|
|||
var Entity = function(args) {
|
||||
return {_id: args.id}
|
||||
}
|
||||
|
||||
|
||||
mock.$defineRoutes({
|
||||
"GET /item": function(request) {
|
||||
return {status: 200, responseText: JSON.stringify([{id: 1}, {id: 2}, {id: 3}])}
|
||||
|
|
@ -133,7 +133,7 @@ o.spec("xhr", function() {
|
|||
var Entity = function(args) {
|
||||
return {_id: args.id}
|
||||
}
|
||||
|
||||
|
||||
mock.$defineRoutes({
|
||||
"GET /item": function(request) {
|
||||
return {status: 200, responseText: JSON.stringify({id: 1})}
|
||||
|
|
@ -147,7 +147,7 @@ o.spec("xhr", function() {
|
|||
var serialize = function(data) {
|
||||
return "id=" + data.id
|
||||
}
|
||||
|
||||
|
||||
mock.$defineRoutes({
|
||||
"GET /item": function(request) {
|
||||
return {status: 200, responseText: JSON.stringify({body: request.query})}
|
||||
|
|
@ -161,7 +161,7 @@ o.spec("xhr", function() {
|
|||
var serialize = function(data) {
|
||||
return "id=" + data.id
|
||||
}
|
||||
|
||||
|
||||
mock.$defineRoutes({
|
||||
"POST /item": function(request) {
|
||||
return {status: 200, responseText: JSON.stringify({body: request.body})}
|
||||
|
|
@ -175,7 +175,7 @@ o.spec("xhr", function() {
|
|||
var deserialize = function(data) {
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
mock.$defineRoutes({
|
||||
"GET /item": function(request) {
|
||||
return {status: 200, responseText: JSON.stringify({test: 123})}
|
||||
|
|
@ -189,7 +189,7 @@ o.spec("xhr", function() {
|
|||
var deserialize = function(data) {
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
mock.$defineRoutes({
|
||||
"POST /item": function(request) {
|
||||
return {status: 200, responseText: JSON.stringify({test: 123})}
|
||||
|
|
@ -203,7 +203,7 @@ o.spec("xhr", function() {
|
|||
var extract = function(data) {
|
||||
return JSON.stringify({test: 123})
|
||||
}
|
||||
|
||||
|
||||
mock.$defineRoutes({
|
||||
"GET /item": function(request) {
|
||||
return {status: 200, responseText: ""}
|
||||
|
|
@ -217,7 +217,7 @@ o.spec("xhr", function() {
|
|||
var extract = function(data) {
|
||||
return JSON.stringify({test: 123})
|
||||
}
|
||||
|
||||
|
||||
mock.$defineRoutes({
|
||||
"POST /item": function(request) {
|
||||
return {status: 200, responseText: ""}
|
||||
|
|
@ -264,4 +264,4 @@ o.spec("xhr", function() {
|
|||
}).map(done)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -5,16 +5,16 @@ var parseQueryString = require("../querystring/parse")
|
|||
|
||||
module.exports = function($window) {
|
||||
var supportsPushState = typeof $window.history.pushState === "function" && $window.location.protocol !== "file:"
|
||||
|
||||
|
||||
var prefix = "#!"
|
||||
function setPrefix(value) {prefix = value}
|
||||
|
||||
|
||||
function normalize(fragment) {
|
||||
var data = $window.location[fragment].replace(/(?:%[a-f89][a-f0-9])+/gim, decodeURIComponent)
|
||||
if (fragment === "pathname" && data[0] !== "/") data = "/" + data
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
function parsePath(path, queryData, hashData) {
|
||||
var queryIndex = path.indexOf("?")
|
||||
var hashIndex = path.indexOf("#")
|
||||
|
|
@ -50,13 +50,13 @@ module.exports = function($window) {
|
|||
return data[token]
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
var query = buildQueryString(queryData)
|
||||
if (query) path += "?" + query
|
||||
|
||||
|
||||
var hash = buildQueryString(hashData)
|
||||
if (hash) path += "#" + hash
|
||||
|
||||
|
||||
if (supportsPushState) {
|
||||
if (options && options.replace) $window.history.replaceState(null, null, prefix + path)
|
||||
else $window.history.pushState(null, null, prefix + path)
|
||||
|
|
@ -64,20 +64,20 @@ module.exports = function($window) {
|
|||
}
|
||||
else $window.location.href = prefix + path
|
||||
}
|
||||
|
||||
|
||||
function defineRoutes(routes, resolve, reject) {
|
||||
if (supportsPushState) $window.onpopstate = resolveRoute
|
||||
else if (prefix.charAt(0) === "#") $window.onhashchange = resolveRoute
|
||||
resolveRoute()
|
||||
|
||||
|
||||
function resolveRoute() {
|
||||
var path = getPath()
|
||||
var params = {}
|
||||
var pathname = parsePath(path, params, params)
|
||||
|
||||
|
||||
for (var route in routes) {
|
||||
var matcher = new RegExp("^" + route.replace(/:[^\/]+?\.{3}/g, "(.*?)").replace(/:[^\/]+/g, "([^\\/]+)") + "\/?$")
|
||||
|
||||
|
||||
if (matcher.test(pathname)) {
|
||||
pathname.replace(matcher, function() {
|
||||
var keys = route.match(/:[^\/]+/g) || []
|
||||
|
|
@ -90,12 +90,12 @@ module.exports = function($window) {
|
|||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
reject(path, params)
|
||||
}
|
||||
return resolveRoute
|
||||
}
|
||||
|
||||
|
||||
function link(vnode) {
|
||||
vnode.dom.setAttribute("href", prefix + vnode.attrs.href)
|
||||
vnode.dom.onclick = function(e) {
|
||||
|
|
@ -103,6 +103,6 @@ module.exports = function($window) {
|
|||
setPath(vnode.attrs.href, undefined, undefined)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return {setPrefix: setPrefix, getPath: getPath, setPath: setPath, defineRoutes: defineRoutes, link: link}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
<script src="test-defineRoutes.js"></script>
|
||||
<script src="test-getPath.js"></script>
|
||||
<script src="test-setPath.js"></script>
|
||||
|
||||
|
||||
<script>require("../../ospec/ospec").run()</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ o.spec("Router.defineRoutes", function() {
|
|||
void ["#", "?", "", "#!", "?!", "/foo"].forEach(function(prefix) {
|
||||
o.spec("using prefix `" + prefix + "`", function() {
|
||||
var $window, router, onRouteChange, onFail
|
||||
|
||||
|
||||
o.beforeEach(function() {
|
||||
$window = pushStateMock()
|
||||
router = new Router($window)
|
||||
|
|
@ -16,195 +16,195 @@ o.spec("Router.defineRoutes", function() {
|
|||
onRouteChange = o.spy()
|
||||
onFail = o.spy()
|
||||
})
|
||||
|
||||
|
||||
o("resolves to route", function() {
|
||||
$window.location.href = prefix + "/test"
|
||||
router.defineRoutes({"/test": {data: 1}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 1}, {}, "/test", "/test"])
|
||||
o(onFail.callCount).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("resolves to route w/ escaped unicode", function() {
|
||||
$window.location.href = prefix + "/%C3%B6?%C3%B6=%C3%B6#%C3%B6=%C3%B6"
|
||||
router.defineRoutes({"/ö": {data: 2}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 2}, {"ö": "ö"}, "/ö?ö=ö#ö=ö", "/ö"])
|
||||
o(onFail.callCount).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("resolves to route w/ unicode", function() {
|
||||
$window.location.href = prefix + "/ö?ö=ö#ö=ö"
|
||||
router.defineRoutes({"/ö": {data: 2}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 2}, {"ö": "ö"}, "/ö?ö=ö#ö=ö", "/ö"])
|
||||
o(onFail.callCount).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("resolves to route on fallback mode", function() {
|
||||
$window.location.href = "file://" + prefix + "/test"
|
||||
|
||||
|
||||
router = new Router($window)
|
||||
router.setPrefix(prefix)
|
||||
|
||||
|
||||
router.defineRoutes({"/test": {data: 1}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 1}, {}, "/test", "/test"])
|
||||
o(onFail.callCount).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("handles parameterized route", function() {
|
||||
$window.location.href = prefix + "/test/x"
|
||||
router.defineRoutes({"/test/:a": {data: 1}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 1}, {a: "x"}, "/test/x", "/test/:a"])
|
||||
o(onFail.callCount).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("handles multi-parameterized route", function() {
|
||||
$window.location.href = prefix + "/test/x/y"
|
||||
router.defineRoutes({"/test/:a/:b": {data: 1}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 1}, {a: "x", b: "y"}, "/test/x/y", "/test/:a/:b"])
|
||||
o(onFail.callCount).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("handles rest parameterized route", function() {
|
||||
$window.location.href = prefix + "/test/x/y"
|
||||
router.defineRoutes({"/test/:a...": {data: 1}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 1}, {a: "x/y"}, "/test/x/y", "/test/:a..."])
|
||||
o(onFail.callCount).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("handles route with search", function() {
|
||||
$window.location.href = prefix + "/test?a=b&c=d"
|
||||
router.defineRoutes({"/test": {data: 1}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 1}, {a: "b", c: "d"}, "/test?a=b&c=d", "/test"])
|
||||
o(onFail.callCount).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("handles route with hash", function() {
|
||||
$window.location.href = prefix + "/test#a=b&c=d"
|
||||
router.defineRoutes({"/test": {data: 1}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 1}, {a: "b", c: "d"}, "/test#a=b&c=d", "/test"])
|
||||
o(onFail.callCount).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("handles route with search and hash", function() {
|
||||
$window.location.href = prefix + "/test?a=b#c=d"
|
||||
router.defineRoutes({"/test": {data: 1}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 1}, {a: "b", c: "d"}, "/test?a=b#c=d", "/test"])
|
||||
o(onFail.callCount).equals(0)
|
||||
})
|
||||
|
||||
|
||||
o("calls reject", function() {
|
||||
$window.location.href = prefix + "/test"
|
||||
router.defineRoutes({"/other": {data: 1}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onFail.callCount).equals(1)
|
||||
o(onFail.args).deepEquals(["/test", {}])
|
||||
})
|
||||
|
||||
|
||||
o("calls reject w/ search and hash", function() {
|
||||
$window.location.href = prefix + "/test?a=b#c=d"
|
||||
router.defineRoutes({"/other": {data: 1}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onFail.callCount).equals(1)
|
||||
o(onFail.args).deepEquals(["/test?a=b#c=d", {a: "b", c: "d"}])
|
||||
})
|
||||
|
||||
|
||||
o("handles out of order routes", function() {
|
||||
$window.location.href = prefix + "/z/y/x"
|
||||
router.defineRoutes({"/z/y/x": {data: 1}, "/:a...": {data: 2}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 1}, {}, "/z/y/x", "/z/y/x"])
|
||||
})
|
||||
|
||||
|
||||
o("handles reverse out of order routes", function() {
|
||||
$window.location.href = prefix + "/z/y/x"
|
||||
router.defineRoutes({"/:a...": {data: 2}, "/z/y/x": {data: 1}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 2}, {a: "z/y/x"}, "/z/y/x", "/:a..."])
|
||||
})
|
||||
|
||||
|
||||
o("handles dynamically added out of order routes", function() {
|
||||
var routes = {}
|
||||
routes["/z/y/x"] = {data: 1}
|
||||
routes["/:a..."] = {data: 2}
|
||||
|
||||
|
||||
$window.location.href = prefix + "/z/y/x"
|
||||
router.defineRoutes(routes, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 1}, {}, "/z/y/x", "/z/y/x"])
|
||||
})
|
||||
|
||||
|
||||
o("handles reversed dynamically added out of order routes", function() {
|
||||
var routes = {}
|
||||
routes["/:a..."] = {data: 2}
|
||||
routes["/z/y/x"] = {data: 1}
|
||||
|
||||
|
||||
$window.location.href = prefix + "/z/y/x"
|
||||
router.defineRoutes(routes, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 2}, {a: "z/y/x"}, "/z/y/x", "/:a..."])
|
||||
})
|
||||
|
||||
|
||||
o("handles mixed out of order routes", function() {
|
||||
var routes = {"/z/y/x": {data: 1}}
|
||||
routes["/:a..."] = {data: 2}
|
||||
|
||||
|
||||
$window.location.href = prefix + "/z/y/x"
|
||||
router.defineRoutes(routes, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 1}, {}, "/z/y/x", "/z/y/x"])
|
||||
})
|
||||
|
||||
|
||||
o("handles reverse mixed out of order routes", function() {
|
||||
var routes = {"/:a...": {data: 2}}
|
||||
routes["/z/y/x"] = {data: 12}
|
||||
|
||||
|
||||
$window.location.href = prefix + "/z/y/x"
|
||||
router.defineRoutes(routes, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
o(onRouteChange.args).deepEquals([{data: 2}, {a: "z/y/x"}, "/z/y/x", "/:a..."])
|
||||
})
|
||||
|
||||
|
||||
o("handles non-ascii routes", function() {
|
||||
$window.location.href = prefix + "/ö"
|
||||
router.defineRoutes({"/ö": "aaa"}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(1)
|
||||
})
|
||||
|
||||
|
||||
o("replays", function() {
|
||||
$window.location.href = prefix + "/test"
|
||||
var replay = router.defineRoutes({"/test": {data: 1}}, onRouteChange, onFail)
|
||||
replay()
|
||||
|
||||
|
||||
o(onRouteChange.callCount).equals(2)
|
||||
o(onRouteChange.args).deepEquals([{data: 1}, {}, "/test", "/test"])
|
||||
o(onFail.callCount).equals(0)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ o.spec("Router.getPath", function() {
|
|||
void ["#", "?", "", "#!", "?!", '/foo'].forEach(function(prefix) {
|
||||
o.spec("using prefix `" + prefix + "`", function() {
|
||||
var $window, router, onRouteChange, onFail
|
||||
|
||||
|
||||
o.beforeEach(function() {
|
||||
$window = pushStateMock()
|
||||
router = new Router($window)
|
||||
|
|
@ -16,31 +16,31 @@ o.spec("Router.getPath", function() {
|
|||
onRouteChange = o.spy()
|
||||
onFail = o.spy()
|
||||
})
|
||||
|
||||
|
||||
o("gets route", function() {
|
||||
$window.location.href = prefix + "/test"
|
||||
router.defineRoutes({"/test": {data: 1}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(router.getPath()).equals("/test")
|
||||
})
|
||||
o("gets route w/ params", function() {
|
||||
$window.location.href = prefix + "/other/x/y/z?c=d#e=f"
|
||||
router.defineRoutes({"/test": {data: 1}, "/other/:a/:b...": {data: 2}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(router.getPath()).equals("/other/x/y/z?c=d#e=f")
|
||||
})
|
||||
o("gets route w/ escaped unicode", function() {
|
||||
$window.location.href = prefix + "/%C3%B6?%C3%B6=%C3%B6#%C3%B6=%C3%B6"
|
||||
router.defineRoutes({"/test": {data: 1}, "/ö/:a/:b...": {data: 2}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(router.getPath()).equals("/ö?ö=ö#ö=ö")
|
||||
})
|
||||
o("gets route w/ unicode", function() {
|
||||
$window.location.href = prefix + "/ö?ö=ö#ö=ö"
|
||||
router.defineRoutes({"/test": {data: 1}, "/ö/:a/:b...": {data: 2}}, onRouteChange, onFail)
|
||||
|
||||
|
||||
o(router.getPath()).equals("/ö?ö=ö#ö=ö")
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ o.spec("Router.setPath", function() {
|
|||
void ["#", "?", "", "#!", "?!", "/foo"].forEach(function(prefix) {
|
||||
o.spec("using prefix `" + prefix + "`", function() {
|
||||
var $window, router, onRouteChange, onFail
|
||||
|
||||
|
||||
o.beforeEach(function() {
|
||||
$window = pushStateMock()
|
||||
router = new Router($window)
|
||||
|
|
@ -16,38 +16,38 @@ o.spec("Router.setPath", function() {
|
|||
onRouteChange = o.spy()
|
||||
onFail = o.spy()
|
||||
})
|
||||
|
||||
|
||||
o("sets route via API", function() {
|
||||
$window.location.href = prefix + "/test"
|
||||
router.defineRoutes({"/test": {data: 1}, "/other/:a/:b...": {data: 2}}, onRouteChange, onFail)
|
||||
router.setPath("/other/x/y/z?c=d#e=f")
|
||||
|
||||
|
||||
o(router.getPath()).equals("/other/x/y/z?c=d#e=f")
|
||||
})
|
||||
o("sets route w/ escaped unicode", function() {
|
||||
$window.location.href = prefix + "/test"
|
||||
router.defineRoutes({"/test": {data: 1}, "/ö/:a/:b...": {data: 2}}, onRouteChange, onFail)
|
||||
router.setPath("/%C3%B6?%C3%B6=%C3%B6#%C3%B6=%C3%B6")
|
||||
|
||||
|
||||
o(router.getPath()).equals("/ö?ö=ö#ö=ö")
|
||||
})
|
||||
o("sets route w/ unicode", function() {
|
||||
$window.location.href = prefix + "/test"
|
||||
router.defineRoutes({"/test": {data: 1}, "/ö/:a/:b...": {data: 2}}, onRouteChange, onFail)
|
||||
router.setPath("/ö?ö=ö#ö=ö")
|
||||
|
||||
|
||||
o(router.getPath()).equals("/ö?ö=ö#ö=ö")
|
||||
})
|
||||
|
||||
|
||||
o("sets route on fallback mode", function() {
|
||||
$window.location.href = "file://" + prefix + "/test"
|
||||
|
||||
|
||||
router = new Router($window)
|
||||
router.setPrefix(prefix)
|
||||
|
||||
|
||||
router.defineRoutes({"/test": {data: 1}, "/other/:a/:b...": {data: 2}}, onRouteChange, onFail)
|
||||
router.setPath("/other/x/y/z?c=d#e=f")
|
||||
|
||||
|
||||
o(router.getPath()).equals("/other/x/y/z?c=d#e=f")
|
||||
})
|
||||
o("sets route via pushState/onpopstate", function() {
|
||||
|
|
@ -55,14 +55,14 @@ o.spec("Router.setPath", function() {
|
|||
router.defineRoutes({"/test": {data: 1}, "/other/:a/:b...": {data: 2}}, onRouteChange, onFail)
|
||||
$window.history.pushState(null, null, prefix + "/other/x/y/z?c=d#e=f")
|
||||
$window.onpopstate()
|
||||
|
||||
|
||||
o(router.getPath()).equals("/other/x/y/z?c=d#e=f")
|
||||
})
|
||||
o("sets parameterized route", function() {
|
||||
$window.location.href = prefix + "/test"
|
||||
router.defineRoutes({"/test": {data: 1}, "/other/:a/:b...": {data: 2}}, onRouteChange, onFail)
|
||||
router.setPath("/other/:a/:b", {a: "x", b: "y/z", c: "d", e: "f"})
|
||||
|
||||
|
||||
o(router.getPath()).equals("/other/x/y/z?c=d&e=f")
|
||||
})
|
||||
o("replace:true works", function() {
|
||||
|
|
@ -70,7 +70,7 @@ o.spec("Router.setPath", function() {
|
|||
router.defineRoutes({"/test": {data: 1}, "/other": {data: 2}}, onRouteChange, onFail)
|
||||
router.setPath("/other", null, {replace: true})
|
||||
$window.history.back()
|
||||
|
||||
|
||||
o($window.location.href).equals("http://localhost/")
|
||||
})
|
||||
o("replace:false works", function() {
|
||||
|
|
@ -85,4 +85,4 @@ o.spec("Router.setPath", function() {
|
|||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -9,4 +9,4 @@ License: MIT
|
|||
|
||||
- pushStateMock - mock for `history.pushState` and `location`
|
||||
- ajaxMock - mock for XMLHttpRequest and JSONP transporters
|
||||
- parseURL - helper function for URL parsing
|
||||
- parseURL - helper function for URL parsing
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
"use strict"
|
||||
|
||||
module.exports = typeof setImmediate === "function" ? setImmediate : setTimeout
|
||||
module.exports = typeof setImmediate === "function" ? setImmediate : setTimeout
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ module.exports = function() {
|
|||
var ancestor = this
|
||||
while (ancestor !== child && ancestor !== null) ancestor = ancestor.parentNode
|
||||
if (ancestor === child) throw new Error("Node cannot be inserted at the specified point in the hierarchy")
|
||||
|
||||
|
||||
if (child.nodeType == null) throw new Error("Argument is not a DOM element")
|
||||
|
||||
|
||||
var index = this.childNodes.indexOf(child)
|
||||
if (index > -1) this.childNodes.splice(index, 1)
|
||||
if (child.nodeType === 11) {
|
||||
|
|
@ -35,9 +35,9 @@ module.exports = function() {
|
|||
var ancestor = this
|
||||
while (ancestor !== child && ancestor !== null) ancestor = ancestor.parentNode
|
||||
if (ancestor === child) throw new Error("Node cannot be inserted at the specified point in the hierarchy")
|
||||
|
||||
|
||||
if (child.nodeType == null) throw new Error("Argument is not a DOM element")
|
||||
|
||||
|
||||
var refIndex = this.childNodes.indexOf(reference)
|
||||
var index = this.childNodes.indexOf(child)
|
||||
if (reference !== null && refIndex < 0) throw new TypeError("Invalid argument")
|
||||
|
|
@ -109,7 +109,7 @@ module.exports = function() {
|
|||
},
|
||||
set innerHTML(value) {
|
||||
while (this.firstChild) this.removeChild(this.firstChild)
|
||||
|
||||
|
||||
var stack = [this], depth = 0, voidElements = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param", "source", "track", "wbr"]
|
||||
value.replace(/<([a-z0-9\-]+?)((?:\s+?[^=]+?=(?:"[^"]*?"|'[^']*?'|[^\s>]*))*?)(\s*\/)?>|<\/([a-z0-9\-]+?)>|([^<]+)/g, function(match, startTag, attrs, selfClosed, endTag, text) {
|
||||
if (startTag) {
|
||||
|
|
@ -173,7 +173,7 @@ module.exports = function() {
|
|||
if (this.nodeName === "INPUT" && this.attributes["type"] != null && this.attributes["type"].nodeValue === "checkbox" && e.type === "click") {
|
||||
this.checked = !this.checked
|
||||
}
|
||||
|
||||
|
||||
e.target = this
|
||||
if (events[e.type] != null) {
|
||||
for (var i = 0; i < events[e.type].length; i++) {
|
||||
|
|
@ -186,7 +186,7 @@ module.exports = function() {
|
|||
if (typeof this["on" + e.type] === "function" && !isModernEvent(e.type)) this["on" + e.type](e)
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
if (element.nodeName === "A") {
|
||||
var href
|
||||
Object.defineProperty(element, "href", {
|
||||
|
|
@ -195,7 +195,7 @@ module.exports = function() {
|
|||
enumerable: true,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
if (element.nodeName === "INPUT") {
|
||||
var checked
|
||||
Object.defineProperty(element, "checked", {
|
||||
|
|
@ -203,10 +203,10 @@ module.exports = function() {
|
|||
set: function(value) {checked = Boolean(value)},
|
||||
enumerable: true,
|
||||
})
|
||||
|
||||
|
||||
element.value = ""
|
||||
}
|
||||
|
||||
|
||||
if (element.nodeName === "TEXTAREA") {
|
||||
var value
|
||||
Object.defineProperty(element, "value", {
|
||||
|
|
@ -218,7 +218,7 @@ module.exports = function() {
|
|||
enumerable: true,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function getOptions(element) {
|
||||
var options = []
|
||||
for (var i = 0; i < element.childNodes.length; i++) {
|
||||
|
|
@ -340,6 +340,6 @@ module.exports = function() {
|
|||
$window.document.body = $window.document.createElement("body")
|
||||
$window.document.documentElement.appendChild($window.document.body)
|
||||
activeElement = $window.document.body
|
||||
|
||||
|
||||
return $window
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@ module.exports = function() {
|
|||
var pathname = "/"
|
||||
var search = ""
|
||||
var hash = ""
|
||||
|
||||
|
||||
var past = [], future = []
|
||||
|
||||
|
||||
function getURL() {
|
||||
if (protocol === "file:") return protocol + "//" + pathname + search + hash
|
||||
return protocol + "//" + hostname + prefix(":", port) + pathname + search + hash
|
||||
|
|
@ -75,7 +75,7 @@ module.exports = function() {
|
|||
get href() {
|
||||
return getURL()
|
||||
},
|
||||
|
||||
|
||||
set protocol(value) {
|
||||
throw new Error("Protocol is read-only")
|
||||
},
|
||||
|
|
@ -112,7 +112,7 @@ module.exports = function() {
|
|||
hash = prefix("#", value)
|
||||
if (oldHash != hash) hashchange()
|
||||
},
|
||||
|
||||
|
||||
set origin(value) {
|
||||
//origin is writable but ignored
|
||||
},
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<script src="test-pushStateMock.js"></script>
|
||||
<script src="test-xhrMock.js"></script>
|
||||
<script src="test-domMock.js"></script>
|
||||
|
||||
|
||||
<script>require("../../ospec/ospec").run()</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ o.spec("domMock", function() {
|
|||
o.beforeEach(function() {
|
||||
$document = domMock().document
|
||||
})
|
||||
|
||||
|
||||
o.spec("createElement", function() {
|
||||
o("works", function() {
|
||||
var node = $document.createElement("div")
|
||||
|
||||
|
||||
o(node.nodeType).equals(1)
|
||||
o(node.nodeName).equals("DIV")
|
||||
o(node.namespaceURI).equals("http://www.w3.org/1999/xhtml")
|
||||
|
|
@ -22,11 +22,11 @@ o.spec("domMock", function() {
|
|||
o(node.nextSibling).equals(null)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("createElementNS", function() {
|
||||
o("works", function() {
|
||||
var node = $document.createElementNS("http://www.w3.org/2000/svg", "svg")
|
||||
|
||||
|
||||
o(node.nodeType).equals(1)
|
||||
o(node.nodeName).equals("svg")
|
||||
o(node.namespaceURI).equals("http://www.w3.org/2000/svg")
|
||||
|
|
@ -36,11 +36,11 @@ o.spec("domMock", function() {
|
|||
o(node.nextSibling).equals(null)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("createTextNode", function() {
|
||||
o("works", function() {
|
||||
var node = $document.createTextNode("abc")
|
||||
|
||||
|
||||
o(node.nodeType).equals(3)
|
||||
o(node.nodeName).equals("#text")
|
||||
o(node.parentNode).equals(null)
|
||||
|
|
@ -48,41 +48,41 @@ o.spec("domMock", function() {
|
|||
})
|
||||
o("works w/ number", function() {
|
||||
var node = $document.createTextNode(123)
|
||||
|
||||
|
||||
o(node.nodeValue).equals("123")
|
||||
})
|
||||
o("works w/ null", function() {
|
||||
var node = $document.createTextNode(null)
|
||||
|
||||
|
||||
o(node.nodeValue).equals("null")
|
||||
})
|
||||
o("works w/ undefined", function() {
|
||||
var node = $document.createTextNode(undefined)
|
||||
|
||||
|
||||
o(node.nodeValue).equals("undefined")
|
||||
})
|
||||
o("works w/ object", function() {
|
||||
var node = $document.createTextNode({})
|
||||
|
||||
|
||||
o(node.nodeValue).equals("[object Object]")
|
||||
})
|
||||
o("does not unescape HTML", function() {
|
||||
var node = $document.createTextNode("<a>&</a>")
|
||||
|
||||
|
||||
o(node.nodeValue).equals("<a>&</a>")
|
||||
})
|
||||
o("nodeValue casts to string", function() {
|
||||
var node = $document.createTextNode("a")
|
||||
node.nodeValue = true
|
||||
|
||||
|
||||
o(node.nodeValue).equals("true")
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("createDocumentFragment", function() {
|
||||
o("works", function() {
|
||||
var node = $document.createDocumentFragment()
|
||||
|
||||
|
||||
o(node.nodeType).equals(11)
|
||||
o(node.nodeName).equals("#document-fragment")
|
||||
o(node.parentNode).equals(null)
|
||||
|
|
@ -90,13 +90,13 @@ o.spec("domMock", function() {
|
|||
o(node.firstChild).equals(null)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("appendChild", function() {
|
||||
o("works", function() {
|
||||
var parent = $document.createElement("div")
|
||||
var child = $document.createElement("a")
|
||||
parent.appendChild(child)
|
||||
|
||||
|
||||
o(parent.childNodes.length).equals(1)
|
||||
o(parent.childNodes[0]).equals(child)
|
||||
o(parent.firstChild).equals(child)
|
||||
|
|
@ -109,7 +109,7 @@ o.spec("domMock", function() {
|
|||
parent.appendChild(a)
|
||||
parent.appendChild(b)
|
||||
parent.appendChild(a)
|
||||
|
||||
|
||||
o(parent.childNodes.length).equals(2)
|
||||
o(parent.childNodes[0]).equals(b)
|
||||
o(parent.childNodes[1]).equals(a)
|
||||
|
|
@ -126,7 +126,7 @@ o.spec("domMock", function() {
|
|||
parent.appendChild(a)
|
||||
source.appendChild(b)
|
||||
parent.appendChild(b)
|
||||
|
||||
|
||||
o(source.childNodes.length).equals(0)
|
||||
})
|
||||
o("transfers from fragment", function() {
|
||||
|
|
@ -137,7 +137,7 @@ o.spec("domMock", function() {
|
|||
a.appendChild(b)
|
||||
a.appendChild(c)
|
||||
parent.appendChild(a)
|
||||
|
||||
|
||||
o(parent.childNodes.length).equals(2)
|
||||
o(parent.childNodes[0]).equals(b)
|
||||
o(parent.childNodes[1]).equals(c)
|
||||
|
|
@ -168,14 +168,14 @@ o.spec("domMock", function() {
|
|||
catch (e) {done()}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("removeChild", function() {
|
||||
o("works", function() {
|
||||
var parent = $document.createElement("div")
|
||||
var child = $document.createElement("a")
|
||||
parent.appendChild(child)
|
||||
parent.removeChild(child)
|
||||
|
||||
|
||||
o(parent.childNodes.length).equals(0)
|
||||
o(parent.firstChild).equals(null)
|
||||
o(child.parentNode).equals(null)
|
||||
|
|
@ -187,7 +187,7 @@ o.spec("domMock", function() {
|
|||
catch (e) {done()}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("insertBefore", function() {
|
||||
o("works", function() {
|
||||
var parent = $document.createElement("div")
|
||||
|
|
@ -195,7 +195,7 @@ o.spec("domMock", function() {
|
|||
var b = $document.createElement("b")
|
||||
parent.appendChild(a)
|
||||
parent.insertBefore(b, a)
|
||||
|
||||
|
||||
o(parent.childNodes.length).equals(2)
|
||||
o(parent.childNodes[0]).equals(b)
|
||||
o(parent.childNodes[1]).equals(a)
|
||||
|
|
@ -211,7 +211,7 @@ o.spec("domMock", function() {
|
|||
parent.appendChild(a)
|
||||
parent.appendChild(b)
|
||||
parent.insertBefore(b, a)
|
||||
|
||||
|
||||
o(parent.childNodes.length).equals(2)
|
||||
o(parent.childNodes[0]).equals(b)
|
||||
o(parent.childNodes[1]).equals(a)
|
||||
|
|
@ -228,7 +228,7 @@ o.spec("domMock", function() {
|
|||
parent.appendChild(a)
|
||||
source.appendChild(b)
|
||||
parent.insertBefore(b, a)
|
||||
|
||||
|
||||
o(source.childNodes.length).equals(0)
|
||||
})
|
||||
o("transfers from fragment", function() {
|
||||
|
|
@ -241,7 +241,7 @@ o.spec("domMock", function() {
|
|||
a.appendChild(b)
|
||||
a.appendChild(c)
|
||||
parent.insertBefore(a, ref)
|
||||
|
||||
|
||||
o(parent.childNodes.length).equals(3)
|
||||
o(parent.childNodes[0]).equals(b)
|
||||
o(parent.childNodes[1]).equals(c)
|
||||
|
|
@ -261,7 +261,7 @@ o.spec("domMock", function() {
|
|||
var b = $document.createElement("b")
|
||||
parent.appendChild(a)
|
||||
parent.insertBefore(b, null)
|
||||
|
||||
|
||||
o(parent.childNodes.length).equals(2)
|
||||
o(parent.childNodes[0]).equals(a)
|
||||
o(parent.childNodes[1]).equals(b)
|
||||
|
|
@ -312,81 +312,81 @@ o.spec("domMock", function() {
|
|||
catch (e) {done()}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("setAttribute", function() {
|
||||
o("works", function() {
|
||||
var div = $document.createElement("div")
|
||||
div.setAttribute("id", "aaa")
|
||||
|
||||
|
||||
o(div.attributes["id"].nodeValue).equals("aaa")
|
||||
o(div.attributes["id"].namespaceURI).equals(null)
|
||||
})
|
||||
o("works w/ number", function() {
|
||||
var div = $document.createElement("div")
|
||||
div.setAttribute("id", 123)
|
||||
|
||||
|
||||
o(div.attributes["id"].nodeValue).equals("123")
|
||||
})
|
||||
o("works w/ null", function() {
|
||||
var div = $document.createElement("div")
|
||||
div.setAttribute("id", null)
|
||||
|
||||
|
||||
o(div.attributes["id"].nodeValue).equals("null")
|
||||
})
|
||||
o("works w/ undefined", function() {
|
||||
var div = $document.createElement("div")
|
||||
div.setAttribute("id", undefined)
|
||||
|
||||
|
||||
o(div.attributes["id"].nodeValue).equals("undefined")
|
||||
})
|
||||
o("works w/ object", function() {
|
||||
var div = $document.createElement("div")
|
||||
div.setAttribute("id", {})
|
||||
|
||||
|
||||
o(div.attributes["id"].nodeValue).equals("[object Object]")
|
||||
})
|
||||
o("setting via attributes map stringifies", function() {
|
||||
var div = $document.createElement("div")
|
||||
div.setAttribute("id", "a")
|
||||
div.attributes["id"].nodeValue = 123
|
||||
|
||||
|
||||
o(div.attributes["id"].nodeValue).equals("123")
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("setAttributeNS", function() {
|
||||
o("works", function() {
|
||||
var div = $document.createElement("div")
|
||||
div.setAttributeNS("http://www.w3.org/1999/xlink", "href", "aaa")
|
||||
|
||||
|
||||
o(div.attributes["href"].nodeValue).equals("aaa")
|
||||
o(div.attributes["href"].namespaceURI).equals("http://www.w3.org/1999/xlink")
|
||||
})
|
||||
o("works w/ number", function() {
|
||||
var div = $document.createElement("div")
|
||||
div.setAttributeNS("http://www.w3.org/1999/xlink", "href", 123)
|
||||
|
||||
|
||||
o(div.attributes["href"].nodeValue).equals("123")
|
||||
o(div.attributes["href"].namespaceURI).equals("http://www.w3.org/1999/xlink")
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("removeAttribute", function() {
|
||||
o("works", function() {
|
||||
var div = $document.createElement("div")
|
||||
div.setAttribute("id", "aaa")
|
||||
div.removeAttribute("id")
|
||||
|
||||
|
||||
o("id" in div.attributes).equals(false)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("textContent", function() {
|
||||
o("works", function() {
|
||||
var div = $document.createElement("div")
|
||||
var a = $document.createElement("a")
|
||||
div.textContent = "aaa"
|
||||
|
||||
|
||||
o(div.childNodes.length).equals(1)
|
||||
o(div.firstChild.nodeType).equals(3)
|
||||
o(div.firstChild.nodeValue).equals("aaa")
|
||||
|
|
@ -395,11 +395,11 @@ o.spec("domMock", function() {
|
|||
var div = $document.createElement("div")
|
||||
var a = $document.createElement("a")
|
||||
div.textContent = ""
|
||||
|
||||
|
||||
o(div.childNodes.length).equals(0)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
o.spec("innerHTML", function() {
|
||||
o("works", function() {
|
||||
var div = $document.createElement("div")
|
||||
|
|
@ -446,7 +446,7 @@ o.spec("domMock", function() {
|
|||
var a = $document.createElement("a")
|
||||
div.appendChild(a)
|
||||
div.innerHTML = "<b></b>"
|
||||
|
||||
|
||||
o(a.parentNode).equals(null)
|
||||
})
|
||||
})
|
||||
|
|
@ -462,22 +462,22 @@ o.spec("domMock", function() {
|
|||
var input = $document.createElement("input")
|
||||
$document.body.appendChild(input)
|
||||
input.focus()
|
||||
|
||||
|
||||
o($document.activeElement).equals(input)
|
||||
|
||||
|
||||
$document.body.removeChild(input)
|
||||
})
|
||||
})
|
||||
o.spec("style", function() {
|
||||
o("has style property", function() {
|
||||
var div = $document.createElement("div")
|
||||
|
||||
|
||||
o(typeof div.style).equals("object")
|
||||
})
|
||||
o("setting style string works", function() {
|
||||
var div = $document.createElement("div")
|
||||
div.style = "background-color: red; border-bottom: 1px solid red;"
|
||||
|
||||
|
||||
o(div.style.backgroundColor).equals("red")
|
||||
o(div.style.borderBottom).equals("1px solid red")
|
||||
})
|
||||
|
|
@ -485,7 +485,7 @@ o.spec("domMock", function() {
|
|||
var div = $document.createElement("div")
|
||||
div.style = "background: red;"
|
||||
div.style = ""
|
||||
|
||||
|
||||
o(div.style.background).equals("")
|
||||
})
|
||||
})
|
||||
|
|
@ -497,17 +497,17 @@ o.spec("domMock", function() {
|
|||
div = $document.createElement("div")
|
||||
e = $document.createEvent("MouseEvents")
|
||||
e.initEvent("click", true, true)
|
||||
|
||||
|
||||
$document.body.appendChild(div)
|
||||
})
|
||||
o.afterEach(function() {
|
||||
$document.body.removeChild(div)
|
||||
})
|
||||
|
||||
|
||||
o("addEventListener works", function() {
|
||||
div.addEventListener("click", spy, false)
|
||||
div.dispatchEvent(e)
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
o(spy.this).equals(div)
|
||||
o(spy.args[0].type).equals("click")
|
||||
|
|
@ -517,14 +517,14 @@ o.spec("domMock", function() {
|
|||
div.addEventListener("click", spy, false)
|
||||
div.removeEventListener("click", spy, false)
|
||||
div.dispatchEvent(e)
|
||||
|
||||
|
||||
o(spy.callCount).equals(0)
|
||||
done()
|
||||
})
|
||||
o("click fires onclick", function() {
|
||||
div.onclick = spy
|
||||
div.dispatchEvent(e)
|
||||
|
||||
|
||||
o(spy.callCount).equals(1)
|
||||
o(spy.this).equals(div)
|
||||
o(spy.args[0].type).equals("click")
|
||||
|
|
@ -542,17 +542,17 @@ o.spec("domMock", function() {
|
|||
div = $document.createElement("div")
|
||||
e = $document.createEvent("HTMLEvents")
|
||||
e.initEvent("transitionend", true, true)
|
||||
|
||||
|
||||
$document.body.appendChild(div)
|
||||
})
|
||||
o.afterEach(function() {
|
||||
$document.body.removeChild(div)
|
||||
})
|
||||
|
||||
|
||||
o("ontransitionend does not fire", function(done) {
|
||||
div.ontransitionend = spy
|
||||
div.dispatchEvent(e)
|
||||
|
||||
|
||||
o(spy.callCount).equals(0)
|
||||
done()
|
||||
})
|
||||
|
|
@ -562,21 +562,21 @@ o.spec("domMock", function() {
|
|||
o.spec("a[href]", function() {
|
||||
o("is empty string if no attribute", function() {
|
||||
var a = $document.createElement("a")
|
||||
|
||||
|
||||
o(a.href).equals("")
|
||||
o(a.attributes["href"]).equals(undefined)
|
||||
})
|
||||
o("is path if attribute is set", function() {
|
||||
var a = $document.createElement("a")
|
||||
a.setAttribute("href", "")
|
||||
|
||||
|
||||
o(a.href).notEquals("")
|
||||
o(a.attributes["href"].nodeValue).equals("")
|
||||
})
|
||||
o("is path if property is set", function() {
|
||||
var a = $document.createElement("a")
|
||||
a.href = ""
|
||||
|
||||
|
||||
o(a.href).notEquals("")
|
||||
o(a.attributes["href"].nodeValue).equals("")
|
||||
})
|
||||
|
|
@ -585,24 +585,24 @@ o.spec("domMock", function() {
|
|||
o("only exists in input elements", function() {
|
||||
var input = $document.createElement("input")
|
||||
var a = $document.createElement("a")
|
||||
|
||||
|
||||
o("checked" in input).equals(true)
|
||||
o("checked" in a).equals(false)
|
||||
})
|
||||
o("tracks attribute value when unset", function() {
|
||||
var input = $document.createElement("input")
|
||||
input.setAttribute("type", "checkbox")
|
||||
|
||||
|
||||
o(input.checked).equals(false)
|
||||
o(input.attributes["checked"]).equals(undefined)
|
||||
|
||||
|
||||
input.setAttribute("checked", "")
|
||||
|
||||
|
||||
o(input.checked).equals(true)
|
||||
o(input.attributes["checked"].nodeValue).equals("")
|
||||
|
||||
|
||||
input.removeAttribute("checked")
|
||||
|
||||
|
||||
o(input.checked).equals(false)
|
||||
o(input.attributes["checked"]).equals(undefined)
|
||||
})
|
||||
|
|
@ -610,27 +610,27 @@ o.spec("domMock", function() {
|
|||
var input = $document.createElement("input")
|
||||
input.setAttribute("type", "checkbox")
|
||||
input.checked = true
|
||||
|
||||
|
||||
o(input.checked).equals(true)
|
||||
o(input.attributes["checked"]).equals(undefined)
|
||||
|
||||
|
||||
input.checked = false
|
||||
input.setAttribute("checked", "")
|
||||
|
||||
|
||||
input.checked = true
|
||||
input.removeAttribute("checked")
|
||||
|
||||
|
||||
o(input.checked).equals(true)
|
||||
})
|
||||
o("toggles on click", function() {
|
||||
var input = $document.createElement("input")
|
||||
input.setAttribute("type", "checkbox")
|
||||
input.checked = false
|
||||
|
||||
|
||||
var e = $document.createEvent("MouseEvents")
|
||||
e.initEvent("click", true, true)
|
||||
input.dispatchEvent(e)
|
||||
|
||||
|
||||
o(input.checked).equals(true)
|
||||
})
|
||||
})
|
||||
|
|
@ -638,7 +638,7 @@ o.spec("domMock", function() {
|
|||
o("only exists in input elements", function() {
|
||||
var input = $document.createElement("input")
|
||||
var a = $document.createElement("a")
|
||||
|
||||
|
||||
o("value" in input).equals(true)
|
||||
o("value" in a).equals(false)
|
||||
})
|
||||
|
|
@ -647,14 +647,14 @@ o.spec("domMock", function() {
|
|||
o("reads from child if no value", function() {
|
||||
var input = $document.createElement("textarea")
|
||||
input.appendChild($document.createTextNode("aaa"))
|
||||
|
||||
|
||||
o(input.value).equals("aaa")
|
||||
})
|
||||
o("ignores child if value set", function() {
|
||||
var input = $document.createElement("textarea")
|
||||
input.value = "aaa"
|
||||
input.setAttribute("value", "bbb")
|
||||
|
||||
|
||||
o(input.value).equals("aaa")
|
||||
})
|
||||
})
|
||||
|
|
@ -662,37 +662,37 @@ o.spec("domMock", function() {
|
|||
o("only exist in select elements", function() {
|
||||
var select = $document.createElement("select")
|
||||
var a = $document.createElement("a")
|
||||
|
||||
|
||||
o("value" in select).equals(true)
|
||||
o("value" in a).equals(false)
|
||||
|
||||
|
||||
o("selectedIndex" in select).equals(true)
|
||||
o("selectedIndex" in a).equals(false)
|
||||
})
|
||||
o("value defaults to value at first index", function() {
|
||||
var select = $document.createElement("select")
|
||||
|
||||
|
||||
var option1 = $document.createElement("option")
|
||||
option1.setAttribute("value", "a")
|
||||
select.appendChild(option1)
|
||||
|
||||
|
||||
var option2 = $document.createElement("option")
|
||||
option2.setAttribute("value", "b")
|
||||
select.appendChild(option2)
|
||||
|
||||
|
||||
o(select.value).equals("a")
|
||||
o(select.selectedIndex).equals(0)
|
||||
})
|
||||
o("value falls back to child nodeValue if no attribute", function() {
|
||||
var select = $document.createElement("select")
|
||||
|
||||
|
||||
var option1 = $document.createElement("option")
|
||||
option1.appendChild($document.createTextNode("a"))
|
||||
var option2 = $document.createElement("option")
|
||||
option2.appendChild($document.createTextNode("b"))
|
||||
select.appendChild(option1)
|
||||
select.appendChild(option2)
|
||||
|
||||
|
||||
o(select.value).equals("a")
|
||||
o(select.selectedIndex).equals(0)
|
||||
o(select.childNodes[0].selected).equals(true)
|
||||
|
|
@ -701,159 +701,159 @@ o.spec("domMock", function() {
|
|||
})
|
||||
o("value defaults to invalid if no options", function() {
|
||||
var select = $document.createElement("select")
|
||||
|
||||
|
||||
o(select.value).equals("")
|
||||
o(select.selectedIndex).equals(-1)
|
||||
})
|
||||
o("setting valid value works", function() {
|
||||
var select = $document.createElement("select")
|
||||
|
||||
|
||||
var option1 = $document.createElement("option")
|
||||
option1.setAttribute("value", "a")
|
||||
select.appendChild(option1)
|
||||
|
||||
|
||||
var option2 = $document.createElement("option")
|
||||
option2.setAttribute("value", "b")
|
||||
select.appendChild(option2)
|
||||
|
||||
|
||||
select.value = "b"
|
||||
|
||||
|
||||
o(select.value).equals("b")
|
||||
o(select.selectedIndex).equals(1)
|
||||
})
|
||||
o("setting valid value works with optgroup", function() {
|
||||
var select = $document.createElement("select")
|
||||
|
||||
|
||||
var option1 = $document.createElement("option")
|
||||
option1.setAttribute("value", "a")
|
||||
|
||||
|
||||
var option2 = $document.createElement("option")
|
||||
option2.setAttribute("value", "b")
|
||||
|
||||
|
||||
var option3 = $document.createElement("option")
|
||||
option3.setAttribute("value", "c")
|
||||
|
||||
|
||||
var optgroup = $document.createElement("optgroup")
|
||||
optgroup.appendChild(option1)
|
||||
optgroup.appendChild(option2)
|
||||
select.appendChild(optgroup)
|
||||
select.appendChild(option3)
|
||||
|
||||
|
||||
select.value = "b"
|
||||
|
||||
|
||||
o(select.value).equals("b")
|
||||
o(select.selectedIndex).equals(1)
|
||||
})
|
||||
o("setting valid selectedIndex works", function() {
|
||||
var select = $document.createElement("select")
|
||||
|
||||
|
||||
var option1 = $document.createElement("option")
|
||||
option1.setAttribute("value", "a")
|
||||
select.appendChild(option1)
|
||||
|
||||
|
||||
var option2 = $document.createElement("option")
|
||||
option2.setAttribute("value", "b")
|
||||
select.appendChild(option2)
|
||||
|
||||
|
||||
select.selectedIndex = 1
|
||||
|
||||
|
||||
o(select.value).equals("b")
|
||||
o(select.selectedIndex).equals(1)
|
||||
})
|
||||
o("setting option[selected] works", function() {
|
||||
var select = $document.createElement("select")
|
||||
|
||||
|
||||
var option1 = $document.createElement("option")
|
||||
option1.setAttribute("value", "a")
|
||||
select.appendChild(option1)
|
||||
|
||||
|
||||
var option2 = $document.createElement("option")
|
||||
option2.setAttribute("value", "b")
|
||||
select.appendChild(option2)
|
||||
|
||||
|
||||
select.childNodes[1].selected = true
|
||||
|
||||
|
||||
o(select.value).equals("b")
|
||||
o(select.selectedIndex).equals(1)
|
||||
})
|
||||
o("unsetting option[selected] works", function() {
|
||||
var select = $document.createElement("select")
|
||||
|
||||
|
||||
var option1 = $document.createElement("option")
|
||||
option1.setAttribute("value", "a")
|
||||
select.appendChild(option1)
|
||||
|
||||
|
||||
var option2 = $document.createElement("option")
|
||||
option2.setAttribute("value", "b")
|
||||
select.appendChild(option2)
|
||||
|
||||
|
||||
select.childNodes[1].selected = true
|
||||
select.childNodes[1].selected = false
|
||||
|
||||
|
||||
o(select.value).equals("a")
|
||||
o(select.selectedIndex).equals(0)
|
||||
})
|
||||
o("setting invalid value yields a selectedIndex of -1 and value of empty string", function() {
|
||||
var select = $document.createElement("select")
|
||||
|
||||
|
||||
var option1 = $document.createElement("option")
|
||||
option1.setAttribute("value", "a")
|
||||
select.appendChild(option1)
|
||||
|
||||
|
||||
var option2 = $document.createElement("option")
|
||||
option2.setAttribute("value", "b")
|
||||
select.appendChild(option2)
|
||||
|
||||
|
||||
select.value = "c"
|
||||
|
||||
|
||||
o(select.value).equals("")
|
||||
o(select.selectedIndex).equals(-1)
|
||||
})
|
||||
o("setting invalid selectedIndex yields a selectedIndex of -1 and value of empty string", function() {
|
||||
var select = $document.createElement("select")
|
||||
|
||||
|
||||
var option1 = $document.createElement("option")
|
||||
option1.setAttribute("value", "a")
|
||||
select.appendChild(option1)
|
||||
|
||||
|
||||
var option2 = $document.createElement("option")
|
||||
option2.setAttribute("value", "b")
|
||||
select.appendChild(option2)
|
||||
|
||||
|
||||
select.selectedIndex = -2
|
||||
|
||||
|
||||
o(select.value).equals("")
|
||||
o(select.selectedIndex).equals(-1)
|
||||
})
|
||||
o("setting invalid value yields a selectedIndex of -1 and value of empty string even when there's an option whose value is empty string", function() {
|
||||
var select = $document.createElement("select")
|
||||
|
||||
|
||||
var option1 = $document.createElement("option")
|
||||
option1.setAttribute("value", "a")
|
||||
select.appendChild(option1)
|
||||
|
||||
|
||||
var option2 = $document.createElement("option")
|
||||
option2.setAttribute("value", "")
|
||||
select.appendChild(option2)
|
||||
|
||||
|
||||
select.value = "c"
|
||||
|
||||
|
||||
o(select.value).equals("")
|
||||
o(select.selectedIndex).equals(-1)
|
||||
})
|
||||
o("setting invalid selectedIndex yields a selectedIndex of -1 and value of empty string even when there's an option whose value is empty string", function() {
|
||||
var select = $document.createElement("select")
|
||||
|
||||
|
||||
var option1 = $document.createElement("option")
|
||||
option1.setAttribute("value", "a")
|
||||
select.appendChild(option1)
|
||||
|
||||
|
||||
var option2 = $document.createElement("option")
|
||||
option2.setAttribute("value", "")
|
||||
select.appendChild(option2)
|
||||
|
||||
|
||||
select.selectedIndex = -2
|
||||
|
||||
|
||||
o(select.value).equals("")
|
||||
o(select.selectedIndex).equals(-1)
|
||||
})
|
||||
|
|
@ -863,7 +863,7 @@ o.spec("domMock", function() {
|
|||
o("works", function() {
|
||||
var el = $document.createElement("div")
|
||||
el.className = "a"
|
||||
|
||||
|
||||
o(el.className).equals("a")
|
||||
o(el.attributes["class"].nodeValue).equals("a")
|
||||
})
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue