10
__coverage__['build/widget-htmlparser/widget-htmlparser.js'] = {"path":"build/widget-htmlparser/widget-htmlparser.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},"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]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0},"fnMap":{"1":{"name":"(anonymous_1)","line":1,"loc":{"start":{"line":1,"column":29},"end":{"line":1,"column":48}}},"2":{"name":"(anonymous_2)","line":81,"loc":{"start":{"line":81,"column":18},"end":{"line":81,"column":32}}},"3":{"name":"(anonymous_3)","line":102,"loc":{"start":{"line":102,"column":19},"end":{"line":102,"column":51}}},"4":{"name":"(anonymous_4)","line":128,"loc":{"start":{"line":128,"column":25},"end":{"line":128,"column":56}}},"5":{"name":"(anonymous_5)","line":140,"loc":{"start":{"line":140,"column":19},"end":{"line":140,"column":36}}},"6":{"name":"(anonymous_6)","line":149,"loc":{"start":{"line":149,"column":34},"end":{"line":149,"column":52}}},"7":{"name":"(anonymous_7)","line":184,"loc":{"start":{"line":184,"column":22},"end":{"line":184,"column":33}}},"8":{"name":"(anonymous_8)","line":197,"loc":{"start":{"line":197,"column":21},"end":{"line":197,"column":32}}}},"statementMap":{"1":{"start":{"line":1,"column":0},"end":{"line":215,"column":44}},"2":{"start":{"line":11,"column":0},"end":{"line":16,"column":31}},"3":{"start":{"line":41,"column":0},"end":{"line":41,"column":24}},"4":{"start":{"line":56,"column":0},"end":{"line":58,"column":2}},"5":{"start":{"line":67,"column":0},"end":{"line":72,"column":2}},"6":{"start":{"line":74,"column":0},"end":{"line":212,"column":3}},"7":{"start":{"line":82,"column":8},"end":{"line":82,"column":44}},"8":{"start":{"line":104,"column":8},"end":{"line":109,"column":10}},"9":{"start":{"line":111,"column":8},"end":{"line":111,"column":48}},"10":{"start":{"line":113,"column":8},"end":{"line":113,"column":33}},"11":{"start":{"line":114,"column":8},"end":{"line":114,"column":32}},"12":{"start":{"line":115,"column":8},"end":{"line":115,"column":29}},"13":{"start":{"line":116,"column":8},"end":{"line":116,"column":24}},"14":{"start":{"line":118,"column":8},"end":{"line":120,"column":9}},"15":{"start":{"line":119,"column":12},"end":{"line":119,"column":40}},"16":{"start":{"line":129,"column":8},"end":{"line":129,"column":64}},"17":{"start":{"line":142,"column":8},"end":{"line":146,"column":16}},"18":{"start":{"line":148,"column":8},"end":{"line":170,"column":9}},"19":{"start":{"line":149,"column":12},"end":{"line":169,"column":15}},"20":{"start":{"line":150,"column":16},"end":{"line":150,"column":27}},"21":{"start":{"line":152,"column":16},"end":{"line":163,"column":17}},"22":{"start":{"line":153,"column":20},"end":{"line":153,"column":50}},"23":{"start":{"line":155,"column":20},"end":{"line":162,"column":21}},"24":{"start":{"line":156,"column":24},"end":{"line":156,"column":48}},"25":{"start":{"line":157,"column":24},"end":{"line":159,"column":25}},"26":{"start":{"line":158,"column":28},"end":{"line":158,"column":39}},"27":{"start":{"line":161,"column":24},"end":{"line":161,"column":45}},"28":{"start":{"line":165,"column":16},"end":{"line":168,"column":17}},"29":{"start":{"line":166,"column":20},"end":{"line":166,"column":54}},"30":{"start":{"line":167,"column":20},"end":{"line":167,"column":42}},"31":{"start":{"line":171,"column":8},"end":{"line":171,"column":74}},"32":{"start":{"line":185,"column":8},"end":{"line":185,"column":42}},"33":{"start":{"line":186,"column":8},"end":{"line":186,"column":56}},"34":{"start":{"line":200,"column":8},"end":{"line":202,"column":17}},"35":{"start":{"line":204,"column":8},"end":{"line":209,"column":9}},"36":{"start":{"line":205,"column":12},"end":{"line":205,"column":39}},"37":{"start":{"line":206,"column":12},"end":{"line":208,"column":13}},"38":{"start":{"line":207,"column":16},"end":{"line":207,"column":39}},"39":{"start":{"line":210,"column":8},"end":{"line":210,"column":22}}},"branchMap":{"1":{"line":82,"type":"binary-expr","locations":[{"start":{"line":82,"column":15},"end":{"line":82,"column":18}},{"start":{"line":82,"column":22},"end":{"line":82,"column":43}}]},"2":{"line":118,"type":"if","locations":[{"start":{"line":118,"column":8},"end":{"line":118,"column":8}},{"start":{"line":118,"column":8},"end":{"line":118,"column":8}}]},"3":{"line":129,"type":"cond-expr","locations":[{"start":{"line":129,"column":29},"end":{"line":129,"column":57}},{"start":{"line":129,"column":60},"end":{"line":129,"column":63}}]},"4":{"line":148,"type":"if","locations":[{"start":{"line":148,"column":8},"end":{"line":148,"column":8}},{"start":{"line":148,"column":8},"end":{"line":148,"column":8}}]},"5":{"line":148,"type":"binary-expr","locations":[{"start":{"line":148,"column":12},"end":{"line":148,"column":18}},{"start":{"line":148,"column":22},"end":{"line":148,"column":29}}]},"6":{"line":152,"type":"if","locations":[{"start":{"line":152,"column":16},"end":{"line":152,"column":16}},{"start":{"line":152,"column":16},"end":{"line":152,"column":16}}]},"7":{"line":155,"type":"if","locations":[{"start":{"line":155,"column":20},"end":{"line":155,"column":20}},{"start":{"line":155,"column":20},"end":{"line":155,"column":20}}]},"8":{"line":157,"type":"if","locations":[{"start":{"line":157,"column":24},"end":{"line":157,"column":24}},{"start":{"line":157,"column":24},"end":{"line":157,"column":24}}]},"9":{"line":165,"type":"if","locations":[{"start":{"line":165,"column":16},"end":{"line":165,"column":16}},{"start":{"line":165,"column":16},"end":{"line":165,"column":16}}]},"10":{"line":165,"type":"binary-expr","locations":[{"start":{"line":165,"column":20},"end":{"line":165,"column":32}},{"start":{"line":165,"column":36},"end":{"line":165,"column":53}}]},"11":{"line":166,"type":"binary-expr","locations":[{"start":{"line":166,"column":35},"end":{"line":166,"column":47}},{"start":{"line":166,"column":51},"end":{"line":166,"column":53}}]},"12":{"line":186,"type":"cond-expr","locations":[{"start":{"line":186,"column":41},"end":{"line":186,"column":48}},{"start":{"line":186,"column":51},"end":{"line":186,"column":55}}]},"13":{"line":206,"type":"if","locations":[{"start":{"line":206,"column":12},"end":{"line":206,"column":12}},{"start":{"line":206,"column":12},"end":{"line":206,"column":12}}]}},"code":["(function () { YUI.add('widget-htmlparser', function (Y, NAME) {","","/**"," * Adds HTML Parser support to the base Widget class"," *"," * @module widget"," * @submodule widget-htmlparser"," * @for Widget"," */","","var Widget = Y.Widget,"," Node = Y.Node,"," Lang = Y.Lang,",""," SRC_NODE = \"srcNode\","," CONTENT_BOX = \"contentBox\";","","/**"," * Object hash, defining how attribute values are to be parsed from"," * markup contained in the widget's content box. e.g.:"," * <pre>"," * {"," * // Set single Node references using selector syntax"," * // (selector is run through node.one)"," * titleNode: \"span.yui-title\","," * // Set NodeList references using selector syntax"," * // (array indicates selector is to be run through node.all)"," * listNodes: [\"li.yui-item\"],"," * // Set other attribute types, using a parse function."," * // Context is set to the widget instance."," * label: function(contentBox) {"," * return contentBox.one(\"span.title\").get(\"innerHTML\");"," * }"," * }"," * </pre>"," *"," * @property HTML_PARSER"," * @type Object"," * @static"," */","Widget.HTML_PARSER = {};","","/**"," * The build configuration for the Widget class."," * <p>"," * Defines the static fields which need to be aggregated,"," * when this class is used as the main class passed to"," * the <a href=\"Base.html#method_build\">Base.build</a> method."," * </p>"," * @property _buildCfg"," * @type Object"," * @static"," * @final"," * @private"," */","Widget._buildCfg = {"," aggregates : [\"HTML_PARSER\"]","};","","/**"," * The DOM node to parse for configuration values, passed to the Widget's HTML_PARSER definition"," *"," * @attribute srcNode"," * @type String | Node"," * @writeOnce"," */","Widget.ATTRS[SRC_NODE] = {"," value: null,"," setter: Node.one,"," getter: \"_getSrcNode\","," writeOnce: true","};","","Y.mix(Widget.prototype, {",""," /**"," * @method _getSrcNode"," * @protected"," * @return {Node} The Node to apply HTML_PARSER to"," */"," _getSrcNode : function(val) {"," return val || this.get(CONTENT_BOX);"," },",""," /**"," * Implement the BaseCore _preAddAttrs method hook, to add"," * the srcNode and related attributes, so that HTML_PARSER"," * (which relies on `this.get(\"srcNode\")`) can merge in it's"," * results before the rest of the attributes are added."," *"," * @method _preAddAttrs"," * @protected"," *"," * @param attrs {Object} The full hash of statically defined ATTRS"," * attributes being added for this instance"," *"," * @param userVals {Object} The hash of user values passed to"," * the constructor"," *"," * @param lazy {boolean} Whether or not to add the attributes lazily"," */"," _preAddAttrs : function(attrs, userVals, lazy) {",""," var preAttrs = {"," id : attrs.id,"," boundingBox : attrs.boundingBox,"," contentBox : attrs.contentBox,"," srcNode : attrs.srcNode"," };",""," this.addAttrs(preAttrs, userVals, lazy);",""," delete attrs.boundingBox;"," delete attrs.contentBox;"," delete attrs.srcNode;"," delete attrs.id;",""," if (this._applyParser) {"," this._applyParser(userVals);"," }"," },",""," /**"," * @method _applyParsedConfig"," * @protected"," * @return {Object} The merged configuration literal"," */"," _applyParsedConfig : function(node, cfg, parsedCfg) {"," return (parsedCfg) ? Y.mix(cfg, parsedCfg, false) : cfg;"," },",""," /**"," * Utility method used to apply the <code>HTML_PARSER</code> configuration for the"," * instance, to retrieve config data values."," *"," * @method _applyParser"," * @protected"," * @param config {Object} User configuration object (will be populated with values from Node)"," */"," _applyParser : function(config) {",""," var widget = this,"," srcNode = this._getNodeToParse(),"," schema = widget._getHtmlParser(),"," parsedConfig,"," val;",""," if (schema && srcNode) {"," Y.Object.each(schema, function(v, k, o) {"," val = null;",""," if (Lang.isFunction(v)) {"," val = v.call(widget, srcNode);"," } else {"," if (Lang.isArray(v)) {"," val = srcNode.all(v[0]);"," if (val.isEmpty()) {"," val = null;"," }"," } else {"," val = srcNode.one(v);"," }"," }",""," if (val !== null && val !== undefined) {"," parsedConfig = parsedConfig || {};"," parsedConfig[k] = val;"," }"," });"," }"," config = widget._applyParsedConfig(srcNode, config, parsedConfig);"," },",""," /**"," * Determines whether we have a node reference which we should try and parse."," *"," * The current implementation does not parse nodes generated from CONTENT_TEMPLATE,"," * only explicitly set srcNode, or contentBox attributes."," *"," * @method _getNodeToParse"," * @return {Node} The node reference to apply HTML_PARSER to."," * @private"," */"," _getNodeToParse : function() {"," var srcNode = this.get(\"srcNode\");"," return (!this._cbFromTemplate) ? srcNode : null;"," },",""," /**"," * Gets the HTML_PARSER definition for this instance, by merging HTML_PARSER"," * definitions across the class hierarchy."," *"," * @private"," * @method _getHtmlParser"," * @return {Object} HTML_PARSER definition for this instance"," */"," _getHtmlParser : function() {"," // Removed caching for kweight. This is a private method"," // and only called once so don't need to cache HTML_PARSER"," var classes = this._getClasses(),"," parser = {},"," i, p;",""," for (i = classes.length - 1; i >= 0; i--) {"," p = classes[i].HTML_PARSER;"," if (p) {"," Y.mix(parser, p, true);"," }"," }"," return parser;"," }","});","","","}, '3.13.0', {\"requires\": [\"widget-base\"]});","","}());"]};