NOBUG: Fixed file access permissions
[moodle.git] / lib / yuilib / 3.13.0 / editor-bidi / editor-bidi-coverage.js
blob2dd63e272666d670bfec2b98102e02cbc6ef4d61
1 /*
2 YUI 3.13.0 (build 508226d)
3 Copyright 2013 Yahoo! Inc. All rights reserved.
4 Licensed under the BSD License.
5 http://yuilibrary.com/license/
6 */
8 if (typeof __coverage__ === 'undefined') { __coverage__ = {}; }
9 if (!__coverage__['build/editor-bidi/editor-bidi.js']) {
10    __coverage__['build/editor-bidi/editor-bidi.js'] = {"path":"build/editor-bidi/editor-bidi.js","s":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0},"b":{"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":42}}},"2":{"name":"(anonymous_2)","line":14,"loc":{"start":{"line":14,"column":21},"end":{"line":14,"column":32}}},"3":{"name":"(anonymous_3)","line":38,"loc":{"start":{"line":38,"column":25},"end":{"line":38,"column":36}}},"4":{"name":"(anonymous_4)","line":64,"loc":{"start":{"line":64,"column":26},"end":{"line":64,"column":38}}},"5":{"name":"(anonymous_5)","line":77,"loc":{"start":{"line":77,"column":23},"end":{"line":77,"column":34}}},"6":{"name":"(anonymous_6)","line":81,"loc":{"start":{"line":81,"column":21},"end":{"line":81,"column":32}}},"7":{"name":"(anonymous_7)","line":131,"loc":{"start":{"line":131,"column":21},"end":{"line":131,"column":48}}},"8":{"name":"(anonymous_8)","line":151,"loc":{"start":{"line":151,"column":44},"end":{"line":151,"column":66}}},"9":{"name":"(anonymous_9)","line":175,"loc":{"start":{"line":175,"column":20},"end":{"line":175,"column":46}}},"10":{"name":"(anonymous_10)","line":177,"loc":{"start":{"line":177,"column":25},"end":{"line":177,"column":43}}},"11":{"name":"(anonymous_11)","line":247,"loc":{"start":{"line":247,"column":25},"end":{"line":247,"column":37}}},"12":{"name":"(anonymous_12)","line":273,"loc":{"start":{"line":273,"column":41},"end":{"line":273,"column":66}}},"13":{"name":"(anonymous_13)","line":315,"loc":{"start":{"line":315,"column":26},"end":{"line":315,"column":41}}},"14":{"name":"(anonymous_14)","line":319,"loc":{"start":{"line":319,"column":32},"end":{"line":319,"column":44}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":339,"column":44}},"2":{"start":{"line":14,"column":4},"end":{"line":17,"column":54}},"3":{"start":{"line":15,"column":8},"end":{"line":15,"column":65}},"4":{"start":{"line":19,"column":4},"end":{"line":258,"column":7}},"5":{"start":{"line":39,"column":12},"end":{"line":42,"column":32}},"6":{"start":{"line":44,"column":12},"end":{"line":56,"column":13}},"7":{"start":{"line":45,"column":16},"end":{"line":45,"column":95}},"8":{"start":{"line":46,"column":16},"end":{"line":52,"column":17}},"9":{"start":{"line":47,"column":20},"end":{"line":47,"column":59}},"10":{"start":{"line":48,"column":20},"end":{"line":51,"column":21}},"11":{"start":{"line":49,"column":24},"end":{"line":49,"column":72}},"12":{"start":{"line":50,"column":24},"end":{"line":50,"column":55}},"13":{"start":{"line":54,"column":16},"end":{"line":54,"column":63}},"14":{"start":{"line":55,"column":16},"end":{"line":55,"column":42}},"15":{"start":{"line":66,"column":12},"end":{"line":69,"column":13}},"16":{"start":{"line":67,"column":16},"end":{"line":67,"column":39}},"17":{"start":{"line":68,"column":16},"end":{"line":68,"column":40}},"18":{"start":{"line":78,"column":12},"end":{"line":78,"column":35}},"19":{"start":{"line":79,"column":12},"end":{"line":79,"column":36}},"20":{"start":{"line":82,"column":12},"end":{"line":82,"column":38}},"21":{"start":{"line":84,"column":12},"end":{"line":84,"column":35}},"22":{"start":{"line":86,"column":12},"end":{"line":86,"column":73}},"23":{"start":{"line":87,"column":12},"end":{"line":87,"column":72}},"24":{"start":{"line":132,"column":12},"end":{"line":132,"column":51}},"25":{"start":{"line":134,"column":12},"end":{"line":134,"column":50}},"26":{"start":{"line":136,"column":12},"end":{"line":138,"column":13}},"27":{"start":{"line":137,"column":16},"end":{"line":137,"column":30}},"28":{"start":{"line":140,"column":12},"end":{"line":142,"column":13}},"29":{"start":{"line":141,"column":16},"end":{"line":141,"column":60}},"30":{"start":{"line":143,"column":12},"end":{"line":161,"column":13}},"31":{"start":{"line":150,"column":16},"end":{"line":150,"column":64}},"32":{"start":{"line":151,"column":16},"end":{"line":157,"column":19}},"33":{"start":{"line":152,"column":20},"end":{"line":156,"column":21}},"34":{"start":{"line":153,"column":24},"end":{"line":153,"column":42}},"35":{"start":{"line":155,"column":24},"end":{"line":155,"column":45}},"36":{"start":{"line":158,"column":16},"end":{"line":158,"column":44}},"37":{"start":{"line":159,"column":16},"end":{"line":159,"column":44}},"38":{"start":{"line":160,"column":16},"end":{"line":160,"column":33}},"39":{"start":{"line":162,"column":12},"end":{"line":162,"column":26}},"40":{"start":{"line":176,"column":12},"end":{"line":176,"column":37}},"41":{"start":{"line":177,"column":16},"end":{"line":182,"column":18}},"42":{"start":{"line":178,"column":20},"end":{"line":181,"column":21}},"43":{"start":{"line":179,"column":24},"end":{"line":179,"column":42}},"44":{"start":{"line":180,"column":24},"end":{"line":180,"column":36}},"45":{"start":{"line":184,"column":12},"end":{"line":184,"column":50}},"46":{"start":{"line":186,"column":12},"end":{"line":188,"column":13}},"47":{"start":{"line":187,"column":16},"end":{"line":187,"column":70}},"48":{"start":{"line":195,"column":12},"end":{"line":209,"column":13}},"49":{"start":{"line":196,"column":16},"end":{"line":196,"column":56}},"50":{"start":{"line":201,"column":16},"end":{"line":208,"column":17}},"51":{"start":{"line":202,"column":20},"end":{"line":202,"column":37}},"52":{"start":{"line":203,"column":20},"end":{"line":203,"column":56}},"53":{"start":{"line":204,"column":20},"end":{"line":207,"column":21}},"54":{"start":{"line":205,"column":24},"end":{"line":205,"column":47}},"55":{"start":{"line":206,"column":24},"end":{"line":206,"column":72}},"56":{"start":{"line":211,"column":12},"end":{"line":213,"column":13}},"57":{"start":{"line":212,"column":16},"end":{"line":212,"column":66}},"58":{"start":{"line":215,"column":12},"end":{"line":215,"column":29}},"59":{"start":{"line":248,"column":12},"end":{"line":255,"column":13}},"60":{"start":{"line":249,"column":16},"end":{"line":251,"column":17}},"61":{"start":{"line":250,"column":20},"end":{"line":250,"column":103}},"62":{"start":{"line":252,"column":16},"end":{"line":254,"column":17}},"63":{"start":{"line":253,"column":20},"end":{"line":253,"column":47}},"64":{"start":{"line":256,"column":12},"end":{"line":256,"column":21}},"65":{"start":{"line":260,"column":4},"end":{"line":260,"column":26}},"66":{"start":{"line":262,"column":4},"end":{"line":262,"column":37}},"67":{"start":{"line":273,"column":4},"end":{"line":337,"column":6}},"68":{"start":{"line":274,"column":8},"end":{"line":279,"column":42}},"69":{"start":{"line":281,"column":8},"end":{"line":284,"column":9}},"70":{"start":{"line":282,"column":12},"end":{"line":282,"column":88}},"71":{"start":{"line":283,"column":12},"end":{"line":283,"column":19}},"72":{"start":{"line":286,"column":8},"end":{"line":286,"column":44}},"73":{"start":{"line":288,"column":8},"end":{"line":334,"column":9}},"74":{"start":{"line":289,"column":12},"end":{"line":289,"column":72}},"75":{"start":{"line":290,"column":12},"end":{"line":292,"column":13}},"76":{"start":{"line":291,"column":16},"end":{"line":291,"column":62}},"77":{"start":{"line":294,"column":12},"end":{"line":294,"column":54}},"78":{"start":{"line":295,"column":12},"end":{"line":303,"column":13}},"79":{"start":{"line":297,"column":16},"end":{"line":297,"column":46}},"80":{"start":{"line":298,"column":16},"end":{"line":302,"column":17}},"81":{"start":{"line":299,"column":20},"end":{"line":299,"column":38}},"82":{"start":{"line":301,"column":20},"end":{"line":301,"column":38}},"83":{"start":{"line":304,"column":12},"end":{"line":304,"column":47}},"84":{"start":{"line":305,"column":12},"end":{"line":310,"column":13}},"85":{"start":{"line":306,"column":16},"end":{"line":306,"column":47}},"86":{"start":{"line":307,"column":16},"end":{"line":309,"column":17}},"87":{"start":{"line":308,"column":20},"end":{"line":308,"column":31}},"88":{"start":{"line":311,"column":12},"end":{"line":311,"column":32}},"89":{"start":{"line":313,"column":12},"end":{"line":313,"column":41}},"90":{"start":{"line":314,"column":12},"end":{"line":314,"column":32}},"91":{"start":{"line":315,"column":12},"end":{"line":317,"column":15}},"92":{"start":{"line":316,"column":16},"end":{"line":316,"column":79}},"93":{"start":{"line":318,"column":12},"end":{"line":318,"column":83}},"94":{"start":{"line":319,"column":12},"end":{"line":332,"column":15}},"95":{"start":{"line":320,"column":16},"end":{"line":320,"column":34}},"96":{"start":{"line":322,"column":16},"end":{"line":322,"column":50}},"97":{"start":{"line":323,"column":16},"end":{"line":330,"column":17}},"98":{"start":{"line":324,"column":20},"end":{"line":324,"column":46}},"99":{"start":{"line":325,"column":20},"end":{"line":329,"column":21}},"100":{"start":{"line":326,"column":24},"end":{"line":326,"column":34}},"101":{"start":{"line":328,"column":24},"end":{"line":328,"column":34}},"102":{"start":{"line":331,"column":16},"end":{"line":331,"column":39}},"103":{"start":{"line":333,"column":12},"end":{"line":333,"column":41}},"104":{"start":{"line":335,"column":8},"end":{"line":335,"column":29}},"105":{"start":{"line":336,"column":8},"end":{"line":336,"column":27}}},"branchMap":{"1":{"line":44,"type":"if","locations":[{"start":{"line":44,"column":12},"end":{"line":44,"column":12}},{"start":{"line":44,"column":12},"end":{"line":44,"column":12}}]},"2":{"line":46,"type":"if","locations":[{"start":{"line":46,"column":16},"end":{"line":46,"column":16}},{"start":{"line":46,"column":16},"end":{"line":46,"column":16}}]},"3":{"line":48,"type":"if","locations":[{"start":{"line":48,"column":20},"end":{"line":48,"column":20}},{"start":{"line":48,"column":20},"end":{"line":48,"column":20}}]},"4":{"line":66,"type":"if","locations":[{"start":{"line":66,"column":12},"end":{"line":66,"column":12}},{"start":{"line":66,"column":12},"end":{"line":66,"column":12}}]},"5":{"line":66,"type":"binary-expr","locations":[{"start":{"line":66,"column":16},"end":{"line":66,"column":31}},{"start":{"line":66,"column":35},"end":{"line":66,"column":67}}]},"6":{"line":134,"type":"binary-expr","locations":[{"start":{"line":134,"column":19},"end":{"line":134,"column":23}},{"start":{"line":134,"column":27},"end":{"line":134,"column":49}}]},"7":{"line":136,"type":"if","locations":[{"start":{"line":136,"column":12},"end":{"line":136,"column":12}},{"start":{"line":136,"column":12},"end":{"line":136,"column":12}}]},"8":{"line":140,"type":"if","locations":[{"start":{"line":140,"column":12},"end":{"line":140,"column":12}},{"start":{"line":140,"column":12},"end":{"line":140,"column":12}}]},"9":{"line":143,"type":"if","locations":[{"start":{"line":143,"column":12},"end":{"line":143,"column":12}},{"start":{"line":143,"column":12},"end":{"line":143,"column":12}}]},"10":{"line":143,"type":"binary-expr","locations":[{"start":{"line":143,"column":16},"end":{"line":143,"column":20}},{"start":{"line":143,"column":24},"end":{"line":143,"column":46}}]},"11":{"line":152,"type":"if","locations":[{"start":{"line":152,"column":20},"end":{"line":152,"column":20}},{"start":{"line":152,"column":20},"end":{"line":152,"column":20}}]},"12":{"line":178,"type":"if","locations":[{"start":{"line":178,"column":20},"end":{"line":178,"column":20}},{"start":{"line":178,"column":20},"end":{"line":178,"column":20}}]},"13":{"line":184,"type":"binary-expr","locations":[{"start":{"line":184,"column":19},"end":{"line":184,"column":23}},{"start":{"line":184,"column":27},"end":{"line":184,"column":49}}]},"14":{"line":201,"type":"if","locations":[{"start":{"line":201,"column":16},"end":{"line":201,"column":16}},{"start":{"line":201,"column":16},"end":{"line":201,"column":16}}]},"15":{"line":201,"type":"binary-expr","locations":[{"start":{"line":201,"column":20},"end":{"line":201,"column":43}},{"start":{"line":201,"column":47},"end":{"line":201,"column":89}}]},"16":{"line":204,"type":"if","locations":[{"start":{"line":204,"column":20},"end":{"line":204,"column":20}},{"start":{"line":204,"column":20},"end":{"line":204,"column":20}}]},"17":{"line":248,"type":"if","locations":[{"start":{"line":248,"column":12},"end":{"line":248,"column":12}},{"start":{"line":248,"column":12},"end":{"line":248,"column":12}}]},"18":{"line":249,"type":"if","locations":[{"start":{"line":249,"column":16},"end":{"line":249,"column":16}},{"start":{"line":249,"column":16},"end":{"line":249,"column":16}}]},"19":{"line":252,"type":"if","locations":[{"start":{"line":252,"column":16},"end":{"line":252,"column":16}},{"start":{"line":252,"column":16},"end":{"line":252,"column":16}}]},"20":{"line":281,"type":"if","locations":[{"start":{"line":281,"column":8},"end":{"line":281,"column":8}},{"start":{"line":281,"column":8},"end":{"line":281,"column":8}}]},"21":{"line":288,"type":"if","locations":[{"start":{"line":288,"column":8},"end":{"line":288,"column":8}},{"start":{"line":288,"column":8},"end":{"line":288,"column":8}}]},"22":{"line":290,"type":"if","locations":[{"start":{"line":290,"column":12},"end":{"line":290,"column":12}},{"start":{"line":290,"column":12},"end":{"line":290,"column":12}}]},"23":{"line":295,"type":"if","locations":[{"start":{"line":295,"column":12},"end":{"line":295,"column":12}},{"start":{"line":295,"column":12},"end":{"line":295,"column":12}}]},"24":{"line":298,"type":"if","locations":[{"start":{"line":298,"column":16},"end":{"line":298,"column":16}},{"start":{"line":298,"column":16},"end":{"line":298,"column":16}}]},"25":{"line":298,"type":"binary-expr","locations":[{"start":{"line":298,"column":20},"end":{"line":298,"column":24}},{"start":{"line":298,"column":28},"end":{"line":298,"column":41}}]},"26":{"line":305,"type":"if","locations":[{"start":{"line":305,"column":12},"end":{"line":305,"column":12}},{"start":{"line":305,"column":12},"end":{"line":305,"column":12}}]},"27":{"line":307,"type":"if","locations":[{"start":{"line":307,"column":16},"end":{"line":307,"column":16}},{"start":{"line":307,"column":16},"end":{"line":307,"column":16}}]},"28":{"line":307,"type":"binary-expr","locations":[{"start":{"line":307,"column":20},"end":{"line":307,"column":34}},{"start":{"line":307,"column":38},"end":{"line":307,"column":74}}]},"29":{"line":323,"type":"if","locations":[{"start":{"line":323,"column":16},"end":{"line":323,"column":16}},{"start":{"line":323,"column":16},"end":{"line":323,"column":16}}]},"30":{"line":325,"type":"if","locations":[{"start":{"line":325,"column":20},"end":{"line":325,"column":20}},{"start":{"line":325,"column":20},"end":{"line":325,"column":20}}]},"31":{"line":325,"type":"binary-expr","locations":[{"start":{"line":325,"column":24},"end":{"line":325,"column":28}},{"start":{"line":325,"column":32},"end":{"line":325,"column":45}}]}},"code":["(function () { YUI.add('editor-bidi', function (Y, NAME) {","","","    /**","     * Plugin for Editor to support BiDirectional (bidi) text operations.","     * @class Plugin.EditorBidi","     * @extends Base","     * @constructor","     * @module editor","     * @submodule editor-bidi","     */","","","    var EditorBidi = function() {","        EditorBidi.superclass.constructor.apply(this, arguments);","    }, HOST = 'host', DIR = 'dir', NODE_CHANGE = 'nodeChange',","    B_C_CHANGE = 'bidiContextChange', STYLE = 'style';","","    Y.extend(EditorBidi, Y.Base, {","        /**","        * Place holder for the last direction when checking for a switch","        * @private","        * @property lastDirection","        */","        lastDirection: null,","        /**","        * Tells us that an initial bidi check has already been performed","        * @private","        * @property firstEvent","        */","        firstEvent: null,","","        /**","        * Method checks to see if the direction of the text has changed based on a nodeChange event.","        * @private","        * @method _checkForChange","        */","        _checkForChange: function() {","            var host = this.get(HOST),","                inst = host.getInstance(),","                sel = new inst.EditorSelection(),","                node, direction;","","            if (sel.isCollapsed) {","                node = EditorBidi.blockParent(sel.focusNode, false, inst.EditorSelection.ROOT);","                if (node) {","                    direction = node.getStyle('direction');","                    if (direction !== this.lastDirection) {","                        host.fire(B_C_CHANGE, { changedTo: direction });","                        this.lastDirection = direction;","                    }","                }","            } else {","                host.fire(B_C_CHANGE, { changedTo: 'select' });","                this.lastDirection = null;","            }","        },","","        /**","        * Checked for a change after a specific nodeChange event has been fired.","        * @private","        * @method _afterNodeChange","        */","        _afterNodeChange: function(e) {","            // If this is the first event ever, or an event that can result in a context change","            if (this.firstEvent || EditorBidi.EVENTS[e.changedType]) {","                this._checkForChange();","                this.firstEvent = false;","            }","        },","","        /**","        * Checks for a direction change after a mouseup occurs.","        * @private","        * @method _afterMouseUp","        */","        _afterMouseUp: function() {","            this._checkForChange();","            this.firstEvent = false;","        },","        initializer: function() {","            var host = this.get(HOST);","","            this.firstEvent = true;","","            host.after(NODE_CHANGE, Y.bind(this._afterNodeChange, this));","            host.after('dom:mouseup', Y.bind(this._afterMouseUp, this));","        }","    }, {","        /**","        * The events to check for a direction change on","        * @property EVENTS","        * @static","        */","        EVENTS: {","            'backspace-up': true,","            'pageup-up': true,","            'pagedown-down': true,","            'end-up': true,","            'home-up': true,","            'left-up': true,","            'up-up': true,","            'right-up': true,","            'down-up': true,","            'delete-up': true","        },","","        /**","        * More elements may be needed. BODY *must* be in the list to take care of the special case.","        *","        * blockParent could be changed to use inst.EditorSelection.BLOCKS","        * instead, but that would make Y.Plugin.EditorBidi.blockParent","        * unusable in non-RTE contexts (it being usable is a nice","        * side-effect).","        * @property BLOCKS","        * @static","        */","        //BLOCKS: Y.EditorSelection.BLOCKS+',LI,HR,' + BODY,","        BLOCKS: Y.EditorSelection.BLOCKS,","        /**","        * Template for creating a block element","        * @static","        * @property DIV_WRAPPER","        */","        DIV_WRAPPER: '<DIV></DIV>',","        /**","        * Returns a block parent for a given element","        * @static","        * @method blockParent","        */","        blockParent: function(node, wrap, root) {","            var parent = node, divNode, firstChild;","","            root = root || Y.EditorSelection.ROOT;","            ","            if (!parent) {","                parent = root;","            }","","            if (!parent.test(EditorBidi.BLOCKS)) {","                parent = parent.ancestor(EditorBidi.BLOCKS);","            }","            if (wrap && parent.compareTo(root)) {","                // This shouldn't happen if the RTE handles everything","                // according to spec: we should get to a P before ROOT. But","                // we don't want to set the direction of ROOT even if that","                // happens, so we wrap everything in a DIV.","","                // The code is based on YUI3's Y.EditorSelection._wrapBlock function.","                divNode = Y.Node.create(EditorBidi.DIV_WRAPPER);","                parent.get('children').each(function(node, index) {","                    if (index === 0) {","                        firstChild = node;","                    } else {","                        divNode.append(node);","                    }","                });","                firstChild.replace(divNode);","                divNode.prepend(firstChild);","                parent = divNode;","            }","            return parent;","        },","        /**","        * The data key to store on the node.","        * @static","        * @property _NODE_SELECTED","        */","        _NODE_SELECTED: 'bidiSelected',","        /**","        * Generates a list of all the block parents of the current NodeList","        * @static","        * @method addParents","        */","        addParents: function(nodeArray, root) {","            var i, parent, addParent;","                tester = function(sibling) {","                    if (!sibling.getData(EditorBidi._NODE_SELECTED)) {","                        addParent = false;","                        return true; // stop more processing","                    }","                };","","            root = root || Y.EditorSelection.ROOT;","","            for (i = 0; i < nodeArray.length; i += 1) {","                nodeArray[i].setData(EditorBidi._NODE_SELECTED, true);","            }","","            // This works automagically, since new parents added get processed","            // later themselves. So if there's a node early in the process that","            // we haven't discovered some of its siblings yet, thus resulting in","            // its parent not added, the parent will be added later, since those","            // siblings will be added to the array and then get processed.","            for (i = 0; i < nodeArray.length; i += 1) {","                parent = nodeArray[i].get('parentNode');","","                // Don't add the parent if the parent is the ROOT element.","                // We don't want to change the direction of ROOT. Also don't","                // do it if the parent is already in the list.","                if (!root.compareTo(parent) && !parent.getData(EditorBidi._NODE_SELECTED)) {","                    addParent = true;","                    parent.get('children').some(tester);","                    if (addParent) {","                        nodeArray.push(parent);","                        parent.setData(EditorBidi._NODE_SELECTED, true);","                    }","                }","            }","","            for (i = 0; i < nodeArray.length; i += 1) {","                nodeArray[i].clearData(EditorBidi._NODE_SELECTED);","            }","","            return nodeArray;","        },","","","        /**","        * editorBidi","        * @static","        * @property NAME","        */","        NAME: 'editorBidi',","        /**","        * editorBidi","        * @static","        * @property NS","        */","        NS: 'editorBidi',","        ATTRS: {","            host: {","                value: false","            }","        },","        /**","        * Regex for testing/removing text-align style from an element","        * @static","        * @property RE_TEXT_ALIGN","        */","        RE_TEXT_ALIGN: /text-align:\\s*\\w*\\s*;/,","        /**","        * Method to test a node's style attribute for text-align and removing it.","        * @static","        * @method removeTextAlign","        */","        removeTextAlign: function(n) {","            if (n) {","                if (n.getAttribute(STYLE).match(EditorBidi.RE_TEXT_ALIGN)) {","                    n.setAttribute(STYLE, n.getAttribute(STYLE).replace(EditorBidi.RE_TEXT_ALIGN, ''));","                }","                if (n.hasAttribute('align')) {","                    n.removeAttribute('align');","                }","            }","            return n;","        }","    });","","    Y.namespace('Plugin');","","    Y.Plugin.EditorBidi = EditorBidi;","","    /**","     * bidi execCommand override for setting the text direction of a node.","     * This property is added to the `Y.Plugin.ExecCommands.COMMANDS`","     * collection.","     *","     * @for Plugin.ExecCommand","     * @property bidi","     */","    //TODO -- This should not add this command unless the plugin is added to the instance..","    Y.Plugin.ExecCommand.COMMANDS.bidi = function(cmd, direction) {","        var inst = this.getInstance(),","            sel = new inst.EditorSelection(),","            ns = this.get(HOST).get(HOST).editorBidi,","            returnValue, block, b,","            root = inst.EditorSelection.ROOT,","            selected, selectedBlocks, dir;","","        if (!ns) {","            Y.error('bidi execCommand is not available without the EditorBiDi plugin.');","            return;","        }","","        inst.EditorSelection.filterBlocks();","","        if (sel.isCollapsed) { // No selection","            block = EditorBidi.blockParent(sel.anchorNode, false, root);","            if (!block) {","                block = root.one(inst.EditorSelection.BLOCKS);","            }","            //Remove text-align attribute if it exists","            block = EditorBidi.removeTextAlign(block);","            if (!direction) {","                //If no direction is set, auto-detect the proper setting to make it \"toggle\"","                dir = block.getAttribute(DIR);","                if (!dir || dir === 'ltr') {","                    direction = 'rtl';","                } else {","                    direction = 'ltr';","                }","            }","            block.setAttribute(DIR, direction);","            if (Y.UA.ie) {","                b = block.all('br.yui-cursor');","                if (b.size() === 1 && block.get('childNodes').size() === 1) {","                    b.remove();","                }","            }","            returnValue = block;","        } else { // some text is selected","            selected = sel.getSelected();","            selectedBlocks = [];","            selected.each(function(node) {","                selectedBlocks.push(EditorBidi.blockParent(node, false, root));","            });","            selectedBlocks = inst.all(EditorBidi.addParents(selectedBlocks, root));","            selectedBlocks.each(function(n) {","                var d = direction;","                //Remove text-align attribute if it exists","                n = EditorBidi.removeTextAlign(n);","                if (!d) {","                    dir = n.getAttribute(DIR);","                    if (!dir || dir === 'ltr') {","                        d = 'rtl';","                    } else {","                        d = 'ltr';","                    }","                }","                n.setAttribute(DIR, d);","            });","            returnValue = selectedBlocks;","        }","        ns._checkForChange();","        return returnValue;","    };","","}, '3.13.0', {\"requires\": [\"editor-base\"]});","","}());"]};
12 var __cov_s47Xp5yCnwqwdqlXaecyHw = __coverage__['build/editor-bidi/editor-bidi.js'];
13 __cov_s47Xp5yCnwqwdqlXaecyHw.s['1']++;YUI.add('editor-bidi',function(Y,NAME){__cov_s47Xp5yCnwqwdqlXaecyHw.f['1']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['2']++;var EditorBidi=function(){__cov_s47Xp5yCnwqwdqlXaecyHw.f['2']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['3']++;EditorBidi.superclass.constructor.apply(this,arguments);},HOST='host',DIR='dir',NODE_CHANGE='nodeChange',B_C_CHANGE='bidiContextChange',STYLE='style';__cov_s47Xp5yCnwqwdqlXaecyHw.s['4']++;Y.extend(EditorBidi,Y.Base,{lastDirection:null,firstEvent:null,_checkForChange:function(){__cov_s47Xp5yCnwqwdqlXaecyHw.f['3']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['5']++;var host=this.get(HOST),inst=host.getInstance(),sel=new inst.EditorSelection(),node,direction;__cov_s47Xp5yCnwqwdqlXaecyHw.s['6']++;if(sel.isCollapsed){__cov_s47Xp5yCnwqwdqlXaecyHw.b['1'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['7']++;node=EditorBidi.blockParent(sel.focusNode,false,inst.EditorSelection.ROOT);__cov_s47Xp5yCnwqwdqlXaecyHw.s['8']++;if(node){__cov_s47Xp5yCnwqwdqlXaecyHw.b['2'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['9']++;direction=node.getStyle('direction');__cov_s47Xp5yCnwqwdqlXaecyHw.s['10']++;if(direction!==this.lastDirection){__cov_s47Xp5yCnwqwdqlXaecyHw.b['3'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['11']++;host.fire(B_C_CHANGE,{changedTo:direction});__cov_s47Xp5yCnwqwdqlXaecyHw.s['12']++;this.lastDirection=direction;}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['3'][1]++;}}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['2'][1]++;}}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['1'][1]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['13']++;host.fire(B_C_CHANGE,{changedTo:'select'});__cov_s47Xp5yCnwqwdqlXaecyHw.s['14']++;this.lastDirection=null;}},_afterNodeChange:function(e){__cov_s47Xp5yCnwqwdqlXaecyHw.f['4']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['15']++;if((__cov_s47Xp5yCnwqwdqlXaecyHw.b['5'][0]++,this.firstEvent)||(__cov_s47Xp5yCnwqwdqlXaecyHw.b['5'][1]++,EditorBidi.EVENTS[e.changedType])){__cov_s47Xp5yCnwqwdqlXaecyHw.b['4'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['16']++;this._checkForChange();__cov_s47Xp5yCnwqwdqlXaecyHw.s['17']++;this.firstEvent=false;}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['4'][1]++;}},_afterMouseUp:function(){__cov_s47Xp5yCnwqwdqlXaecyHw.f['5']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['18']++;this._checkForChange();__cov_s47Xp5yCnwqwdqlXaecyHw.s['19']++;this.firstEvent=false;},initializer:function(){__cov_s47Xp5yCnwqwdqlXaecyHw.f['6']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['20']++;var host=this.get(HOST);__cov_s47Xp5yCnwqwdqlXaecyHw.s['21']++;this.firstEvent=true;__cov_s47Xp5yCnwqwdqlXaecyHw.s['22']++;host.after(NODE_CHANGE,Y.bind(this._afterNodeChange,this));__cov_s47Xp5yCnwqwdqlXaecyHw.s['23']++;host.after('dom:mouseup',Y.bind(this._afterMouseUp,this));}},{EVENTS:{'backspace-up':true,'pageup-up':true,'pagedown-down':true,'end-up':true,'home-up':true,'left-up':true,'up-up':true,'right-up':true,'down-up':true,'delete-up':true},BLOCKS:Y.EditorSelection.BLOCKS,DIV_WRAPPER:'<DIV></DIV>',blockParent:function(node,wrap,root){__cov_s47Xp5yCnwqwdqlXaecyHw.f['7']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['24']++;var parent=node,divNode,firstChild;__cov_s47Xp5yCnwqwdqlXaecyHw.s['25']++;root=(__cov_s47Xp5yCnwqwdqlXaecyHw.b['6'][0]++,root)||(__cov_s47Xp5yCnwqwdqlXaecyHw.b['6'][1]++,Y.EditorSelection.ROOT);__cov_s47Xp5yCnwqwdqlXaecyHw.s['26']++;if(!parent){__cov_s47Xp5yCnwqwdqlXaecyHw.b['7'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['27']++;parent=root;}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['7'][1]++;}__cov_s47Xp5yCnwqwdqlXaecyHw.s['28']++;if(!parent.test(EditorBidi.BLOCKS)){__cov_s47Xp5yCnwqwdqlXaecyHw.b['8'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['29']++;parent=parent.ancestor(EditorBidi.BLOCKS);}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['8'][1]++;}__cov_s47Xp5yCnwqwdqlXaecyHw.s['30']++;if((__cov_s47Xp5yCnwqwdqlXaecyHw.b['10'][0]++,wrap)&&(__cov_s47Xp5yCnwqwdqlXaecyHw.b['10'][1]++,parent.compareTo(root))){__cov_s47Xp5yCnwqwdqlXaecyHw.b['9'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['31']++;divNode=Y.Node.create(EditorBidi.DIV_WRAPPER);__cov_s47Xp5yCnwqwdqlXaecyHw.s['32']++;parent.get('children').each(function(node,index){__cov_s47Xp5yCnwqwdqlXaecyHw.f['8']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['33']++;if(index===0){__cov_s47Xp5yCnwqwdqlXaecyHw.b['11'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['34']++;firstChild=node;}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['11'][1]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['35']++;divNode.append(node);}});__cov_s47Xp5yCnwqwdqlXaecyHw.s['36']++;firstChild.replace(divNode);__cov_s47Xp5yCnwqwdqlXaecyHw.s['37']++;divNode.prepend(firstChild);__cov_s47Xp5yCnwqwdqlXaecyHw.s['38']++;parent=divNode;}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['9'][1]++;}__cov_s47Xp5yCnwqwdqlXaecyHw.s['39']++;return parent;},_NODE_SELECTED:'bidiSelected',addParents:function(nodeArray,root){__cov_s47Xp5yCnwqwdqlXaecyHw.f['9']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['40']++;var i,parent,addParent;__cov_s47Xp5yCnwqwdqlXaecyHw.s['41']++;tester=function(sibling){__cov_s47Xp5yCnwqwdqlXaecyHw.f['10']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['42']++;if(!sibling.getData(EditorBidi._NODE_SELECTED)){__cov_s47Xp5yCnwqwdqlXaecyHw.b['12'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['43']++;addParent=false;__cov_s47Xp5yCnwqwdqlXaecyHw.s['44']++;return true;}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['12'][1]++;}};__cov_s47Xp5yCnwqwdqlXaecyHw.s['45']++;root=(__cov_s47Xp5yCnwqwdqlXaecyHw.b['13'][0]++,root)||(__cov_s47Xp5yCnwqwdqlXaecyHw.b['13'][1]++,Y.EditorSelection.ROOT);__cov_s47Xp5yCnwqwdqlXaecyHw.s['46']++;for(i=0;i<nodeArray.length;i+=1){__cov_s47Xp5yCnwqwdqlXaecyHw.s['47']++;nodeArray[i].setData(EditorBidi._NODE_SELECTED,true);}__cov_s47Xp5yCnwqwdqlXaecyHw.s['48']++;for(i=0;i<nodeArray.length;i+=1){__cov_s47Xp5yCnwqwdqlXaecyHw.s['49']++;parent=nodeArray[i].get('parentNode');__cov_s47Xp5yCnwqwdqlXaecyHw.s['50']++;if((__cov_s47Xp5yCnwqwdqlXaecyHw.b['15'][0]++,!root.compareTo(parent))&&(__cov_s47Xp5yCnwqwdqlXaecyHw.b['15'][1]++,!parent.getData(EditorBidi._NODE_SELECTED))){__cov_s47Xp5yCnwqwdqlXaecyHw.b['14'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['51']++;addParent=true;__cov_s47Xp5yCnwqwdqlXaecyHw.s['52']++;parent.get('children').some(tester);__cov_s47Xp5yCnwqwdqlXaecyHw.s['53']++;if(addParent){__cov_s47Xp5yCnwqwdqlXaecyHw.b['16'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['54']++;nodeArray.push(parent);__cov_s47Xp5yCnwqwdqlXaecyHw.s['55']++;parent.setData(EditorBidi._NODE_SELECTED,true);}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['16'][1]++;}}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['14'][1]++;}}__cov_s47Xp5yCnwqwdqlXaecyHw.s['56']++;for(i=0;i<nodeArray.length;i+=1){__cov_s47Xp5yCnwqwdqlXaecyHw.s['57']++;nodeArray[i].clearData(EditorBidi._NODE_SELECTED);}__cov_s47Xp5yCnwqwdqlXaecyHw.s['58']++;return nodeArray;},NAME:'editorBidi',NS:'editorBidi',ATTRS:{host:{value:false}},RE_TEXT_ALIGN:/text-align:\s*\w*\s*;/,removeTextAlign:function(n){__cov_s47Xp5yCnwqwdqlXaecyHw.f['11']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['59']++;if(n){__cov_s47Xp5yCnwqwdqlXaecyHw.b['17'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['60']++;if(n.getAttribute(STYLE).match(EditorBidi.RE_TEXT_ALIGN)){__cov_s47Xp5yCnwqwdqlXaecyHw.b['18'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['61']++;n.setAttribute(STYLE,n.getAttribute(STYLE).replace(EditorBidi.RE_TEXT_ALIGN,''));}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['18'][1]++;}__cov_s47Xp5yCnwqwdqlXaecyHw.s['62']++;if(n.hasAttribute('align')){__cov_s47Xp5yCnwqwdqlXaecyHw.b['19'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['63']++;n.removeAttribute('align');}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['19'][1]++;}}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['17'][1]++;}__cov_s47Xp5yCnwqwdqlXaecyHw.s['64']++;return n;}});__cov_s47Xp5yCnwqwdqlXaecyHw.s['65']++;Y.namespace('Plugin');__cov_s47Xp5yCnwqwdqlXaecyHw.s['66']++;Y.Plugin.EditorBidi=EditorBidi;__cov_s47Xp5yCnwqwdqlXaecyHw.s['67']++;Y.Plugin.ExecCommand.COMMANDS.bidi=function(cmd,direction){__cov_s47Xp5yCnwqwdqlXaecyHw.f['12']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['68']++;var inst=this.getInstance(),sel=new inst.EditorSelection(),ns=this.get(HOST).get(HOST).editorBidi,returnValue,block,b,root=inst.EditorSelection.ROOT,selected,selectedBlocks,dir;__cov_s47Xp5yCnwqwdqlXaecyHw.s['69']++;if(!ns){__cov_s47Xp5yCnwqwdqlXaecyHw.b['20'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['70']++;Y.error('bidi execCommand is not available without the EditorBiDi plugin.');__cov_s47Xp5yCnwqwdqlXaecyHw.s['71']++;return;}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['20'][1]++;}__cov_s47Xp5yCnwqwdqlXaecyHw.s['72']++;inst.EditorSelection.filterBlocks();__cov_s47Xp5yCnwqwdqlXaecyHw.s['73']++;if(sel.isCollapsed){__cov_s47Xp5yCnwqwdqlXaecyHw.b['21'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['74']++;block=EditorBidi.blockParent(sel.anchorNode,false,root);__cov_s47Xp5yCnwqwdqlXaecyHw.s['75']++;if(!block){__cov_s47Xp5yCnwqwdqlXaecyHw.b['22'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['76']++;block=root.one(inst.EditorSelection.BLOCKS);}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['22'][1]++;}__cov_s47Xp5yCnwqwdqlXaecyHw.s['77']++;block=EditorBidi.removeTextAlign(block);__cov_s47Xp5yCnwqwdqlXaecyHw.s['78']++;if(!direction){__cov_s47Xp5yCnwqwdqlXaecyHw.b['23'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['79']++;dir=block.getAttribute(DIR);__cov_s47Xp5yCnwqwdqlXaecyHw.s['80']++;if((__cov_s47Xp5yCnwqwdqlXaecyHw.b['25'][0]++,!dir)||(__cov_s47Xp5yCnwqwdqlXaecyHw.b['25'][1]++,dir==='ltr')){__cov_s47Xp5yCnwqwdqlXaecyHw.b['24'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['81']++;direction='rtl';}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['24'][1]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['82']++;direction='ltr';}}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['23'][1]++;}__cov_s47Xp5yCnwqwdqlXaecyHw.s['83']++;block.setAttribute(DIR,direction);__cov_s47Xp5yCnwqwdqlXaecyHw.s['84']++;if(Y.UA.ie){__cov_s47Xp5yCnwqwdqlXaecyHw.b['26'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['85']++;b=block.all('br.yui-cursor');__cov_s47Xp5yCnwqwdqlXaecyHw.s['86']++;if((__cov_s47Xp5yCnwqwdqlXaecyHw.b['28'][0]++,b.size()===1)&&(__cov_s47Xp5yCnwqwdqlXaecyHw.b['28'][1]++,block.get('childNodes').size()===1)){__cov_s47Xp5yCnwqwdqlXaecyHw.b['27'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['87']++;b.remove();}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['27'][1]++;}}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['26'][1]++;}__cov_s47Xp5yCnwqwdqlXaecyHw.s['88']++;returnValue=block;}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['21'][1]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['89']++;selected=sel.getSelected();__cov_s47Xp5yCnwqwdqlXaecyHw.s['90']++;selectedBlocks=[];__cov_s47Xp5yCnwqwdqlXaecyHw.s['91']++;selected.each(function(node){__cov_s47Xp5yCnwqwdqlXaecyHw.f['13']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['92']++;selectedBlocks.push(EditorBidi.blockParent(node,false,root));});__cov_s47Xp5yCnwqwdqlXaecyHw.s['93']++;selectedBlocks=inst.all(EditorBidi.addParents(selectedBlocks,root));__cov_s47Xp5yCnwqwdqlXaecyHw.s['94']++;selectedBlocks.each(function(n){__cov_s47Xp5yCnwqwdqlXaecyHw.f['14']++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['95']++;var d=direction;__cov_s47Xp5yCnwqwdqlXaecyHw.s['96']++;n=EditorBidi.removeTextAlign(n);__cov_s47Xp5yCnwqwdqlXaecyHw.s['97']++;if(!d){__cov_s47Xp5yCnwqwdqlXaecyHw.b['29'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['98']++;dir=n.getAttribute(DIR);__cov_s47Xp5yCnwqwdqlXaecyHw.s['99']++;if((__cov_s47Xp5yCnwqwdqlXaecyHw.b['31'][0]++,!dir)||(__cov_s47Xp5yCnwqwdqlXaecyHw.b['31'][1]++,dir==='ltr')){__cov_s47Xp5yCnwqwdqlXaecyHw.b['30'][0]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['100']++;d='rtl';}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['30'][1]++;__cov_s47Xp5yCnwqwdqlXaecyHw.s['101']++;d='ltr';}}else{__cov_s47Xp5yCnwqwdqlXaecyHw.b['29'][1]++;}__cov_s47Xp5yCnwqwdqlXaecyHw.s['102']++;n.setAttribute(DIR,d);});__cov_s47Xp5yCnwqwdqlXaecyHw.s['103']++;returnValue=selectedBlocks;}__cov_s47Xp5yCnwqwdqlXaecyHw.s['104']++;ns._checkForChange();__cov_s47Xp5yCnwqwdqlXaecyHw.s['105']++;return returnValue;};},'3.13.0',{'requires':['editor-base']});