|
161 | 161 | HOOK_WRAPPERS: '.flex_patterns_hook_wrapper'
|
162 | 162 | },
|
163 | 163 | },
|
| 164 | + serialize: [ |
| 165 | + [/</gi, '<'], |
| 166 | + [/>/gi, '>'], |
| 167 | + ], |
164 | 168 | other : {
|
165 | 169 | INDEXES : '__indexes'
|
166 | 170 | }
|
|
1560 | 1564 | }
|
1561 | 1565 | return model.current.binds;
|
1562 | 1566 | },
|
1563 |
| - update : function (clone) { |
| 1567 | + update : function (clone, _serialize) { |
1564 | 1568 | function bind(group, binds) {
|
| 1569 | + function serialize(value) { |
| 1570 | + var result = value; |
| 1571 | + if (_serialize) { |
| 1572 | + settings.serialize.forEach(function (pear) { |
| 1573 | + result = result.replace(pear[0], pear[1]); |
| 1574 | + }); |
| 1575 | + } |
| 1576 | + return result; |
| 1577 | + }; |
1565 | 1578 | function correctStyle(prop) {
|
1566 | 1579 | var result = '';
|
1567 | 1580 | prop.split('-').forEach(function (part, index) {
|
|
1632 | 1645 | (function (binds, key, node, attr_name, handles) {
|
1633 | 1646 | binds[key] = node.getAttribute(attr_name);
|
1634 | 1647 | _object(binds).binding().bind(key, function (current, previous) {
|
1635 |
| - var execute = false; |
| 1648 | + var execute = false, |
| 1649 | + current = serialize(current); |
1636 | 1650 | if (node.getAttribute(attr_name) !== current) {
|
1637 | 1651 | node.setAttribute(attr_name, current);
|
1638 | 1652 | execute = true;
|
|
1653 | 1667 | (function (binds, key, node, prop, handles) {
|
1654 | 1668 | binds[key] = node.style[prop];
|
1655 | 1669 | _object(binds).binding().bind(key, function (current, previous) {
|
| 1670 | + var current = serialize(current); |
1656 | 1671 | if (node.style[prop] !== current) {
|
1657 | 1672 | node.style[prop] = current;
|
1658 | 1673 | executeHandles(handles, node.style, prop, current);
|
|
1665 | 1680 | (function (binds, key, node, prop, handles) {
|
1666 | 1681 | binds[key] = node[prop];
|
1667 | 1682 | _object(binds).binding().bind(key, function (current, previous) {
|
| 1683 | + var current = serialize(current); |
1668 | 1684 | if (node[prop] !== current) {
|
1669 | 1685 | node[prop] = current;
|
1670 | 1686 | executeHandles(handles, node, prop, current);
|
|
2016 | 2032 | },
|
2017 | 2033 | };
|
2018 | 2034 | methods = {
|
2019 |
| - build : function (_hooks, _resources, _conditions) { |
| 2035 | + build : function (_hooks, _resources, _conditions, _serialize) { |
2020 | 2036 | var nodes = [],
|
2021 | 2037 | _map = [],
|
2022 | 2038 | _binds = [],
|
|
2039 | 2055 | dom. iteration();
|
2040 | 2056 | hooks. apply(_hooks, clone.setters, hooks_map);
|
2041 | 2057 | map. update(clone.clone);
|
2042 |
| - model. update(clone.clone); |
| 2058 | + model. update(clone.clone, _serialize); |
2043 | 2059 | model. clear(clone.clone);
|
2044 | 2060 | dom. update(clone.dom);
|
2045 | 2061 | nodes = nodes.concat(Array.prototype.filter.call(clone.clone.childNodes, function () { return true; }));
|
|
2072 | 2088 | });
|
2073 | 2089 | }
|
2074 | 2090 | },
|
2075 |
| - bind : function (hooks, resources, conditions) { |
| 2091 | + bind : function (hooks, resources, conditions, serialize) { |
2076 | 2092 | return function () {
|
2077 |
| - return methods.build(hooks, resources, conditions); |
| 2093 | + return methods.build(hooks, resources, conditions, serialize); |
2078 | 2094 | };
|
2079 | 2095 | }
|
2080 | 2096 | };
|
|
2468 | 2484 | throw logs.caller.CANNOT_GET_CHILD_PATTERN;
|
2469 | 2485 | } else {
|
2470 | 2486 | hooks.apply(_hooks);
|
2471 |
| - return _instance.bind(_hooks, value.resources(), value.conditions()); |
| 2487 | + return _instance.bind(_hooks, value.resources(), value.conditions(), value.serialize()); |
2472 | 2488 | }
|
2473 | 2489 | }
|
2474 | 2490 | },
|
|
2518 | 2534 | hooks.apply();
|
2519 | 2535 | privates.pattern = instance.init(self.url);
|
2520 | 2536 | if (privates.pattern !== null) {
|
2521 |
| - privates.pattern = privates.pattern.build(privates.hooks, privates.resources, privates.conditions); |
| 2537 | + privates.pattern = privates.pattern.build(privates.hooks, privates.resources, privates.conditions, privates.serialize); |
2522 | 2538 | if (privates.pattern instanceof settings.classes.RESULT) {
|
2523 | 2539 | privates.pattern.mount(privates.node, privates.before, privates.after, privates.replace);
|
2524 | 2540 | if (privates.callbacks.success !== null) {
|
|
2541 | 2557 | hooks.apply();
|
2542 | 2558 | privates.pattern = instance.init(self.url);
|
2543 | 2559 | if (privates.pattern !== null) {
|
2544 |
| - privates.pattern = privates.pattern.build(privates.hooks, privates.resources, privates.conditions); |
| 2560 | + privates.pattern = privates.pattern.build(privates.hooks, privates.resources, privates.conditions, privates.serialize); |
2545 | 2561 | if (privates.pattern instanceof settings.classes.RESULT) {
|
2546 | 2562 | return privates.pattern;
|
2547 | 2563 | }
|
|
2553 | 2569 | };
|
2554 | 2570 | returning = {
|
2555 | 2571 | render : render,
|
2556 |
| - hooks : function () { return privates.hooks; }, |
2557 |
| - resources : function () { return privates.resources;}, |
2558 |
| - conditions : function () { return privates.conditions; } |
2559 |
| - }; |
| 2572 | + hooks : function () { return privates.hooks; }, |
| 2573 | + resources : function () { return privates.resources; }, |
| 2574 | + conditions : function () { return privates.conditions; }, |
| 2575 | + serialize : function () { return privates.serialize; }, |
| 2576 | + }; |
2560 | 2577 | return {
|
2561 | 2578 | render : returning.render,
|
2562 | 2579 | hooks : returning.hooks,
|
2563 | 2580 | conditions : returning.conditions,
|
| 2581 | + serialize : returning.serialize, |
2564 | 2582 | resources : returning.resources
|
2565 | 2583 | };
|
2566 | 2584 | },
|
|
2591 | 2609 | { name: 'conditions', type: 'object', value: null },
|
2592 | 2610 | { name: 'callbacks', type: 'object', value: {} },
|
2593 | 2611 | { name: 'resources', type: 'object', value: {} },
|
| 2612 | + { name: 'serialize', type: 'boolean', value: true }, |
2594 | 2613 | { name: 'remove_missing_hooks', type: 'boolean', value: true }]) !== false) {
|
2595 | 2614 | flex.oop.objects.validate(parameters.callbacks, [ { name: 'before', type: 'function', value: null },
|
2596 | 2615 | { name: 'success', type: 'function', value: null },
|
|
2611 | 2630 | data : parameters.data,
|
2612 | 2631 | conditions : parameters.conditions,
|
2613 | 2632 | callbacks : parameters.callbacks,
|
| 2633 | + serialize : parameters.serialize, |
2614 | 2634 | remove_missing_hooks: parameters.remove_missing_hooks,
|
2615 | 2635 | resources : parameters.resources,
|
2616 | 2636 | //Local
|
|
0 commit comments