| {"./given.js":{"path":"./given.js","s":{"1":1,"2":7,"3":1,"4":1,"5":4,"6":4,"7":4,"8":1,"9":9,"10":4,"11":2,"12":0,"13":0,"14":2,"15":1,"16":1,"17":1,"18":1,"19":1,"20":1,"21":2,"22":0,"23":0,"24":2,"25":2,"26":16,"27":16,"28":12,"29":4,"30":4,"31":0,"32":4,"33":4,"34":0,"35":4,"36":0,"37":0,"38":0,"39":2,"40":2,"41":2,"42":0,"43":0,"44":2,"45":0,"46":12,"47":12,"48":0,"49":105,"50":0,"51":13,"52":0,"53":10,"54":0,"55":1,"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":5,"87":5,"88":5,"89":0,"90":0,"91":5,"92":5,"93":6,"94":6,"95":0,"96":6,"97":6,"98":6,"99":0,"100":6,"101":2,"102":2,"103":0,"104":6,"105":5,"106":0,"107":1,"108":1,"109":1,"110":1,"111":1,"112":1,"113":0,"114":1,"115":1,"116":0,"117":1,"118":1,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":1,"126":9,"127":9,"128":0,"129":2,"130":32,"131":32,"132":0,"133":2,"134":6,"135":6,"136":0,"137":10,"138":0,"139":13,"140":0,"141":39,"142":39,"143":39,"144":7,"145":11,"146":5,"147":16,"148":11,"149":16,"150":0,"151":26,"152":26,"153":0,"154":19,"155":0,"156":82,"157":67,"158":65,"159":2,"160":2,"161":0,"162":65,"163":2,"164":65,"165":65,"166":65,"167":65,"168":65,"169":65,"170":0,"171":65,"172":82,"173":82,"174":82,"175":82,"176":0,"177":82,"178":2,"179":7,"180":7,"181":7,"182":2,"183":80,"184":0,"185":80,"186":59,"187":21,"188":8,"189":8,"190":1,"191":7,"192":13,"193":12,"194":12,"195":14,"196":14,"197":3,"198":11,"199":9,"200":1,"201":1,"202":0},"b":{"1":[6,1],"2":[1,3],"3":[0,2],"4":[2,0,0],"5":[1,1],"6":[1,0],"7":[1,1],"8":[1,0],"9":[0,2],"10":[2,0,0],"11":[0,0],"12":[12,4],"13":[0,4],"14":[0,4],"15":[0,0],"16":[2,0],"17":[0,2],"18":[0,1],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0,0],"23":[0,0],"24":[5,0],"25":[5,1],"26":[5,0],"27":[5,4],"28":[5,3],"29":[0,6],"30":[2,4],"31":[1,0],"32":[1,0],"33":[0,1],"34":[1,0],"35":[1,1],"36":[0,1],"37":[1,0],"38":[9,5],"39":[28,4],"40":[3,3],"41":[27,12],"42":[7,11,5,16],"43":[12,14],"44":[12,3],"45":[65,2,0],"46":[2,0],"47":[2,1],"48":[2,63],"49":[65,0],"50":[0,65],"51":[82,0],"52":[54,28],"53":[82,30],"54":[0,82],"55":[82,82],"56":[2,80],"57":[7,0],"58":[0,80],"59":[80,80],"60":[59,21],"61":[8,13],"62":[1,7],"63":[8,8],"64":[12,1],"65":[3,11],"66":[0,1]},"f":{"1":7,"2":1,"3":0,"4":12,"5":105,"6":13,"7":10,"8":1,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":5,"17":5,"18":6,"19":1,"20":1,"21":9,"22":2,"23":32,"24":2,"25":6,"26":10,"27":13,"28":39,"29":26,"30":19,"31":82,"32":67},"fnMap":{"1":{"name":"given","line":106,"loc":{"start":{"line":106,"column":0},"end":{"line":106,"column":30}}},"2":{"name":"(anonymous_2)","line":109,"loc":{"start":{"line":109,"column":42},"end":{"line":109,"column":54}}},"3":{"name":"(anonymous_3)","line":192,"loc":{"start":{"line":192,"column":44},"end":{"line":192,"column":55}}},"4":{"name":"get","line":197,"loc":{"start":{"line":197,"column":2},"end":{"line":197,"column":18}}},"5":{"name":"isArray","line":198,"loc":{"start":{"line":198,"column":2},"end":{"line":198,"column":23}}},"6":{"name":"isObject","line":199,"loc":{"start":{"line":199,"column":2},"end":{"line":199,"column":23}}},"7":{"name":"array","line":200,"loc":{"start":{"line":200,"column":2},"end":{"line":200,"column":23}}},"8":{"name":"arrayify","line":201,"loc":{"start":{"line":201,"column":2},"end":{"line":201,"column":23}}},"9":{"name":"inject","line":202,"loc":{"start":{"line":202,"column":2},"end":{"line":202,"column":28}}},"10":{"name":"initPushState","line":211,"loc":{"start":{"line":211,"column":2},"end":{"line":211,"column":47}}},"11":{"name":"(anonymous_11)","line":213,"loc":{"start":{"line":213,"column":13},"end":{"line":213,"column":34}}},"12":{"name":"reportBack","line":214,"loc":{"start":{"line":214,"column":8},"end":{"line":214,"column":30}}},"13":{"name":"given_pushState","line":220,"loc":{"start":{"line":220,"column":28},"end":{"line":220,"column":55}}},"14":{"name":"after_pushState","line":231,"loc":{"start":{"line":231,"column":12},"end":{"line":231,"column":39}}},"15":{"name":"(anonymous_15)","line":238,"loc":{"start":{"line":238,"column":51},"end":{"line":238,"column":62}}},"16":{"name":"test_query","line":244,"loc":{"start":{"line":244,"column":2},"end":{"line":244,"column":28}}},"17":{"name":"unparam","line":250,"loc":{"start":{"line":250,"column":2},"end":{"line":250,"column":26}}},"18":{"name":"(anonymous_18)","line":252,"loc":{"start":{"line":252,"column":59},"end":{"line":252,"column":72}}},"19":{"name":"test_regexp","line":264,"loc":{"start":{"line":264,"column":2},"end":{"line":264,"column":29}}},"20":{"name":"truthy","line":280,"loc":{"start":{"line":280,"column":2},"end":{"line":280,"column":22}}},"21":{"name":"(anonymous_21)","line":280,"loc":{"start":{"line":280,"column":31},"end":{"line":280,"column":43}}},"22":{"name":"not_null","line":284,"loc":{"start":{"line":284,"column":2},"end":{"line":284,"column":24}}},"23":{"name":"(anonymous_23)","line":284,"loc":{"start":{"line":284,"column":33},"end":{"line":284,"column":45}}},"24":{"name":"one_or_more","line":288,"loc":{"start":{"line":288,"column":2},"end":{"line":288,"column":27}}},"25":{"name":"(anonymous_25)","line":288,"loc":{"start":{"line":288,"column":36},"end":{"line":288,"column":48}}},"26":{"name":"$c","line":292,"loc":{"start":{"line":292,"column":2},"end":{"line":292,"column":19}}},"27":{"name":"$C","line":293,"loc":{"start":{"line":293,"column":2},"end":{"line":293,"column":19}}},"28":{"name":"$x","line":295,"loc":{"start":{"line":295,"column":2},"end":{"line":295,"column":21}}},"29":{"name":"$X","line":305,"loc":{"start":{"line":305,"column":2},"end":{"line":305,"column":21}}},"30":{"name":"quoteRe","line":310,"loc":{"start":{"line":310,"column":2},"end":{"line":310,"column":22}}},"31":{"name":"test_dom","line":318,"loc":{"start":{"line":318,"column":2},"end":{"line":318,"column":35}}},"32":{"name":"lookup","line":322,"loc":{"start":{"line":322,"column":4},"end":{"line":322,"column":26}}}},"statementMap":{"1":{"start":{"line":106,"column":0},"end":{"line":378,"column":1}},"2":{"start":{"line":107,"column":2},"end":{"line":149,"column":4}},"3":{"start":{"line":110,"column":8},"end":{"line":128,"column":10}},"4":{"start":{"line":130,"column":8},"end":{"line":137,"column":9}},"5":{"start":{"line":131,"column":10},"end":{"line":131,"column":29}},"6":{"start":{"line":132,"column":10},"end":{"line":132,"column":23}},"7":{"start":{"line":133,"column":10},"end":{"line":135,"column":34}},"8":{"start":{"line":134,"column":12},"end":{"line":135,"column":34}},"9":{"start":{"line":135,"column":14},"end":{"line":135,"column":34}},"10":{"start":{"line":136,"column":10},"end":{"line":136,"column":27}},"11":{"start":{"line":151,"column":2},"end":{"line":156,"column":3}},"12":{"start":{"line":154,"column":4},"end":{"line":154,"column":31}},"13":{"start":{"line":155,"column":4},"end":{"line":155,"column":76}},"14":{"start":{"line":158,"column":2},"end":{"line":165,"column":11}},"15":{"start":{"line":159,"column":4},"end":{"line":165,"column":11}},"16":{"start":{"line":160,"column":6},"end":{"line":165,"column":11}},"17":{"start":{"line":161,"column":8},"end":{"line":165,"column":11}},"18":{"start":{"line":162,"column":10},"end":{"line":165,"column":11}},"19":{"start":{"line":163,"column":12},"end":{"line":163,"column":41}},"20":{"start":{"line":164,"column":12},"end":{"line":164,"column":40}},"21":{"start":{"line":167,"column":2},"end":{"line":171,"column":3}},"22":{"start":{"line":169,"column":4},"end":{"line":169,"column":31}},"23":{"start":{"line":170,"column":4},"end":{"line":170,"column":41}},"24":{"start":{"line":173,"column":2},"end":{"line":187,"column":3}},"25":{"start":{"line":174,"column":4},"end":{"line":182,"column":5}},"26":{"start":{"line":175,"column":6},"end":{"line":175,"column":25}},"27":{"start":{"line":176,"column":6},"end":{"line":176,"column":39}},"28":{"start":{"line":176,"column":30},"end":{"line":176,"column":39}},"29":{"start":{"line":177,"column":6},"end":{"line":177,"column":25}},"30":{"start":{"line":178,"column":6},"end":{"line":178,"column":68}},"31":{"start":{"line":178,"column":17},"end":{"line":178,"column":68}},"32":{"start":{"line":179,"column":6},"end":{"line":179,"column":26}},"33":{"start":{"line":180,"column":6},"end":{"line":180,"column":40}},"34":{"start":{"line":180,"column":27},"end":{"line":180,"column":40}},"35":{"start":{"line":181,"column":6},"end":{"line":181,"column":25}},"36":{"start":{"line":185,"column":4},"end":{"line":185,"column":80}},"37":{"start":{"line":185,"column":15},"end":{"line":185,"column":80}},"38":{"start":{"line":186,"column":4},"end":{"line":186,"column":17}},"39":{"start":{"line":189,"column":2},"end":{"line":191,"column":3}},"40":{"start":{"line":190,"column":4},"end":{"line":190,"column":38}},"41":{"start":{"line":192,"column":2},"end":{"line":194,"column":5}},"42":{"start":{"line":192,"column":12},"end":{"line":194,"column":5}},"43":{"start":{"line":193,"column":4},"end":{"line":193,"column":37}},"44":{"start":{"line":195,"column":2},"end":{"line":195,"column":28}},"45":{"start":{"line":197,"column":2},"end":{"line":197,"column":59}},"46":{"start":{"line":197,"column":20},"end":{"line":197,"column":41}},"47":{"start":{"line":197,"column":42},"end":{"line":197,"column":57}},"48":{"start":{"line":198,"column":2},"end":{"line":198,"column":79}},"49":{"start":{"line":198,"column":25},"end":{"line":198,"column":77}},"50":{"start":{"line":199,"column":2},"end":{"line":199,"column":80}},"51":{"start":{"line":199,"column":25},"end":{"line":199,"column":78}},"52":{"start":{"line":200,"column":2},"end":{"line":200,"column":57}},"53":{"start":{"line":200,"column":25},"end":{"line":200,"column":55}},"54":{"start":{"line":201,"column":2},"end":{"line":201,"column":55}},"55":{"start":{"line":201,"column":25},"end":{"line":201,"column":53}},"56":{"start":{"line":202,"column":2},"end":{"line":209,"column":3}},"57":{"start":{"line":203,"column":4},"end":{"line":204,"column":42}},"58":{"start":{"line":205,"column":4},"end":{"line":205,"column":51}},"59":{"start":{"line":206,"column":4},"end":{"line":206,"column":51}},"60":{"start":{"line":207,"column":4},"end":{"line":207,"column":31}},"61":{"start":{"line":208,"column":4},"end":{"line":208,"column":31}},"62":{"start":{"line":211,"column":2},"end":{"line":242,"column":3}},"63":{"start":{"line":212,"column":4},"end":{"line":229,"column":5}},"64":{"start":{"line":213,"column":6},"end":{"line":227,"column":23}},"65":{"start":{"line":214,"column":8},"end":{"line":218,"column":9}},"66":{"start":{"line":215,"column":10},"end":{"line":215,"column":49}},"67":{"start":{"line":216,"column":10},"end":{"line":216,"column":70}},"68":{"start":{"line":217,"column":10},"end":{"line":217,"column":36}},"69":{"start":{"line":219,"column":8},"end":{"line":219,"column":42}},"70":{"start":{"line":220,"column":8},"end":{"line":226,"column":10}},"71":{"start":{"line":221,"column":10},"end":{"line":224,"column":38}},"72":{"start":{"line":222,"column":12},"end":{"line":222,"column":52}},"73":{"start":{"line":224,"column":12},"end":{"line":224,"column":38}},"74":{"start":{"line":225,"column":10},"end":{"line":225,"column":50}},"75":{"start":{"line":228,"column":6},"end":{"line":228,"column":43}},"76":{"start":{"line":231,"column":4},"end":{"line":236,"column":6}},"77":{"start":{"line":232,"column":6},"end":{"line":232,"column":34}},"78":{"start":{"line":233,"column":6},"end":{"line":233,"column":47}},"79":{"start":{"line":234,"column":6},"end":{"line":234,"column":29}},"80":{"start":{"line":235,"column":6},"end":{"line":235,"column":19}},"81":{"start":{"line":238,"column":4},"end":{"line":241,"column":14}},"82":{"start":{"line":239,"column":6},"end":{"line":239,"column":67}},"83":{"start":{"line":239,"column":17},"end":{"line":239,"column":67}},"84":{"start":{"line":240,"column":6},"end":{"line":240,"column":14}},"85":{"start":{"line":244,"column":2},"end":{"line":248,"column":3}},"86":{"start":{"line":245,"column":4},"end":{"line":245,"column":80}},"87":{"start":{"line":246,"column":4},"end":{"line":246,"column":48}},"88":{"start":{"line":246,"column":39},"end":{"line":246,"column":48}},"89":{"start":{"line":247,"column":4},"end":{"line":247,"column":66}},"90":{"start":{"line":250,"column":2},"end":{"line":262,"column":3}},"91":{"start":{"line":251,"column":4},"end":{"line":251,"column":18}},"92":{"start":{"line":252,"column":4},"end":{"line":260,"column":7}},"93":{"start":{"line":253,"column":6},"end":{"line":253,"column":45}},"94":{"start":{"line":254,"column":6},"end":{"line":254,"column":22}},"95":{"start":{"line":254,"column":15},"end":{"line":254,"column":22}},"96":{"start":{"line":255,"column":6},"end":{"line":255,"column":48}},"97":{"start":{"line":256,"column":6},"end":{"line":256,"column":77}},"98":{"start":{"line":256,"column":12},"end":{"line":256,"column":41}},"99":{"start":{"line":256,"column":56},"end":{"line":256,"column":75}},"100":{"start":{"line":257,"column":6},"end":{"line":258,"column":77}},"101":{"start":{"line":258,"column":8},"end":{"line":258,"column":77}},"102":{"start":{"line":258,"column":14},"end":{"line":258,"column":42}},"103":{"start":{"line":258,"column":57},"end":{"line":258,"column":75}},"104":{"start":{"line":259,"column":6},"end":{"line":259,"column":23}},"105":{"start":{"line":261,"column":4},"end":{"line":261,"column":16}},"106":{"start":{"line":264,"column":2},"end":{"line":278,"column":3}},"107":{"start":{"line":265,"column":4},"end":{"line":265,"column":46}},"108":{"start":{"line":265,"column":24},"end":{"line":265,"column":46}},"109":{"start":{"line":266,"column":4},"end":{"line":266,"column":26}},"110":{"start":{"line":267,"column":4},"end":{"line":267,"column":52}},"111":{"start":{"line":267,"column":32},"end":{"line":267,"column":52}},"112":{"start":{"line":268,"column":4},"end":{"line":269,"column":62}},"113":{"start":{"line":269,"column":6},"end":{"line":269,"column":62}},"114":{"start":{"line":271,"column":4},"end":{"line":271,"column":79}},"115":{"start":{"line":272,"column":4},"end":{"line":272,"column":33}},"116":{"start":{"line":272,"column":21},"end":{"line":272,"column":33}},"117":{"start":{"line":273,"column":4},"end":{"line":273,"column":32}},"118":{"start":{"line":273,"column":22},"end":{"line":273,"column":32}},"119":{"start":{"line":274,"column":4},"end":{"line":274,"column":19}},"120":{"start":{"line":275,"column":4},"end":{"line":275,"column":15}},"121":{"start":{"line":276,"column":4},"end":{"line":276,"column":57}},"122":{"start":{"line":276,"column":24},"end":{"line":276,"column":57}},"123":{"start":{"line":277,"column":4},"end":{"line":277,"column":17}},"124":{"start":{"line":280,"column":2},"end":{"line":282,"column":6}},"125":{"start":{"line":280,"column":24},"end":{"line":282,"column":4}},"126":{"start":{"line":281,"column":4},"end":{"line":281,"column":38}},"127":{"start":{"line":281,"column":39},"end":{"line":281,"column":56}},"128":{"start":{"line":284,"column":2},"end":{"line":286,"column":6}},"129":{"start":{"line":284,"column":26},"end":{"line":286,"column":4}},"130":{"start":{"line":285,"column":4},"end":{"line":285,"column":38}},"131":{"start":{"line":285,"column":39},"end":{"line":285,"column":68}},"132":{"start":{"line":288,"column":2},"end":{"line":290,"column":6}},"133":{"start":{"line":288,"column":29},"end":{"line":290,"column":4}},"134":{"start":{"line":289,"column":4},"end":{"line":289,"column":38}},"135":{"start":{"line":289,"column":39},"end":{"line":289,"column":66}},"136":{"start":{"line":292,"column":2},"end":{"line":292,"column":64}},"137":{"start":{"line":292,"column":21},"end":{"line":292,"column":62}},"138":{"start":{"line":293,"column":2},"end":{"line":293,"column":54}},"139":{"start":{"line":293,"column":21},"end":{"line":293,"column":52}},"140":{"start":{"line":295,"column":2},"end":{"line":304,"column":3}},"141":{"start":{"line":296,"column":4},"end":{"line":296,"column":62}},"142":{"start":{"line":297,"column":4},"end":{"line":297,"column":65}},"143":{"start":{"line":298,"column":4},"end":{"line":303,"column":5}},"144":{"start":{"line":299,"column":42},"end":{"line":299,"column":65}},"145":{"start":{"line":300,"column":42},"end":{"line":300,"column":65}},"146":{"start":{"line":301,"column":42},"end":{"line":301,"column":66}},"147":{"start":{"line":302,"column":15},"end":{"line":302,"column":65}},"148":{"start":{"line":302,"column":50},"end":{"line":302,"column":65}},"149":{"start":{"line":302,"column":66},"end":{"line":302,"column":77}},"150":{"start":{"line":305,"column":2},"end":{"line":308,"column":3}},"151":{"start":{"line":306,"column":4},"end":{"line":306,"column":35}},"152":{"start":{"line":307,"column":4},"end":{"line":307,"column":55}},"153":{"start":{"line":310,"column":2},"end":{"line":310,"column":78}},"154":{"start":{"line":310,"column":24},"end":{"line":310,"column":76}},"155":{"start":{"line":318,"column":2},"end":{"line":377,"column":3}},"156":{"start":{"line":322,"column":4},"end":{"line":339,"column":5}},"157":{"start":{"line":323,"column":6},"end":{"line":328,"column":7}},"158":{"start":{"line":324,"column":23},"end":{"line":324,"column":29}},"159":{"start":{"line":325,"column":23},"end":{"line":325,"column":74}},"160":{"start":{"line":325,"column":62},"end":{"line":325,"column":74}},"161":{"start":{"line":327,"column":17},"end":{"line":327,"column":70}},"162":{"start":{"line":329,"column":6},"end":{"line":330,"column":69}},"163":{"start":{"line":329,"column":34},"end":{"line":330,"column":69}},"164":{"start":{"line":331,"column":6},"end":{"line":331,"column":63}},"165":{"start":{"line":332,"column":6},"end":{"line":336,"column":7}},"166":{"start":{"line":333,"column":8},"end":{"line":333,"column":24}},"167":{"start":{"line":334,"column":8},"end":{"line":334,"column":24}},"168":{"start":{"line":335,"column":8},"end":{"line":335,"column":30}},"169":{"start":{"line":337,"column":6},"end":{"line":337,"column":78}},"170":{"start":{"line":337,"column":17},"end":{"line":337,"column":78}},"171":{"start":{"line":338,"column":6},"end":{"line":338,"column":35}},"172":{"start":{"line":341,"column":4},"end":{"line":341,"column":42}},"173":{"start":{"line":342,"column":4},"end":{"line":344,"column":5}},"174":{"start":{"line":343,"column":6},"end":{"line":343,"column":68}},"175":{"start":{"line":347,"column":4},"end":{"line":347,"column":58}},"176":{"start":{"line":347,"column":46},"end":{"line":347,"column":58}},"177":{"start":{"line":348,"column":4},"end":{"line":355,"column":5}},"178":{"start":{"line":349,"column":6},"end":{"line":353,"column":7}},"179":{"start":{"line":350,"column":8},"end":{"line":350,"column":49}},"180":{"start":{"line":351,"column":8},"end":{"line":352,"column":31}},"181":{"start":{"line":352,"column":10},"end":{"line":352,"column":31}},"182":{"start":{"line":354,"column":6},"end":{"line":354,"column":21}},"183":{"start":{"line":356,"column":4},"end":{"line":357,"column":52}},"184":{"start":{"line":357,"column":6},"end":{"line":357,"column":52}},"185":{"start":{"line":360,"column":4},"end":{"line":360,"column":68}},"186":{"start":{"line":360,"column":34},"end":{"line":360,"column":68}},"187":{"start":{"line":361,"column":4},"end":{"line":365,"column":5}},"188":{"start":{"line":362,"column":6},"end":{"line":362,"column":46}},"189":{"start":{"line":363,"column":6},"end":{"line":363,"column":63}},"190":{"start":{"line":363,"column":48},"end":{"line":363,"column":63}},"191":{"start":{"line":364,"column":6},"end":{"line":364,"column":45}},"192":{"start":{"line":366,"column":4},"end":{"line":374,"column":5}},"193":{"start":{"line":367,"column":6},"end":{"line":367,"column":19}},"194":{"start":{"line":368,"column":6},"end":{"line":372,"column":7}},"195":{"start":{"line":369,"column":8},"end":{"line":369,"column":61}},"196":{"start":{"line":370,"column":8},"end":{"line":370,"column":41}},"197":{"start":{"line":370,"column":29},"end":{"line":370,"column":41}},"198":{"start":{"line":371,"column":8},"end":{"line":371,"column":40}},"199":{"start":{"line":373,"column":6},"end":{"line":373,"column":21}},"200":{"start":{"line":376,"column":4},"end":{"line":376,"column":79}},"201":{"start":{"line":380,"column":0},"end":{"line":380,"column":45}},"202":{"start":{"line":380,"column":22},"end":{"line":380,"column":45}}},"branchMap":{"1":{"line":109,"type":"cond-expr","locations":[{"start":{"line":109,"column":30},"end":{"line":109,"column":39}},{"start":{"line":109,"column":42},"end":{"line":138,"column":10}}]},"2":{"line":133,"type":"if","locations":[{"start":{"line":133,"column":10},"end":{"line":133,"column":10}},{"start":{"line":133,"column":10},"end":{"line":133,"column":10}}]},"3":{"line":151,"type":"if","locations":[{"start":{"line":151,"column":2},"end":{"line":151,"column":2}},{"start":{"line":151,"column":2},"end":{"line":151,"column":2}}]},"4":{"line":151,"type":"binary-expr","locations":[{"start":{"line":151,"column":6},"end":{"line":151,"column":33}},{"start":{"line":152,"column":6},"end":{"line":152,"column":33}},{"start":{"line":153,"column":6},"end":{"line":153,"column":37}}]},"5":{"line":158,"type":"if","locations":[{"start":{"line":158,"column":2},"end":{"line":158,"column":2}},{"start":{"line":158,"column":2},"end":{"line":158,"column":2}}]},"6":{"line":160,"type":"if","locations":[{"start":{"line":160,"column":6},"end":{"line":160,"column":6}},{"start":{"line":160,"column":6},"end":{"line":160,"column":6}}]},"7":{"line":160,"type":"binary-expr","locations":[{"start":{"line":160,"column":10},"end":{"line":160,"column":32}},{"start":{"line":160,"column":36},"end":{"line":160,"column":56}}]},"8":{"line":162,"type":"if","locations":[{"start":{"line":162,"column":10},"end":{"line":162,"column":10}},{"start":{"line":162,"column":10},"end":{"line":162,"column":10}}]},"9":{"line":167,"type":"if","locations":[{"start":{"line":167,"column":2},"end":{"line":167,"column":2}},{"start":{"line":167,"column":2},"end":{"line":167,"column":2}}]},"10":{"line":167,"type":"binary-expr","locations":[{"start":{"line":167,"column":6},"end":{"line":167,"column":15}},{"start":{"line":167,"column":19},"end":{"line":167,"column":36}},{"start":{"line":168,"column":6},"end":{"line":168,"column":68}}]},"11":{"line":168,"type":"binary-expr","locations":[{"start":{"line":168,"column":25},"end":{"line":168,"column":40}},{"start":{"line":168,"column":44},"end":{"line":168,"column":46}}]},"12":{"line":176,"type":"if","locations":[{"start":{"line":176,"column":6},"end":{"line":176,"column":6}},{"start":{"line":176,"column":6},"end":{"line":176,"column":6}}]},"13":{"line":178,"type":"if","locations":[{"start":{"line":178,"column":6},"end":{"line":178,"column":6}},{"start":{"line":178,"column":6},"end":{"line":178,"column":6}}]},"14":{"line":180,"type":"if","locations":[{"start":{"line":180,"column":6},"end":{"line":180,"column":6}},{"start":{"line":180,"column":6},"end":{"line":180,"column":6}}]},"15":{"line":185,"type":"if","locations":[{"start":{"line":185,"column":4},"end":{"line":185,"column":4}},{"start":{"line":185,"column":4},"end":{"line":185,"column":4}}]},"16":{"line":189,"type":"if","locations":[{"start":{"line":189,"column":2},"end":{"line":189,"column":2}},{"start":{"line":189,"column":2},"end":{"line":189,"column":2}}]},"17":{"line":192,"type":"if","locations":[{"start":{"line":192,"column":2},"end":{"line":192,"column":2}},{"start":{"line":192,"column":2},"end":{"line":192,"column":2}}]},"18":{"line":201,"type":"cond-expr","locations":[{"start":{"line":201,"column":45},"end":{"line":201,"column":46}},{"start":{"line":201,"column":49},"end":{"line":201,"column":52}}]},"19":{"line":205,"type":"binary-expr","locations":[{"start":{"line":205,"column":26},"end":{"line":205,"column":30}},{"start":{"line":205,"column":34},"end":{"line":205,"column":36}}]},"20":{"line":212,"type":"if","locations":[{"start":{"line":212,"column":4},"end":{"line":212,"column":4}},{"start":{"line":212,"column":4},"end":{"line":212,"column":4}}]},"21":{"line":221,"type":"if","locations":[{"start":{"line":221,"column":10},"end":{"line":221,"column":10}},{"start":{"line":221,"column":10},"end":{"line":221,"column":10}}]},"22":{"line":221,"type":"binary-expr","locations":[{"start":{"line":221,"column":14},"end":{"line":221,"column":24}},{"start":{"line":221,"column":28},"end":{"line":221,"column":36}},{"start":{"line":221,"column":40},"end":{"line":221,"column":46}}]},"23":{"line":239,"type":"if","locations":[{"start":{"line":239,"column":6},"end":{"line":239,"column":6}},{"start":{"line":239,"column":6},"end":{"line":239,"column":6}}]},"24":{"line":245,"type":"cond-expr","locations":[{"start":{"line":245,"column":56},"end":{"line":245,"column":71}},{"start":{"line":245,"column":74},"end":{"line":245,"column":78}}]},"25":{"line":245,"type":"binary-expr","locations":[{"start":{"line":245,"column":20},"end":{"line":245,"column":34}},{"start":{"line":245,"column":38},"end":{"line":245,"column":53}}]},"26":{"line":246,"type":"if","locations":[{"start":{"line":246,"column":4},"end":{"line":246,"column":4}},{"start":{"line":246,"column":4},"end":{"line":246,"column":4}}]},"27":{"line":246,"type":"binary-expr","locations":[{"start":{"line":246,"column":8},"end":{"line":246,"column":21}},{"start":{"line":246,"column":25},"end":{"line":246,"column":37}}]},"28":{"line":252,"type":"binary-expr","locations":[{"start":{"line":252,"column":5},"end":{"line":252,"column":10}},{"start":{"line":252,"column":14},"end":{"line":252,"column":16}}]},"29":{"line":254,"type":"if","locations":[{"start":{"line":254,"column":6},"end":{"line":254,"column":6}},{"start":{"line":254,"column":6},"end":{"line":254,"column":6}}]},"30":{"line":257,"type":"if","locations":[{"start":{"line":257,"column":6},"end":{"line":257,"column":6}},{"start":{"line":257,"column":6},"end":{"line":257,"column":6}}]},"31":{"line":265,"type":"if","locations":[{"start":{"line":265,"column":4},"end":{"line":265,"column":4}},{"start":{"line":265,"column":4},"end":{"line":265,"column":4}}]},"32":{"line":267,"type":"if","locations":[{"start":{"line":267,"column":4},"end":{"line":267,"column":4}},{"start":{"line":267,"column":4},"end":{"line":267,"column":4}}]},"33":{"line":268,"type":"if","locations":[{"start":{"line":268,"column":4},"end":{"line":268,"column":4}},{"start":{"line":268,"column":4},"end":{"line":268,"column":4}}]},"34":{"line":271,"type":"cond-expr","locations":[{"start":{"line":271,"column":53},"end":{"line":271,"column":70}},{"start":{"line":271,"column":73},"end":{"line":271,"column":77}}]},"35":{"line":271,"type":"binary-expr","locations":[{"start":{"line":271,"column":21},"end":{"line":271,"column":33}},{"start":{"line":271,"column":37},"end":{"line":271,"column":50}}]},"36":{"line":272,"type":"if","locations":[{"start":{"line":272,"column":4},"end":{"line":272,"column":4}},{"start":{"line":272,"column":4},"end":{"line":272,"column":4}}]},"37":{"line":273,"type":"if","locations":[{"start":{"line":273,"column":4},"end":{"line":273,"column":4}},{"start":{"line":273,"column":4},"end":{"line":273,"column":4}}]},"38":{"line":281,"type":"binary-expr","locations":[{"start":{"line":281,"column":46},"end":{"line":281,"column":47}},{"start":{"line":281,"column":51},"end":{"line":281,"column":55}}]},"39":{"line":285,"type":"cond-expr","locations":[{"start":{"line":285,"column":59},"end":{"line":285,"column":60}},{"start":{"line":285,"column":63},"end":{"line":285,"column":67}}]},"40":{"line":289,"type":"cond-expr","locations":[{"start":{"line":289,"column":57},"end":{"line":289,"column":58}},{"start":{"line":289,"column":61},"end":{"line":289,"column":65}}]},"41":{"line":296,"type":"cond-expr","locations":[{"start":{"line":296,"column":30},"end":{"line":296,"column":34}},{"start":{"line":296,"column":37},"end":{"line":296,"column":55}}]},"42":{"line":298,"type":"switch","locations":[{"start":{"line":299,"column":42},"end":{"line":299,"column":65}},{"start":{"line":300,"column":42},"end":{"line":300,"column":65}},{"start":{"line":301,"column":42},"end":{"line":301,"column":66}},{"start":{"line":302,"column":15},"end":{"line":302,"column":77}}]},"43":{"line":307,"type":"cond-expr","locations":[{"start":{"line":307,"column":34},"end":{"line":307,"column":48}},{"start":{"line":307,"column":51},"end":{"line":307,"column":54}}]},"44":{"line":307,"type":"binary-expr","locations":[{"start":{"line":307,"column":34},"end":{"line":307,"column":40}},{"start":{"line":307,"column":44},"end":{"line":307,"column":48}}]},"45":{"line":323,"type":"switch","locations":[{"start":{"line":324,"column":23},"end":{"line":324,"column":29}},{"start":{"line":325,"column":23},"end":{"line":325,"column":74}},{"start":{"line":327,"column":17},"end":{"line":327,"column":70}}]},"46":{"line":325,"type":"if","locations":[{"start":{"line":325,"column":23},"end":{"line":325,"column":23}},{"start":{"line":325,"column":23},"end":{"line":325,"column":23}}]},"47":{"line":325,"type":"binary-expr","locations":[{"start":{"line":325,"column":27},"end":{"line":325,"column":45}},{"start":{"line":325,"column":49},"end":{"line":325,"column":60}}]},"48":{"line":329,"type":"if","locations":[{"start":{"line":329,"column":6},"end":{"line":329,"column":6}},{"start":{"line":329,"column":6},"end":{"line":329,"column":6}}]},"49":{"line":332,"type":"if","locations":[{"start":{"line":332,"column":6},"end":{"line":332,"column":6}},{"start":{"line":332,"column":6},"end":{"line":332,"column":6}}]},"50":{"line":337,"type":"if","locations":[{"start":{"line":337,"column":6},"end":{"line":337,"column":6}},{"start":{"line":337,"column":6},"end":{"line":337,"column":6}}]},"51":{"line":342,"type":"if","locations":[{"start":{"line":342,"column":4},"end":{"line":342,"column":4}},{"start":{"line":342,"column":4},"end":{"line":342,"column":4}}]},"52":{"line":343,"type":"cond-expr","locations":[{"start":{"line":343,"column":52},"end":{"line":343,"column":60}},{"start":{"line":343,"column":63},"end":{"line":343,"column":67}}]},"53":{"line":343,"type":"binary-expr","locations":[{"start":{"line":343,"column":16},"end":{"line":343,"column":30}},{"start":{"line":343,"column":34},"end":{"line":343,"column":49}}]},"54":{"line":347,"type":"if","locations":[{"start":{"line":347,"column":4},"end":{"line":347,"column":4}},{"start":{"line":347,"column":4},"end":{"line":347,"column":4}}]},"55":{"line":347,"type":"binary-expr","locations":[{"start":{"line":347,"column":8},"end":{"line":347,"column":24}},{"start":{"line":347,"column":28},"end":{"line":347,"column":44}}]},"56":{"line":348,"type":"if","locations":[{"start":{"line":348,"column":4},"end":{"line":348,"column":4}},{"start":{"line":348,"column":4},"end":{"line":348,"column":4}}]},"57":{"line":351,"type":"if","locations":[{"start":{"line":351,"column":8},"end":{"line":351,"column":8}},{"start":{"line":351,"column":8},"end":{"line":351,"column":8}}]},"58":{"line":356,"type":"if","locations":[{"start":{"line":356,"column":4},"end":{"line":356,"column":4}},{"start":{"line":356,"column":4},"end":{"line":356,"column":4}}]},"59":{"line":356,"type":"binary-expr","locations":[{"start":{"line":356,"column":8},"end":{"line":356,"column":35}},{"start":{"line":356,"column":39},"end":{"line":356,"column":63}}]},"60":{"line":360,"type":"if","locations":[{"start":{"line":360,"column":4},"end":{"line":360,"column":4}},{"start":{"line":360,"column":4},"end":{"line":360,"column":4}}]},"61":{"line":361,"type":"if","locations":[{"start":{"line":361,"column":4},"end":{"line":361,"column":4}},{"start":{"line":361,"column":4},"end":{"line":361,"column":4}}]},"62":{"line":363,"type":"if","locations":[{"start":{"line":363,"column":6},"end":{"line":363,"column":6}},{"start":{"line":363,"column":6},"end":{"line":363,"column":6}}]},"63":{"line":363,"type":"binary-expr","locations":[{"start":{"line":363,"column":10},"end":{"line":363,"column":26}},{"start":{"line":363,"column":30},"end":{"line":363,"column":46}}]},"64":{"line":366,"type":"if","locations":[{"start":{"line":366,"column":4},"end":{"line":366,"column":4}},{"start":{"line":366,"column":4},"end":{"line":366,"column":4}}]},"65":{"line":370,"type":"if","locations":[{"start":{"line":370,"column":8},"end":{"line":370,"column":8}},{"start":{"line":370,"column":8},"end":{"line":370,"column":8}}]},"66":{"line":380,"type":"if","locations":[{"start":{"line":380,"column":0},"end":{"line":380,"column":0}},{"start":{"line":380,"column":0},"end":{"line":380,"column":0}}]}}}} |
| /* coffee-script example usage - at https://github.com/johan/dotjs/commits/johan | |
| given path_re: ['^/([^/]+)/([^/]+)(/?.*)', 'user', 'repo', 'rest'] | |
| query: true | |
| dom: | |
| keyboard: 'css .keyboard-shortcuts' | |
| branches: 'css+ .js-filter-branches h4 a' | |
| dates: 'css* .commit-group-heading' | |
| tracker: 'css? #gauges-tracker[defer]' | |
| johan_ci: 'xpath* //li[contains(@class,"commit")][.//a[.="johan"]]' | |
| ready: (path, query, dom) -> | |
| ...would make something like this call, as the path regexp matched, and there | |
| were DOM matches for the two mandatory "keyboard" and "branches" selectors: | |
| ready( { user: 'johan', repo: 'dotjs', rest: '/commits/johan' } | |
| , {} // would contain all query args (if any were present) | |
| , { keyboard: Node<a href="#keyboard_shortcuts_pane"> | |
| , branches: [ Node<a href="/johan/dotjs/commits/coffee"> | |
| , Node<a href="/johan/dotjs/commits/dirs"> | |
| , Node<a href="/johan/dotjs/commits/gh-pages"> | |
| , Node<a href="/johan/dotjs/commits/johan"> | |
| , Node<a href="/johan/dotjs/commits/jquery-1.8.2"> | |
| , Node<a href="/johan/dotjs/commits/master"> | |
| ] | |
| , dates: [ Node<h3 class="commit-group-heading">Oct 07, 2012</h3> | |
| , Node<h3 class="commit-group-heading">Aug 29, 2012</h3> | |
| , ... | |
| ] | |
| , tracker: null | |
| , johan_ci: [ Node<li class="commit">, ... ] | |
| } | |
| ) | |
| A selector returns an array of matches prefixed for "css*" and "css+" (ditto | |
| xpath), and a single result if it is prefixed "css" or "css?": | |
| If your script should only run on pages with a particular DOM node (or set of | |
| nodes), use the 'css' or 'css+' (ditto xpath) forms - and your callback won't | |
| get fired on pages that lack them. The 'css?' and 'css*' forms would run your | |
| callback but pass null or [] respectively, on not finding such nodes. You may | |
| recognize the semantics of x, x?, x* and x+ from regular expressions. | |
| (see http://goo.gl/ejtMD for a more thorough discussion of something similar) | |
| The dom property is recursively defined so you can make nested structures. | |
| If you want a property that itself is an object full of matched things, pass | |
| an object of sub-dom-spec:s, instead of a string selector: | |
| given dom: | |
| meta: | |
| base: 'xpath? /head/base | |
| title: 'xpath string(/head/title)' | |
| commits: 'css* li.commit' | |
| ready: (dom) -> | |
| You can also deconstruct repeated templated sections of a page into subarrays | |
| scraped as per your specs, by picking a context node for a dom spec. This is | |
| done by passing a two-element array: a selector resolving what node/nodes you | |
| look at and a dom spec describing how you want it/them deconstructed for you: | |
| given dom: | |
| meta: | |
| [ 'xpath /head', | |
| base: 'xpath? base | |
| title: 'xpath string(title)' | |
| ] | |
| commits: | |
| [ 'css* li.commit', | |
| avatar_url: ['css img.gravatar', 'xpath string(@src)'] | |
| author_name: 'xpath string(.//*[@class="author-name"])' | |
| ] | |
| ready: (dom) -> | |
| The mandatory/optional selector rules defined above behave as you'd expect as | |
| used for context selectors too: a mandatory node or array of nodes will limit | |
| what pages your script gets called on to those that match it, so your code is | |
| free to assume it will always be there when it runs. An optional context node | |
| that is not found will instead result in that part of your DOM being null, or | |
| an empty array, in the case of a * selector. | |
| Finally, there is the xpath! keyword, which is similar to xpath, but it also | |
| mandates that whatever is returned is truthy. This is useful when you use the | |
| xpath functions returning strings, numbers and of course booleans, to assert | |
| things about the pages you want to run on, like 'xpath! count(//img) = 0', if | |
| you never want the script to run on pages with inline images, say. | |
| Once you called given(), you may call given.dom to do page scraping later on, | |
| returning whatever matched your selector(s) passed. Mandatory selectors which | |
| failed to match at this point will return undefined, optional selectors null: | |
| given.dom('xpath //a[@id]') => undefined or <a id="..."> | |
| given.dom('xpath? //a[@id]') => null or <a id="..."> | |
| given.dom('xpath+ //a[@id]') => undefined or [<a id="...">, <a id>, ...] | |
| given.dom('xpath* //a[@id]') => [] or [<a id="...">, <a id>, ...] | |
| To detect a failed mandatory match, you can use given.dom(...) === given.FAIL | |
| Github pjax hook: to re-run the script's given() block for every pjax request | |
| to a site - add a pushstate hook as per http://goo.gl/LNSv1 -- and be sure to | |
| make your script reentrant, so that it won't try to process the same elements | |
| again, if they are still sitting around in the page (see ':not([augmented])') | |
| */ | |
| function given(opts, plugins) { | |
| var Object_toString = Object.prototype.toString | |
| , Array_slice = Array.prototype.slice | |
| , FAIL = 'dom' in given ? undefined : (function() { | |
| var tests = | |
| { path_re: { fn: test_regexp } | |
| , query: { fn: test_query } | |
| , dom: { fn: test_dom | |
| , my: { 'css*': $c | |
| , 'css+': one_or_more($c) | |
| , 'css?': $C | |
| , 'css': not_null($C) | |
| , 'xpath*': $x | |
| , 'xpath+': one_or_more($x) | |
| , 'xpath?': $X | |
| , 'xpath!': truthy($x) | |
| , 'xpath': not_null($X) | |
| } | |
| } | |
| , inject: { fn: inject } | |
| } | |
| , name, test, me, my, mine | |
| ; | |
| for (name in tests) { | |
| test = tests[name]; | |
| me = test.fn; | |
| if ((my = test.my)) | |
| for (mine in my) | |
| me[mine] = my[mine]; | |
| given[name] = me; | |
| } | |
| })() | |
| , input = [] // args for the callback(s?) the script wants to run | |
| , rules = Object.create(opts) // wraps opts in a pokeable inherit layer | |
| , debug = get('debug') | |
| , script = get('name') | |
| , ready = get('ready') | |
| , load = get('load') | |
| , pushState = get('pushstate') | |
| , pjax_event = get('pjaxevent') | |
| , name, rule, test, result, retry, plugin | |
| ; | |
| if (typeof ready !== 'function' && | |
| typeof load !== 'function' && | |
| typeof pushState !== 'function') { | |
| alert('no given function'); | |
| throw new Error('given() needs at least a "ready" or "load" function!'); | |
| } | |
| if (plugins) | |
| for (name in plugins) | |
| if ((rule = plugins[name]) && (test = given[name])) | |
| for (plugin in rule) | |
| if (!(test[plugin])) { | |
| given._parse_dom_rule = null; | |
| test[plugin] = rule[plugin]; | |
| } | |
| if (pushState && history.pushState && | |
| (given.pushState = given.pushState || []).indexOf(opts) === -1) { | |
| given.pushState.push(opts); // make sure we don't reregister post-navigation | |
| initPushState(pushState, pjax_event); | |
| } | |
| try { | |
| for (name in rules) { | |
| rule = rules[name]; | |
| if (rule === undefined) continue; // was some callback or other non-rule | |
| test = given[name]; | |
| if (!test) throw new Error('did not grok rule "'+ name +'"!'); | |
| result = test(rule); | |
| if (result === FAIL) return false; // the page doesn't satisfy all rules | |
| input.push(result); | |
| } | |
| } | |
| catch(e) { | |
| if (debug) console.warn("given(debug): we didn't run because " + e.message); | |
| return false; | |
| } | |
| if (ready) { | |
| ready.apply(opts, input.concat()); | |
| } | |
| if (load) window.addEventListener('load', function() { | |
| load.apply(opts, input.concat()); | |
| }); | |
| return input.concat(opts); | |
| function get(x) { rules[x] = undefined; return opts[x]; } | |
| function isArray(x) { return Object_toString.call(x) === '[object Array]'; } | |
| function isObject(x) { return Object_toString.call(x) === '[object Object]'; } | |
| function array(a) { return Array_slice.call(a, 0); } // array:ish => Array | |
| function arrayify(x) { return isArray(x) ? x : [x]; } // non-array? => Array | |
| function inject(fn, args) { | |
| var script = document.createElement('script') | |
| , parent = document.documentElement; | |
| args = JSON.stringify(args || []).slice(1, -1); | |
| script.textContent = '('+ fn +')('+ args +');'; | |
| parent.appendChild(script); | |
| parent.removeChild(script); | |
| } | |
| function initPushState(callback, pjax_event) { | |
| if (!history.pushState.armed) { | |
| inject(function(pjax_event) { | |
| function reportBack() { | |
| var e = document.createEvent('Events'); | |
| e.initEvent('history.pushState', !'bubbles', !'cancelable'); | |
| document.dispatchEvent(e); | |
| } | |
| var pushState = history.pushState; | |
| history.pushState = function given_pushState() { | |
| if (pjax_event && window.$ && $.pjax) | |
| $(document).one(pjax_event, reportBack); | |
| else | |
| setTimeout(reportBack, 0); | |
| return pushState.apply(this, arguments); | |
| }; | |
| }, [pjax_event]); | |
| history.pushState.armed = pjax_event; | |
| } | |
| retry = function after_pushState() { | |
| rules = Object.create(opts); | |
| rules.load = rules.pushstate = undefined; | |
| rules.ready = callback; | |
| given(rules); | |
| }; | |
| document.addEventListener('history.pushState', function() { | |
| if (debug) console.log('given.pushstate', location.pathname); | |
| retry(); | |
| }, false); | |
| } | |
| function test_query(spec) { | |
| var q = unparam(this === given || this === window ? location.search : this); | |
| if (spec === true || spec == null) return q; // decode the query for me! | |
| throw new Error('bad query type '+ (typeof spec) +': '+ spec); | |
| } | |
| function unparam(query) { | |
| var data = {}; | |
| (query || '').replace(/\+/g, '%20').split('&').forEach(function(kv) { | |
| kv = /^\??([^=&]*)(?:=(.*))?/.exec(kv); | |
| if (!kv) return; | |
| var prop, val, k = kv[1], v = kv[2], e, m; | |
| try { prop = decodeURIComponent(k); } catch (e) { prop = unescape(k); } | |
| if ((val = v) != null) | |
| try { val = decodeURIComponent(v); } catch (e) { val = unescape(v); } | |
| data[prop] = val; | |
| }); | |
| return data; | |
| } | |
| function test_regexp(spec) { | |
| if (!isArray(spec)) spec = arrayify(spec); | |
| var re = spec.shift(); | |
| if (typeof re === 'string') re = new RegExp(re); | |
| if (!(re instanceof RegExp)) | |
| throw new Error((typeof re) +' was not a regexp: '+ re); | |
| var ok = re.exec(this===given || this===window ? location.pathname : this); | |
| if (ok === null) return FAIL; | |
| if (!spec.length) return ok; | |
| var named = {}; | |
| ok.shift(); // drop matching-whole-regexp part | |
| while (spec.length) named[spec.shift()] = ok.shift(); | |
| return named; | |
| } | |
| function truthy(fn) { return function(s) { | |
| var x = fn.apply(this, arguments); return x || FAIL; | |
| }; } | |
| function not_null(fn) { return function(s) { | |
| var x = fn.apply(this, arguments); return x !== null ? x : FAIL; | |
| }; } | |
| function one_or_more(fn) { return function(s) { | |
| var x = fn.apply(this, arguments); return x.length ? x : FAIL; | |
| }; } | |
| function $c(css) { return array(this.querySelectorAll(css)); } | |
| function $C(css) { return this.querySelector(css); } | |
| function $x(xpath) { | |
| var doc = this.evaluate ? this : this.ownerDocument, next; | |
| var got = doc.evaluate(xpath, this, null, 0, null), all = []; | |
| switch (got.resultType) { | |
| case 1/*XPathResult.NUMBER_TYPE*/: return got.numberValue; | |
| case 2/*XPathResult.STRING_TYPE*/: return got.stringValue; | |
| case 3/*XPathResult.BOOLEAN_TYPE*/: return got.booleanValue; | |
| default: while ((next = got.iterateNext())) all.push(next); return all; | |
| } | |
| } | |
| function $X(xpath) { | |
| var got = $x.call(this, xpath); | |
| return got instanceof Array ? got[0] || null : got; | |
| } | |
| function quoteRe(s) { return (s+'').replace(/([-$(-+.?[-^{|}])/g, '\\$1'); } | |
| // DOM constraint tester / scraper facility: | |
| // "this" is the context Node(s) - initially the document | |
| // "spec" is either of: | |
| // * css / xpath Selector "selector_type selector" | |
| // * resolved for context [ context Selector, spec ] | |
| // * an Object of spec(s) { property_name: spec, ... } | |
| function test_dom(spec, context) { | |
| // returns FAIL if it turned out it wasn't a mandated match at this level | |
| // returns null if it didn't find optional matches at this level | |
| // returns Node or an Array of nodes, or a basic type from some XPath query | |
| function lookup(rule) { | |
| switch (typeof rule) { | |
| case 'string': break; // main case - rest of function | |
| case 'object': if ('nodeType' in rule || rule.length) return rule; | |
| // fall-through | |
| default: throw new Error('non-String dom match rule: '+ rule); | |
| } | |
| if (!given._parse_dom_rule) given._parse_dom_rule = new RegExp('^(' + | |
| Object.keys(given.dom).map(quoteRe).join('|') + ')\\s*(.*)'); | |
| var match = given._parse_dom_rule.exec(rule), type, func; | |
| if (match) { | |
| type = match[1]; | |
| rule = match[2]; | |
| func = test_dom[type]; | |
| } | |
| if (!func) throw new Error('unknown dom match rule '+ type +': '+ rule); | |
| return func.call(this, rule); | |
| } | |
| var results, result, i, property_name; | |
| if (context === undefined) { | |
| context = this === given || this === window ? document : this; | |
| } | |
| // validate context: | |
| if (context === null || context === FAIL) return FAIL; | |
| if (isArray(context)) { | |
| for (results = [], i = 0; i < context.length; i++) { | |
| result = test_dom.call(context[i], spec); | |
| if (result !== FAIL) | |
| results.push(result); | |
| } | |
| return results; | |
| } | |
| if (typeof context !== 'object' || !('nodeType' in context)) | |
| throw new Error('illegal context: '+ context); | |
| // handle input spec format: | |
| if (typeof spec === 'string') return lookup.call(context, spec); | |
| if (isArray(spec)) { | |
| context = lookup.call(context, spec[0]); | |
| if (context === null || context === FAIL) return context; | |
| return test_dom.call(context, spec[1]); | |
| } | |
| if (isObject(spec)) { | |
| results = {}; | |
| for (property_name in spec) { | |
| result = test_dom.call(context, spec[property_name]); | |
| if (result === FAIL) return FAIL; | |
| results[property_name] = result; | |
| } | |
| return results; | |
| } | |
| throw new Error("dom spec was neither a String, Object nor Array: "+ spec); | |
| } | |
| }; | |
| if ('module' in this) module.exports = given; |
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>Code coverage report for ./given.js</title> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
| <meta http-equiv="content-language" content="en-gb"> | |
| <link rel='stylesheet' href='../prettify.css'> | |
| <style type='text/css'> | |
| body, html { | |
| margin:0; padding: 0; | |
| } | |
| body { | |
| font-family: "Helvetic Neue", Helvetica,Arial; | |
| font-size: 10pt; | |
| } | |
| div.header, div.footer { | |
| background: #eee; | |
| padding: 1em; | |
| } | |
| div.header { | |
| z-index: 100; | |
| position: fixed; | |
| top: 0; | |
| border-bottom: 1px solid #666; | |
| width: 100%; | |
| } | |
| div.footer { | |
| border-top: 1px solid #666; | |
| } | |
| div.body { | |
| margin-top: 10em; | |
| } | |
| div.meta { | |
| font-size: 90%; | |
| text-align: center; | |
| } | |
| h1, h2, h3 { | |
| font-weight: normal; | |
| } | |
| h1 { | |
| font-size: 12pt; | |
| } | |
| h2 { | |
| font-size: 10pt; | |
| } | |
| pre { | |
| font-family: consolas, menlo, monaco, monospace; | |
| margin: 0; | |
| padding: 0; | |
| line-height: 14px; | |
| font-size: 14px; | |
| } | |
| div.path { font-size: 110%; } | |
| div.path a:link, div.path a:visited { color: #000; } | |
| table.coverage { border-collapse: collapse; margin:0; padding: 0 } | |
| table.coverage td { | |
| margin: 0; | |
| padding: 0; | |
| color: #111; | |
| vertical-align: top; | |
| } | |
| table.coverage td.line-count { | |
| width: 50px; | |
| text-align: right; | |
| padding-right: 5px; | |
| } | |
| table.coverage td.line-coverage { | |
| color: #777 !important; | |
| text-align: right; | |
| border-left: 1px solid #666; | |
| border-right: 1px solid #666; | |
| } | |
| table.coverage td.text { | |
| } | |
| table.coverage td span.cline-any { | |
| display: inline-block; | |
| padding: 0 5px; | |
| width: 40px; | |
| } | |
| table.coverage td span.cline-neutral { | |
| background: #eee; | |
| } | |
| table.coverage td span.cline-yes { | |
| background: #b5d592; | |
| color: #999; | |
| } | |
| table.coverage td span.cline-no { | |
| background: #fc8c84; | |
| } | |
| .cstat-yes { color: #111; } | |
| .cstat-no { background: #fc8c84; color: #111; } | |
| .fstat-no { background: #ffc520; color: #111 !important; } | |
| .cbranch-no { background: yellow !important; color: #111; } | |
| .missing-if-branch { | |
| display: inline-block; | |
| margin-right: 10px; | |
| position: relative; | |
| padding: 0 4px; | |
| background: black; | |
| color: yellow; | |
| xtext-decoration: line-through; | |
| } | |
| .missing-if-branch .typ { | |
| color: inherit !important; | |
| } | |
| .entity, .metric { font-weight: bold; } | |
| .metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; } | |
| .metric small { font-size: 80%; font-weight: normal; color: #666; } | |
| div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; } | |
| div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; } | |
| div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; } | |
| div.coverage-summary th.file { border-right: none !important; } | |
| div.coverage-summary th.pic { border-left: none !important; text-align: right; } | |
| div.coverage-summary th.pct { border-right: none !important; } | |
| div.coverage-summary th.abs { border-left: none !important; text-align: right; } | |
| div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; } | |
| div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; } | |
| div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; } | |
| div.coverage-summary td.pic { min-width: 120px !important; } | |
| div.coverage-summary a:link { text-decoration: none; color: #000; } | |
| div.coverage-summary a:visited { text-decoration: none; color: #333; } | |
| div.coverage-summary a:hover { text-decoration: underline; } | |
| div.coverage-summary tfoot td { border-top: 1px solid #666; } | |
| div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator { | |
| height: 10px; | |
| width: 7px; | |
| display: inline-block; | |
| margin-left: 0.5em; | |
| } | |
| div.coverage-summary .yui3-datatable-sort-indicator { | |
| background: url("http://yui.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent; | |
| } | |
| div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator { | |
| background-position: 0 -20px; | |
| } | |
| div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator { | |
| background-position: 0 -10px; | |
| } | |
| .high { background: #b5d592 !important; } | |
| .medium { background: #ffe87c !important; } | |
| .low { background: #fc8c84 !important; } | |
| span.cover-fill, span.cover-empty { | |
| display:inline-block; | |
| border:1px solid #444; | |
| background: white; | |
| height: 12px; | |
| } | |
| span.cover-fill { | |
| background: #ccc; | |
| border-right: 1px solid #444; | |
| } | |
| span.cover-empty { | |
| background: white; | |
| border-left: none; | |
| } | |
| span.cover-full { | |
| border-right: none !important; | |
| } | |
| pre.prettyprint { | |
| border: none !important; | |
| padding: 0 !important; | |
| margin: 0 !important; | |
| } | |
| .com { color: #999 !important; } | |
| </style> | |
| </head> | |
| <body> | |
| <div class='header medium'> | |
| <h1>Code coverage report for <span class='entity'>./given.js</span></h1> | |
| <h2> | |
| Statements: <span class='metric'>63.86% <small>(129 / 202)</small></span> | |
| Branches: <span class='metric'>66.67% <small>(92 / 138)</small></span> | |
| Functions: <span class='metric'>75% <small>(24 / 32)</small></span> | |
| Lines: <span class='metric'>69.38% <small>(111 / 160)</small></span> | |
| </h2> | |
| <div class="path"><a href="../index.html">All files</a> » <a href="index.html">./</a> » given.js</div> | |
| </div> | |
| <div class='body'> | |
| <pre><table class="coverage"> | |
| <tr><td class="line-count">1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | |
| 282 | |
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 | |
| 309 | |
| 310 | |
| 311 | |
| 312 | |
| 313 | |
| 314 | |
| 315 | |
| 316 | |
| 317 | |
| 318 | |
| 319 | |
| 320 | |
| 321 | |
| 322 | |
| 323 | |
| 324 | |
| 325 | |
| 326 | |
| 327 | |
| 328 | |
| 329 | |
| 330 | |
| 331 | |
| 332 | |
| 333 | |
| 334 | |
| 335 | |
| 336 | |
| 337 | |
| 338 | |
| 339 | |
| 340 | |
| 341 | |
| 342 | |
| 343 | |
| 344 | |
| 345 | |
| 346 | |
| 347 | |
| 348 | |
| 349 | |
| 350 | |
| 351 | |
| 352 | |
| 353 | |
| 354 | |
| 355 | |
| 356 | |
| 357 | |
| 358 | |
| 359 | |
| 360 | |
| 361 | |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | |
| 367 | |
| 368 | |
| 369 | |
| 370 | |
| 371 | |
| 372 | |
| 373 | |
| 374 | |
| 375 | |
| 376 | |
| 377 | |
| 378 | |
| 379 | |
| 380 | |
| 381</td><td class="line-coverage"><span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">7</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">4</span> | |
| <span class="cline-any cline-yes">4</span> | |
| <span class="cline-any cline-yes">4</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">9</span> | |
| <span class="cline-any cline-yes">4</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-yes">16</span> | |
| <span class="cline-any cline-yes">16</span> | |
| <span class="cline-any cline-yes">4</span> | |
| <span class="cline-any cline-yes">4</span> | |
| <span class="cline-any cline-yes">4</span> | |
| <span class="cline-any cline-yes">4</span> | |
| <span class="cline-any cline-yes">4</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">12</span> | |
| <span class="cline-any cline-yes">105</span> | |
| <span class="cline-any cline-yes">13</span> | |
| <span class="cline-any cline-yes">10</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-yes">5</span> | |
| <span class="cline-any cline-yes">5</span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-yes">5</span> | |
| <span class="cline-any cline-yes">5</span> | |
| <span class="cline-any cline-yes">6</span> | |
| <span class="cline-any cline-yes">6</span> | |
| <span class="cline-any cline-yes">6</span> | |
| <span class="cline-any cline-yes">6</span> | |
| <span class="cline-any cline-yes">6</span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-yes">6</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">5</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-yes">9</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-yes">32</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-yes">6</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">10</span> | |
| <span class="cline-any cline-yes">13</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-yes">39</span> | |
| <span class="cline-any cline-yes">39</span> | |
| <span class="cline-any cline-yes">39</span> | |
| <span class="cline-any cline-yes">7</span> | |
| <span class="cline-any cline-yes">11</span> | |
| <span class="cline-any cline-yes">5</span> | |
| <span class="cline-any cline-yes">16</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-yes">26</span> | |
| <span class="cline-any cline-yes">26</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">19</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">82</span> | |
| <span class="cline-any cline-yes">67</span> | |
| <span class="cline-any cline-yes">65</span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">65</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">65</span> | |
| <span class="cline-any cline-yes">65</span> | |
| <span class="cline-any cline-yes">65</span> | |
| <span class="cline-any cline-yes">65</span> | |
| <span class="cline-any cline-yes">65</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">65</span> | |
| <span class="cline-any cline-yes">65</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">82</span> | |
| <span class="cline-any cline-yes">82</span> | |
| <span class="cline-any cline-yes">82</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">82</span> | |
| <span class="cline-any cline-yes">82</span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-yes">7</span> | |
| <span class="cline-any cline-yes">7</span> | |
| <span class="cline-any cline-yes">7</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">2</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">80</span> | |
| <span class="cline-any cline-no"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">80</span> | |
| <span class="cline-any cline-yes">21</span> | |
| <span class="cline-any cline-yes">8</span> | |
| <span class="cline-any cline-yes">8</span> | |
| <span class="cline-any cline-yes">7</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">13</span> | |
| <span class="cline-any cline-yes">12</span> | |
| <span class="cline-any cline-yes">12</span> | |
| <span class="cline-any cline-yes">14</span> | |
| <span class="cline-any cline-yes">14</span> | |
| <span class="cline-any cline-yes">11</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">9</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-neutral"> </span> | |
| <span class="cline-any cline-yes">1</span> | |
| <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/* coffee-script example usage - at https://github.com/johan/dotjs/commits/johan | |
| | |
| given path_re: ['^/([^/]+)/([^/]+)(/?.*)', 'user', 'repo', 'rest'] | |
| query: true | |
| dom: | |
| keyboard: 'css .keyboard-shortcuts' | |
| branches: 'css+ .js-filter-branches h4 a' | |
| dates: 'css* .commit-group-heading' | |
| tracker: 'css? #gauges-tracker[defer]' | |
| johan_ci: 'xpath* //li[contains(@class,"commit")][.//a[.="johan"]]' | |
| ready: (path, query, dom) -> | |
| | |
| ...would make something like this call, as the path regexp matched, and there | |
| were DOM matches for the two mandatory "keyboard" and "branches" selectors: | |
| | |
| ready( { user: 'johan', repo: 'dotjs', rest: '/commits/johan' } | |
| , {} // would contain all query args (if any were present) | |
| , { keyboard: Node<a href="#keyboard_shortcuts_pane"> | |
| , branches: [ Node<a href="/johan/dotjs/commits/coffee"> | |
| , Node<a href="/johan/dotjs/commits/dirs"> | |
| , Node<a href="/johan/dotjs/commits/gh-pages"> | |
| , Node<a href="/johan/dotjs/commits/johan"> | |
| , Node<a href="/johan/dotjs/commits/jquery-1.8.2"> | |
| , Node<a href="/johan/dotjs/commits/master"> | |
| ] | |
| , dates: [ Node<h3 class="commit-group-heading">Oct 07, 2012</h3> | |
| , Node<h3 class="commit-group-heading">Aug 29, 2012</h3> | |
| , ... | |
| ] | |
| , tracker: null | |
| , johan_ci: [ Node<li class="commit">, ... ] | |
| } | |
| ) | |
| | |
| A selector returns an array of matches prefixed for "css*" and "css+" (ditto | |
| xpath), and a single result if it is prefixed "css" or "css?": | |
| | |
| If your script should only run on pages with a particular DOM node (or set of | |
| nodes), use the 'css' or 'css+' (ditto xpath) forms - and your callback won't | |
| get fired on pages that lack them. The 'css?' and 'css*' forms would run your | |
| callback but pass null or [] respectively, on not finding such nodes. You may | |
| recognize the semantics of x, x?, x* and x+ from regular expressions. | |
| | |
| (see http://goo.gl/ejtMD for a more thorough discussion of something similar) | |
| | |
| The dom property is recursively defined so you can make nested structures. | |
| If you want a property that itself is an object full of matched things, pass | |
| an object of sub-dom-spec:s, instead of a string selector: | |
| | |
| given dom: | |
| meta: | |
| base: 'xpath? /head/base | |
| title: 'xpath string(/head/title)' | |
| commits: 'css* li.commit' | |
| ready: (dom) -> | |
| | |
| You can also deconstruct repeated templated sections of a page into subarrays | |
| scraped as per your specs, by picking a context node for a dom spec. This is | |
| done by passing a two-element array: a selector resolving what node/nodes you | |
| look at and a dom spec describing how you want it/them deconstructed for you: | |
| | |
| given dom: | |
| meta: | |
| [ 'xpath /head', | |
| base: 'xpath? base | |
| title: 'xpath string(title)' | |
| ] | |
| commits: | |
| [ 'css* li.commit', | |
| avatar_url: ['css img.gravatar', 'xpath string(@src)'] | |
| author_name: 'xpath string(.//*[@class="author-name"])' | |
| ] | |
| ready: (dom) -> | |
| | |
| The mandatory/optional selector rules defined above behave as you'd expect as | |
| used for context selectors too: a mandatory node or array of nodes will limit | |
| what pages your script gets called on to those that match it, so your code is | |
| free to assume it will always be there when it runs. An optional context node | |
| that is not found will instead result in that part of your DOM being null, or | |
| an empty array, in the case of a * selector. | |
| | |
| Finally, there is the xpath! keyword, which is similar to xpath, but it also | |
| mandates that whatever is returned is truthy. This is useful when you use the | |
| xpath functions returning strings, numbers and of course booleans, to assert | |
| things about the pages you want to run on, like 'xpath! count(//img) = 0', if | |
| you never want the script to run on pages with inline images, say. | |
| | |
| Once you called given(), you may call given.dom to do page scraping later on, | |
| returning whatever matched your selector(s) passed. Mandatory selectors which | |
| failed to match at this point will return undefined, optional selectors null: | |
| | |
| given.dom('xpath //a[@id]') => undefined or <a id="..."> | |
| given.dom('xpath? //a[@id]') => null or <a id="..."> | |
| given.dom('xpath+ //a[@id]') => undefined or [<a id="...">, <a id>, ...] | |
| given.dom('xpath* //a[@id]') => [] or [<a id="...">, <a id>, ...] | |
| | |
| To detect a failed mandatory match, you can use given.dom(...) === given.FAIL | |
| | |
| Github pjax hook: to re-run the script's given() block for every pjax request | |
| to a site - add a pushstate hook as per http://goo.gl/LNSv1 -- and be sure to | |
| make your script reentrant, so that it won't try to process the same elements | |
| again, if they are still sitting around in the page (see ':not([augmented])') | |
| | |
| */ | |
| | |
| function given(opts, plugins) { | |
| var Object_toString = Object.prototype.toString | |
| , Array_slice = Array.prototype.slice | |
| , FAIL = 'dom' in given ? undefined : (function() { | |
| var tests = | |
| { path_re: { fn: test_regexp } | |
| , query: { fn: test_query } | |
| , dom: { fn: test_dom | |
| , my: { 'css*': $c | |
| , 'css+': one_or_more($c) | |
| , 'css?': $C | |
| , 'css': not_null($C) | |
| , 'xpath*': $x | |
| , 'xpath+': one_or_more($x) | |
| , 'xpath?': $X | |
| , 'xpath!': truthy($x) | |
| , 'xpath': not_null($X) | |
| } | |
| } | |
| , inject: { fn: inject } | |
| } | |
| , name, test, me, my, mine | |
| ; | |
| | |
| for (name in tests) { | |
| test = tests[name]; | |
| me = test.fn; | |
| if ((my = test.my)) | |
| for (mine in my) | |
| me[mine] = my[mine]; | |
| given[name] = me; | |
| } | |
| })() | |
| | |
| , input = [] // args for the callback(s?) the script wants to run | |
| , rules = Object.create(opts) // wraps opts in a pokeable inherit layer | |
| , debug = get('debug') | |
| , script = get('name') | |
| , ready = get('ready') | |
| , load = get('load') | |
| , pushState = get('pushstate') | |
| , pjax_event = get('pjaxevent') | |
| , name, rule, test, result, retry, plugin | |
| ; | |
| | |
| <span class="missing-if-branch" title="if path not taken"" >I</span>if (typeof ready !== 'function' && | |
| <span class="branch-1 cbranch-no" title="branch not covered" > typeof load !== 'function' </span>&& | |
| <span class="branch-2 cbranch-no" title="branch not covered" > typeof pushState !== 'function')</span> { | |
| <span class="cstat-no" title="statement not covered" > alert('no given function');</span> | |
| <span class="cstat-no" title="statement not covered" > throw new Error('given() needs at least a "ready" or "load" function!');</span> | |
| } | |
| | |
| if (plugins) | |
| for (name in plugins) | |
| <span class="missing-if-branch" title="else path not taken"" >E</span>if ((rule = plugins[name]) && (test = given[name])) | |
| for (plugin in rule) | |
| <span class="missing-if-branch" title="else path not taken"" >E</span>if (!(test[plugin])) { | |
| given._parse_dom_rule = null; | |
| test[plugin] = rule[plugin]; | |
| } | |
| | |
| <span class="missing-if-branch" title="if path not taken"" >I</span>if (pushState && <span class="branch-1 cbranch-no" title="branch not covered" >history.pushState </span>&& | |
| <span class="branch-2 cbranch-no" title="branch not covered" > (given.pushState = given.pushState || []).indexOf(opts) === -1)</span> { | |
| <span class="cstat-no" title="statement not covered" > given.pushState.push(opts); </span>// make sure we don't reregister post-navigation | |
| <span class="cstat-no" title="statement not covered" > initPushState(pushState, pjax_event);</span> | |
| } | |
| | |
| try { | |
| for (name in rules) { | |
| rule = rules[name]; | |
| if (rule === undefined) continue; // was some callback or other non-rule | |
| test = given[name]; | |
| <span class="missing-if-branch" title="if path not taken"" >I</span>if (!test) <span class="cstat-no" title="statement not covered" >throw new Error('did not grok rule "'+ name +'"!');</span> | |
| result = test(rule); | |
| <span class="missing-if-branch" title="if path not taken"" >I</span>if (result === FAIL) <span class="cstat-no" title="statement not covered" >return false; </span>// the page doesn't satisfy all rules | |
| input.push(result); | |
| } | |
| } | |
| catch(e) { | |
| <span class="cstat-no" title="statement not covered" > if (debug) <span class="cstat-no" title="statement not covered" >console.warn("given(debug): we didn't run because " + e.message);</span></span> | |
| <span class="cstat-no" title="statement not covered" > return false;</span> | |
| } | |
| | |
| <span class="missing-if-branch" title="else path not taken"" >E</span>if (ready) { | |
| ready.apply(opts, input.concat()); | |
| } | |
| <span class="missing-if-branch" title="if path not taken"" >I</span>if (load) <span class="cstat-no" title="statement not covered" >window.addEventListener('load', <span class="fstat-no" title="function not covered" >function() {</span></span> | |
| <span class="cstat-no" title="statement not covered" > load.apply(opts, input.concat());</span> | |
| }); | |
| return input.concat(opts); | |
| | |
| <span class="cstat-no" title="statement not covered" > function get(x) { rules[x] = undefined; return opts[x]; }</span> | |
| <span class="cstat-no" title="statement not covered" > function isArray(x) { return Object_toString.call(x) === '[object Array]'; }</span> | |
| <span class="cstat-no" title="statement not covered" > function isObject(x) { return Object_toString.call(x) === '[object Object]'; }</span> | |
| <span class="cstat-no" title="statement not covered" > function array(a) { return Array_slice.call(a, 0); } </span>// array:ish => Array | |
| <span class="cstat-no" title="statement not covered" > function arrayify(x) { return isArray(x) ? <span class="branch-0 cbranch-no" title="branch not covered" >x </span>: [x]; } </span> // non-array? => Array | |
| <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" > function inject(fn, args) {</span></span> | |
| <span class="cstat-no" title="statement not covered" > var script = document.createElement('script')</span> | |
| , parent = document.documentElement; | |
| <span class="cstat-no" title="statement not covered" > args = JSON.stringify(args || []).slice(1, -1);</span> | |
| <span class="cstat-no" title="statement not covered" > script.textContent = '('+ fn +')('+ args +');';</span> | |
| <span class="cstat-no" title="statement not covered" > parent.appendChild(script);</span> | |
| <span class="cstat-no" title="statement not covered" > parent.removeChild(script);</span> | |
| } | |
| | |
| <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" > function initPushState(callback, pjax_event) {</span></span> | |
| <span class="cstat-no" title="statement not covered" > if (!history.pushState.armed) {</span> | |
| <span class="cstat-no" title="statement not covered" > inject(<span class="fstat-no" title="function not covered" >function(pjax_event) {</span></span> | |
| <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" > function reportBack() {</span></span> | |
| <span class="cstat-no" title="statement not covered" > var e = document.createEvent('Events');</span> | |
| <span class="cstat-no" title="statement not covered" > e.initEvent('history.pushState', !'bubbles', !'cancelable');</span> | |
| <span class="cstat-no" title="statement not covered" > document.dispatchEvent(e);</span> | |
| } | |
| <span class="cstat-no" title="statement not covered" > var pushState = history.pushState;</span> | |
| <span class="cstat-no" title="statement not covered" > history.pushState = <span class="fstat-no" title="function not covered" >function given_pushState() {</span></span> | |
| <span class="cstat-no" title="statement not covered" > if (pjax_event && window.$ && $.pjax)</span> | |
| <span class="cstat-no" title="statement not covered" > $(document).one(pjax_event, reportBack);</span> | |
| else | |
| <span class="cstat-no" title="statement not covered" > setTimeout(reportBack, 0);</span> | |
| <span class="cstat-no" title="statement not covered" > return pushState.apply(this, arguments);</span> | |
| }; | |
| }, [pjax_event]); | |
| <span class="cstat-no" title="statement not covered" > history.pushState.armed = pjax_event;</span> | |
| } | |
| | |
| <span class="cstat-no" title="statement not covered" > retry = <span class="fstat-no" title="function not covered" >function after_pushState() {</span></span> | |
| <span class="cstat-no" title="statement not covered" > rules = Object.create(opts);</span> | |
| <span class="cstat-no" title="statement not covered" > rules.load = rules.pushstate = undefined;</span> | |
| <span class="cstat-no" title="statement not covered" > rules.ready = callback;</span> | |
| <span class="cstat-no" title="statement not covered" > given(rules);</span> | |
| }; | |
| | |
| <span class="cstat-no" title="statement not covered" > document.addEventListener('history.pushState', <span class="fstat-no" title="function not covered" >function() {</span></span> | |
| <span class="cstat-no" title="statement not covered" > if (debug) <span class="cstat-no" title="statement not covered" >console.log('given.pushstate', location.pathname);</span></span> | |
| <span class="cstat-no" title="statement not covered" > retry();</span> | |
| }, false); | |
| } | |
| | |
| <span class="cstat-no" title="statement not covered" > function test_query(spec) {</span> | |
| var q = unparam(this === given || this === window ? location.search : <span class="branch-1 cbranch-no" title="branch not covered" >this)</span>; | |
| <span class="missing-if-branch" title="else path not taken"" >E</span>if (spec === true || spec == null) return q; // decode the query for me! | |
| <span class="cstat-no" title="statement not covered" > throw new Error('bad query type '+ (typeof spec) +': '+ spec);</span> | |
| } | |
| | |
| <span class="cstat-no" title="statement not covered" > function unparam(query) {</span> | |
| var data = {}; | |
| (query || '').replace(/\+/g, '%20').split('&').forEach(function(kv) { | |
| kv = /^\??([^=&]*)(?:=(.*))?/.exec(kv); | |
| <span class="missing-if-branch" title="if path not taken"" >I</span>if (!kv) <span class="cstat-no" title="statement not covered" >return;</span> | |
| var prop, val, k = kv[1], v = kv[2], e, m; | |
| try { prop = decodeURIComponent(k); } catch (e) { <span class="cstat-no" title="statement not covered" >prop = unescape(k); </span>} | |
| if ((val = v) != null) | |
| try { val = decodeURIComponent(v); } catch (e) { <span class="cstat-no" title="statement not covered" >val = unescape(v); </span>} | |
| data[prop] = val; | |
| }); | |
| return data; | |
| } | |
| | |
| <span class="cstat-no" title="statement not covered" > function test_regexp(spec) {</span> | |
| <span class="missing-if-branch" title="else path not taken"" >E</span>if (!isArray(spec)) spec = arrayify(spec); | |
| var re = spec.shift(); | |
| <span class="missing-if-branch" title="else path not taken"" >E</span>if (typeof re === 'string') re = new RegExp(re); | |
| <span class="missing-if-branch" title="if path not taken"" >I</span>if (!(re instanceof RegExp)) | |
| <span class="cstat-no" title="statement not covered" > throw new Error((typeof re) +' was not a regexp: '+ re);</span> | |
| | |
| var ok = re.exec(this===given || this===window ? location.pathname : <span class="branch-1 cbranch-no" title="branch not covered" >this)</span>; | |
| <span class="missing-if-branch" title="if path not taken"" >I</span>if (ok === null) <span class="cstat-no" title="statement not covered" >return FAIL;</span> | |
| <span class="missing-if-branch" title="else path not taken"" >E</span>if (!spec.length) return ok; | |
| <span class="cstat-no" title="statement not covered" > var named = {};</span> | |
| <span class="cstat-no" title="statement not covered" > ok.shift(); </span>// drop matching-whole-regexp part | |
| <span class="cstat-no" title="statement not covered" > while (spec.length) <span class="cstat-no" title="statement not covered" >named[spec.shift()] = ok.shift();</span></span> | |
| <span class="cstat-no" title="statement not covered" > return named;</span> | |
| } | |
| | |
| <span class="cstat-no" title="statement not covered" > function truthy(fn) { return function(s) {</span> | |
| var x = fn.apply(this, arguments); return x || FAIL; | |
| }; } | |
| | |
| <span class="cstat-no" title="statement not covered" > function not_null(fn) { return function(s) {</span> | |
| var x = fn.apply(this, arguments); return x !== null ? x : FAIL; | |
| }; } | |
| | |
| <span class="cstat-no" title="statement not covered" > function one_or_more(fn) { return function(s) {</span> | |
| var x = fn.apply(this, arguments); return x.length ? x : FAIL; | |
| }; } | |
| | |
| <span class="cstat-no" title="statement not covered" > function $c(css) { return array(this.querySelectorAll(css)); }</span> | |
| <span class="cstat-no" title="statement not covered" > function $C(css) { return this.querySelector(css); }</span> | |
| | |
| <span class="cstat-no" title="statement not covered" > function $x(xpath) {</span> | |
| var doc = this.evaluate ? this : this.ownerDocument, next; | |
| var got = doc.evaluate(xpath, this, null, 0, null), all = []; | |
| switch (got.resultType) { | |
| case 1/*XPathResult.NUMBER_TYPE*/: return got.numberValue; | |
| case 2/*XPathResult.STRING_TYPE*/: return got.stringValue; | |
| case 3/*XPathResult.BOOLEAN_TYPE*/: return got.booleanValue; | |
| default: while ((next = got.iterateNext())) all.push(next); return all; | |
| } | |
| } | |
| <span class="cstat-no" title="statement not covered" > function $X(xpath) {</span> | |
| var got = $x.call(this, xpath); | |
| return got instanceof Array ? got[0] || null : got; | |
| } | |
| | |
| <span class="cstat-no" title="statement not covered" > function quoteRe(s) { return (s+'').replace(/([-$(-+.?[-^{|}])/g, '\\$1'); }</span> | |
| | |
| // DOM constraint tester / scraper facility: | |
| // "this" is the context Node(s) - initially the document | |
| // "spec" is either of: | |
| // * css / xpath Selector "selector_type selector" | |
| // * resolved for context [ context Selector, spec ] | |
| // * an Object of spec(s) { property_name: spec, ... } | |
| <span class="cstat-no" title="statement not covered" > function test_dom(spec, context) {</span> | |
| // returns FAIL if it turned out it wasn't a mandated match at this level | |
| // returns null if it didn't find optional matches at this level | |
| // returns Node or an Array of nodes, or a basic type from some XPath query | |
| function lookup(rule) { | |
| switch (typeof rule) { | |
| case 'string': break; // main case - rest of function | |
| case 'object': <span class="missing-if-branch" title="else path not taken"" >E</span>if ('nodeType' in rule || rule.length) return rule; | |
| // fall-through | |
| default: <span class="cstat-no" title="statement not covered" ><span class="branch-2 cbranch-no" title="branch not covered" >throw new Error('non-String dom match rule: '+ rule);</span></span> | |
| } | |
| if (!given._parse_dom_rule) given._parse_dom_rule = new RegExp('^(' + | |
| Object.keys(given.dom).map(quoteRe).join('|') + ')\\s*(.*)'); | |
| var match = given._parse_dom_rule.exec(rule), type, func; | |
| <span class="missing-if-branch" title="else path not taken"" >E</span>if (match) { | |
| type = match[1]; | |
| rule = match[2]; | |
| func = test_dom[type]; | |
| } | |
| <span class="missing-if-branch" title="if path not taken"" >I</span>if (!func) <span class="cstat-no" title="statement not covered" >throw new Error('unknown dom match rule '+ type +': '+ rule);</span> | |
| return func.call(this, rule); | |
| } | |
| | |
| var results, result, i, property_name; | |
| <span class="missing-if-branch" title="else path not taken"" >E</span>if (context === undefined) { | |
| context = this === given || this === window ? document : this; | |
| } | |
| | |
| // validate context: | |
| <span class="missing-if-branch" title="if path not taken"" >I</span>if (context === null || context === FAIL) <span class="cstat-no" title="statement not covered" >return FAIL;</span> | |
| if (isArray(context)) { | |
| for (results = [], i = 0; i < context.length; i++) { | |
| result = test_dom.call(context[i], spec); | |
| <span class="missing-if-branch" title="else path not taken"" >E</span>if (result !== FAIL) | |
| results.push(result); | |
| } | |
| return results; | |
| } | |
| <span class="missing-if-branch" title="if path not taken"" >I</span>if (typeof context !== 'object' || !('nodeType' in context)) | |
| <span class="cstat-no" title="statement not covered" > throw new Error('illegal context: '+ context);</span> | |
| | |
| // handle input spec format: | |
| if (typeof spec === 'string') return lookup.call(context, spec); | |
| if (isArray(spec)) { | |
| context = lookup.call(context, spec[0]); | |
| if (context === null || context === FAIL) return context; | |
| return test_dom.call(context, spec[1]); | |
| } | |
| if (isObject(spec)) { | |
| results = {}; | |
| for (property_name in spec) { | |
| result = test_dom.call(context, spec[property_name]); | |
| if (result === FAIL) return FAIL; | |
| results[property_name] = result; | |
| } | |
| return results; | |
| } | |
| | |
| throw new Error("dom spec was neither a String, Object nor Array: "+ spec); | |
| } | |
| }; | |
| | |
| <span class="missing-if-branch" title="if path not taken"" >I</span>if ('module' in this) <span class="cstat-no" title="statement not covered" >module.exports = given;</span> | |
| </pre></td></tr> | |
| </table></pre> | |
| </div> | |
| <div class='footer'> | |
| <div class='meta'>Generated by <a href='http://istanbul-js.org' target='_blank'>istanbul</a> at Sat Jul 06 2013 22:10:54 GMT-0700 (PDT)</div> | |
| </div> | |
| </body> | |
| <script src="../prettify.js"></script> | |
| <script src="http://yui.yahooapis.com/3.6.0/build/yui/yui-min.js"></script> | |
| <script> | |
| YUI().use('datatable', function (Y) { | |
| var formatters = { | |
| pct: function (o) { | |
| o.className += o.record.get('classes')[o.column.key]; | |
| try { | |
| return o.value.toFixed(2) + '%'; | |
| } catch (ex) { return o.value + '%'; } | |
| }, | |
| html: function (o) { | |
| o.className += o.record.get('classes')[o.column.key]; | |
| return o.record.get(o.column.key + '_html'); | |
| } | |
| }, | |
| defaultFormatter = function (o) { | |
| o.className += o.record.get('classes')[o.column.key]; | |
| return o.value; | |
| }; | |
| function getColumns(theadNode) { | |
| var colNodes = theadNode.all('tr th'), | |
| cols = [], | |
| col; | |
| colNodes.each(function (colNode) { | |
| col = { | |
| key: colNode.getAttribute('data-col'), | |
| label: colNode.get('innerHTML') || ' ', | |
| sortable: !colNode.getAttribute('data-nosort'), | |
| className: colNode.getAttribute('class'), | |
| type: colNode.getAttribute('data-type'), | |
| allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html' | |
| }; | |
| col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter; | |
| cols.push(col); | |
| }); | |
| return cols; | |
| } | |
| function getRowData(trNode, cols) { | |
| var tdNodes = trNode.all('td'), | |
| i, | |
| row = { classes: {} }, | |
| node, | |
| name; | |
| for (i = 0; i < cols.length; i += 1) { | |
| name = cols[i].key; | |
| node = tdNodes.item(i); | |
| row[name] = node.getAttribute('data-value') || node.get('innerHTML'); | |
| row[name + '_html'] = node.get('innerHTML'); | |
| row.classes[name] = node.getAttribute('class'); | |
| //Y.log('Name: ' + name + '; Value: ' + row[name]); | |
| if (cols[i].type === 'number') { row[name] = row[name] * 1; } | |
| } | |
| //Y.log(row); | |
| return row; | |
| } | |
| function getData(tbodyNode, cols) { | |
| var data = []; | |
| tbodyNode.all('tr').each(function (trNode) { | |
| data.push(getRowData(trNode, cols)); | |
| }); | |
| return data; | |
| } | |
| function replaceTable(node) { | |
| if (!node) { return; } | |
| var cols = getColumns(node.one('thead')), | |
| data = getData(node.one('tbody'), cols), | |
| table, | |
| parent = node.get('parentNode'); | |
| table = new Y.DataTable({ | |
| columns: cols, | |
| data: data, | |
| sortBy: 'file' | |
| }); | |
| parent.set('innerHTML', ''); | |
| table.render(parent); | |
| } | |
| Y.on('domready', function () { | |
| replaceTable(Y.one('div.coverage-summary table')); | |
| if (typeof prettyPrint === 'function') { | |
| prettyPrint(); | |
| } | |
| }); | |
| }); | |
| </script> | |
| </html> |
| <!doctype html> | |
| <html> | |
| <head> | |
| <title>Code coverage report for ./</title> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
| <meta http-equiv="content-language" content="en-gb"> | |
| <link rel='stylesheet' href='../prettify.css'> | |
| <style type='text/css'> | |
| body, html { | |
| margin:0; padding: 0; | |
| } | |
| body { | |
| font-family: "Helvetic Neue", Helvetica,Arial; | |
| font-size: 10pt; | |
| } | |
| div.header, div.footer { | |
| background: #eee; | |
| padding: 1em; | |
| } | |
| div.header { | |
| z-index: 100; | |
| position: fixed; | |
| top: 0; | |
| border-bottom: 1px solid #666; | |
| width: 100%; | |
| } | |
| div.footer { | |
| border-top: 1px solid #666; | |
| } | |
| div.body { | |
| margin-top: 10em; | |
| } | |
| div.meta { | |
| font-size: 90%; | |
| text-align: center; | |
| } | |
| h1, h2, h3 { | |
| font-weight: normal; | |
| } | |
| h1 { | |
| font-size: 12pt; | |
| } | |
| h2 { | |
| font-size: 10pt; | |
| } | |
| pre { | |
| font-family: consolas, menlo, monaco, monospace; | |
| margin: 0; | |
| padding: 0; | |
| line-height: 14px; | |
| font-size: 14px; | |
| } | |
| div.path { font-size: 110%; } | |
| div.path a:link, div.path a:visited { color: #000; } | |
| table.coverage { border-collapse: collapse; margin:0; padding: 0 } | |
| table.coverage td { | |
| margin: 0; | |
| padding: 0; | |
| color: #111; | |
| vertical-align: top; | |
| } | |
| table.coverage td.line-count { | |
| width: 50px; | |
| text-align: right; | |
| padding-right: 5px; | |
| } | |
| table.coverage td.line-coverage { | |
| color: #777 !important; | |
| text-align: right; | |
| border-left: 1px solid #666; | |
| border-right: 1px solid #666; | |
| } | |
| table.coverage td.text { | |
| } | |
| table.coverage td span.cline-any { | |
| display: inline-block; | |
| padding: 0 5px; | |
| width: 40px; | |
| } | |
| table.coverage td span.cline-neutral { | |
| background: #eee; | |
| } | |
| table.coverage td span.cline-yes { | |
| background: #b5d592; | |
| color: #999; | |
| } | |
| table.coverage td span.cline-no { | |
| background: #fc8c84; | |
| } | |
| .cstat-yes { color: #111; } | |
| .cstat-no { background: #fc8c84; color: #111; } | |
| .fstat-no { background: #ffc520; color: #111 !important; } | |
| .cbranch-no { background: yellow !important; color: #111; } | |
| .missing-if-branch { | |
| display: inline-block; | |
| margin-right: 10px; | |
| position: relative; | |
| padding: 0 4px; | |
| background: black; | |
| color: yellow; | |
| xtext-decoration: line-through; | |
| } | |
| .missing-if-branch .typ { | |
| color: inherit !important; | |
| } | |
| .entity, .metric { font-weight: bold; } | |
| .metric { display: inline-block; border: 1px solid #333; padding: 0.3em; background: white; } | |
| .metric small { font-size: 80%; font-weight: normal; color: #666; } | |
| div.coverage-summary table { border-collapse: collapse; margin: 3em; font-size: 110%; } | |
| div.coverage-summary td, div.coverage-summary table th { margin: 0; padding: 0.25em 1em; border-top: 1px solid #666; border-bottom: 1px solid #666; } | |
| div.coverage-summary th { text-align: left; border: 1px solid #666; background: #eee; font-weight: normal; } | |
| div.coverage-summary th.file { border-right: none !important; } | |
| div.coverage-summary th.pic { border-left: none !important; text-align: right; } | |
| div.coverage-summary th.pct { border-right: none !important; } | |
| div.coverage-summary th.abs { border-left: none !important; text-align: right; } | |
| div.coverage-summary td.pct { text-align: right; border-left: 1px solid #666; } | |
| div.coverage-summary td.abs { text-align: right; font-size: 90%; color: #444; border-right: 1px solid #666; } | |
| div.coverage-summary td.file { text-align: right; border-left: 1px solid #666; white-space: nowrap; } | |
| div.coverage-summary td.pic { min-width: 120px !important; } | |
| div.coverage-summary a:link { text-decoration: none; color: #000; } | |
| div.coverage-summary a:visited { text-decoration: none; color: #333; } | |
| div.coverage-summary a:hover { text-decoration: underline; } | |
| div.coverage-summary tfoot td { border-top: 1px solid #666; } | |
| div.coverage-summary .yui3-datatable-sort-indicator, div.coverage-summary .dummy-sort-indicator { | |
| height: 10px; | |
| width: 7px; | |
| display: inline-block; | |
| margin-left: 0.5em; | |
| } | |
| div.coverage-summary .yui3-datatable-sort-indicator { | |
| background: url("http://yui.yahooapis.com/3.6.0/build/datatable-sort/assets/skins/sam/sort-arrow-sprite.png") no-repeat scroll 0 0 transparent; | |
| } | |
| div.coverage-summary .yui3-datatable-sorted .yui3-datatable-sort-indicator { | |
| background-position: 0 -20px; | |
| } | |
| div.coverage-summary .yui3-datatable-sorted-desc .yui3-datatable-sort-indicator { | |
| background-position: 0 -10px; | |
| } | |
| .high { background: #b5d592 !important; } | |
| .medium { background: #ffe87c !important; } | |
| .low { background: #fc8c84 !important; } | |
| span.cover-fill, span.cover-empty { | |
| display:inline-block; | |
| border:1px solid #444; | |
| background: white; | |
| height: 12px; | |
| } | |
| span.cover-fill { | |
| background: #ccc; | |
| border-right: 1px solid #444; | |
| } | |
| span.cover-empty { | |
| background: white; | |
| border-left: none; | |
| } | |
| span.cover-full { | |
| border-right: none !important; | |
| } | |
| pre.prettyprint { | |
| border: none !important; | |
| padding: 0 !important; | |
| margin: 0 !important; | |
| } | |
| .com { color: #999 !important; } | |
| </style> | |
| </head> | |
| <body> | |
| <div class='header medium'> | |
| <h1>Code coverage report for <span class='entity'>./</span></h1> | |
| <h2> | |
| Statements: <span class='metric'>63.86% <small>(129 / 202)</small></span> | |
| Branches: <span class='metric'>66.67% <small>(92 / 138)</small></span> | |
| Functions: <span class='metric'>75% <small>(24 / 32)</small></span> | |
| Lines: <span class='metric'>69.38% <small>(111 / 160)</small></span> | |
| </h2> | |
| <div class="path"><a href="../index.html">All files</a> » ./</div> | |
| </div> | |
| <div class='body'> | |
| <div class="coverage-summary"> | |
| <table> | |
| <thead> | |
| <tr> | |
| <th data-col="file" data-fmt="html" data-html="true" class="file">File</th> | |
| <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th> | |
| <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th> | |
| <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th> | |
| <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th> | |
| <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th> | |
| <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th> | |
| <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th> | |
| <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th> | |
| <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th> | |
| </tr> | |
| </thead> | |
| <tbody><tr> | |
| <td class="file medium" data-value="given.js"><a href="given.js.html">given.js</a></td> | |
| <td data-value="63.86" class="pic medium"><span class="cover-fill" style="width: 63px;"></span><span class="cover-empty" style="width:37px;"></span></td> | |
| <td data-value="63.86" class="pct medium">63.86%</td> | |
| <td data-value="202" class="abs medium">(129 / 202)</td> | |
| <td data-value="66.67" class="pct medium">66.67%</td> | |
| <td data-value="138" class="abs medium">(92 / 138)</td> | |
| <td data-value="75" class="pct medium">75%</td> | |
| <td data-value="32" class="abs medium">(24 / 32)</td> | |
| <td data-value="69.38" class="pct medium">69.38%</td> | |
| <td data-value="160" class="abs medium">(111 / 160)</td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| </div> | |
| <div class='footer'> | |
| <div class='meta'>Generated by <a href='http://istanbul-js.org' target='_blank'>istanbul</a> at Sat Jul 06 2013 22:10:54 GMT-0700 (PDT)</div> | |
| </div> | |
| </body> | |
| <script src="../prettify.js"></script> | |
| <script src="http://yui.yahooapis.com/3.6.0/build/yui/yui-min.js"></script> | |
| <script> | |
| YUI().use('datatable', function (Y) { | |
| var formatters = { | |
| pct: function (o) { | |
| o.className += o.record.get('classes')[o.column.key]; | |
| try { | |
| return o.value.toFixed(2) + '%'; | |
| } catch (ex) { return o.value + '%'; } | |
| }, | |
| html: function (o) { | |
| o.className += o.record.get('classes')[o.column.key]; | |
| return o.record.get(o.column.key + '_html'); | |
| } | |
| }, | |
| defaultFormatter = function (o) { | |
| o.className += o.record.get('classes')[o.column.key]; | |
| return o.value; | |
| }; | |
| function getColumns(theadNode) { | |
| var colNodes = theadNode.all('tr th'), | |
| cols = [], | |
| col; | |
| colNodes.each(function (colNode) { | |
| col = { | |
| key: colNode.getAttribute('data-col'), | |
| label: colNode.get('innerHTML') || ' ', | |
| sortable: !colNode.getAttribute('data-nosort'), | |
| className: colNode.getAttribute('class'), | |
| type: colNode.getAttribute('data-type'), | |
| allowHTML: colNode.getAttribute('data-html') === 'true' || colNode.getAttribute('data-fmt') === 'html' | |
| }; | |
| col.formatter = formatters[colNode.getAttribute('data-fmt')] || defaultFormatter; | |
| cols.push(col); | |
| }); | |
| return cols; | |
| } | |
| function getRowData(trNode, cols) { | |
| var tdNodes = trNode.all('td'), | |
| i, | |
| row = { classes: {} }, | |
| node, | |
| name; | |
| for (i = 0; i < cols.length; i += 1) { | |
| name = cols[i].key; | |
| node = tdNodes.item(i); | |
| row[name] = node.getAttribute('data-value') || node.get('innerHTML'); | |
| row[name + '_html'] = node.get('innerHTML'); | |
| row.classes[name] = node.getAttribute('class'); | |
| //Y.log('Name: ' + name + '; Value: ' + row[name]); | |
| if (cols[i].type === 'number') { row[name] = row[name] * 1; } | |
| } | |
| //Y.log(row); | |
| return row; | |
| } | |
| function getData(tbodyNode, cols) { | |
| var data = []; | |
| tbodyNode.all('tr').each(function (trNode) { | |
| data.push(getRowData(trNode, cols)); | |
| }); | |
| return data; | |
| } | |
| function replaceTable(node) { | |
| if (!node) { return; } | |
| var cols = getColumns(node.one('thead')), | |
| data = getData(node.one('tbody'), cols), | |
| table, | |
| parent = node.get('parentNode'); | |
| table = new Y.DataTable({ | |
| columns: cols, | |
| data: data, | |
| sortBy: 'file' | |
| }); | |
| parent.set('innerHTML', ''); | |
| table.render(parent); | |
| } | |
| Y.on('domready', function () { | |
| replaceTable(Y.one('div.coverage-summary table')); | |
| if (typeof prettyPrint === 'function') { | |
| prettyPrint(); | |
| } | |
| }); | |
| }); | |
| </script> | |
| </html> |
| .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} |
| window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V<U;++V){var ae=Z[V];if(ae.ignoreCase){ac=true}else{if(/[a-z]/i.test(ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){S=true;ac=false;break}}}var Y={b:8,t:9,n:10,v:11,f:12,r:13};function ab(ah){var ag=ah.charCodeAt(0);if(ag!==92){return ag}var af=ah.charAt(1);ag=Y[af];if(ag){return ag}else{if("0"<=af&&af<="7"){return parseInt(ah.substring(1),8)}else{if(af==="u"||af==="x"){return parseInt(ah.substring(2),16)}else{return ah.charCodeAt(1)}}}}function T(af){if(af<32){return(af<16?"\\x0":"\\x")+af.toString(16)}var ag=String.fromCharCode(af);if(ag==="\\"||ag==="-"||ag==="["||ag==="]"){ag="\\"+ag}return ag}function X(am){var aq=am.substring(1,am.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));var ak=[];var af=[];var ao=aq[0]==="^";for(var ar=ao?1:0,aj=aq.length;ar<aj;++ar){var ah=aq[ar];if(/\\[bdsw]/i.test(ah)){ak.push(ah)}else{var ag=ab(ah);var al;if(ar+2<aj&&"-"===aq[ar+1]){al=ab(aq[ar+2]);ar+=2}else{al=ag}af.push([ag,al]);if(!(al<65||ag>122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;ar<af.length;++ar){var at=af[ar];if(at[0]<=ap[1]+1){ap[1]=Math.max(ap[1],at[1])}else{ai.push(ap=at)}}var an=["["];if(ao){an.push("^")}an.push.apply(an,ak);for(var ar=0;ar<ai.length;++ar){var at=ai[ar];an.push(T(at[0]));if(at[1]>at[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak<ah;++ak){var ag=aj[ak];if(ag==="("){++am}else{if("\\"===ag.charAt(0)){var af=+ag.substring(1);if(af&&af<=am){an[af]=-1}}}}for(var ak=1;ak<an.length;++ak){if(-1===an[ak]){an[ak]=++ad}}for(var ak=0,am=0;ak<ah;++ak){var ag=aj[ak];if(ag==="("){++am;if(an[am]===undefined){aj[ak]="(?:"}}else{if("\\"===ag.charAt(0)){var af=+ag.substring(1);if(af&&af<=am){aj[ak]="\\"+an[am]}}}}for(var ak=0,am=0;ak<ah;++ak){if("^"===aj[ak]&&"^"!==aj[ak+1]){aj[ak]=""}}if(al.ignoreCase&&S){for(var ak=0;ak<ah;++ak){var ag=aj[ak];var ai=ag.charAt(0);if(ag.length>=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V<U;++V){var ae=Z[V];if(ae.global||ae.multiline){throw new Error(""+ae)}aa.push("(?:"+W(ae)+")")}return new RegExp(aa.join("|"),ac?"gi":"g")}function a(V){var U=/(?:^|\s)nocode(?:\s|$)/;var X=[];var T=0;var Z=[];var W=0;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=document.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Y=S&&"pre"===S.substring(0,3);function aa(ab){switch(ab.nodeType){case 1:if(U.test(ab.className)){return}for(var ae=ab.firstChild;ae;ae=ae.nextSibling){aa(ae)}var ad=ab.nodeName;if("BR"===ad||"LI"===ad){X[W]="\n";Z[W<<1]=T++;Z[(W++<<1)|1]=ab}break;case 3:case 4:var ac=ab.nodeValue;if(ac.length){if(!Y){ac=ac.replace(/[ \t\r\n]+/g," ")}else{ac=ac.replace(/\r\n?/g,"\n")}X[W]=ac;Z[W<<1]=T;T+=ac.length;Z[(W++<<1)|1]=ab}break}}aa(V);return{sourceCode:X.join("").replace(/\n$/,""),spans:Z}}function B(S,U,W,T){if(!U){return}var V={sourceCode:U,basePos:S};W(V);T.push.apply(T,V.decorations)}var v=/\S/;function o(S){var V=undefined;for(var U=S.firstChild;U;U=U.nextSibling){var T=U.nodeType;V=(T===1)?(V?S:U):(T===3)?(v.test(U.nodeValue)?S:V):V}return V===S?undefined:V}function g(U,T){var S={};var V;(function(){var ad=U.concat(T);var ah=[];var ag={};for(var ab=0,Z=ad.length;ab<Z;++ab){var Y=ad[ab];var ac=Y[3];if(ac){for(var ae=ac.length;--ae>=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae<aq;++ae){var ag=an[ae];var ap=aj[ag];var ai=void 0;var am;if(typeof ap==="string"){am=false}else{var aa=S[ag.charAt(0)];if(aa){ai=ag.match(aa[1]);ap=aa[0]}else{for(var ao=0;ao<X;++ao){aa=T[ao];ai=ag.match(aa[1]);if(ai){ap=aa[0];break}}if(!ai){ap=F}}am=ap.length>=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y<W.length;++Y){ae(W[Y])}if(ag===(ag|0)){W[0].setAttribute("value",ag)}var aa=ac.createElement("OL");aa.className="linenums";var X=Math.max(0,((ag-1))|0)||0;for(var Y=0,T=W.length;Y<T;++Y){af=W[Y];af.className="L"+((Y+X)%10);if(!af.firstChild){af.appendChild(ac.createTextNode("\xA0"))}aa.appendChild(af)}V.appendChild(aa)}function D(ac){var aj=/\bMSIE\b/.test(navigator.userAgent);var am=/\n/g;var al=ac.sourceCode;var an=al.length;var V=0;var aa=ac.spans;var T=aa.length;var ah=0;var X=ac.decorations;var Y=X.length;var Z=0;X[Y]=an;var ar,aq;for(aq=ar=0;aq<Y;){if(X[aq]!==X[aq+2]){X[ar++]=X[aq++];X[ar++]=X[aq++]}else{aq+=2}}Y=ar;for(aq=ar=0;aq<Y;){var at=X[aq];var ab=X[aq+1];var W=aq+2;while(W+2<=Y&&X[W+1]===ab){W+=2}X[ar++]=at;X[ar++]=ab;aq=W}Y=X.length=ar;var ae=null;while(ah<T){var af=aa[ah];var S=aa[ah+2]||an;var ag=X[Z];var ap=X[Z+2]||an;var W=Math.min(S,ap);var ak=aa[ah+1];var U;if(ak.nodeType!==1&&(U=al.substring(V,W))){if(aj){U=U.replace(am,"\r")}ak.nodeValue=U;var ai=ak.ownerDocument;var ao=ai.createElement("SPAN");ao.className=X[Z+1];var ad=ak.parentNode;ad.replaceChild(ao,ak);ao.appendChild(ak);if(V<S){aa[ah+1]=ak=ai.createTextNode(al.substring(W,S));ad.insertBefore(ak,ao.nextSibling)}}V=W;if(V>=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*</.test(S)?"default-markup":"default-code"}return t[T]}c(K,["default-code"]);c(g([],[[F,/^[^<?]+/],[E,/^<!\w[^>]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa<ac.length;++aa){for(var Z=0,V=ac[aa].length;Z<V;++Z){T.push(ac[aa][Z])}}ac=null;var W=Date;if(!W.now){W={now:function(){return +(new Date)}}}var X=0;var S;var ab=/\blang(?:uage)?-([\w.]+)(?!\S)/;var ae=/\bprettyprint\b/;function U(){var ag=(window.PR_SHOULD_USE_CONTINUATION?W.now()+250:Infinity);for(;X<T.length&&W.now()<ag;X++){var aj=T[X];var ai=aj.className;if(ai.indexOf("prettyprint")>=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X<T.length){setTimeout(U,250)}else{if(ad){ad()}}}U()}window.prettyPrintOne=y;window.prettyPrint=b;window.PR={createSimpleLexer:g,registerLangHandler:c,sourceDecorator:i,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:n,PR_COMMENT:j,PR_DECLARATION:E,PR_KEYWORD:z,PR_LITERAL:G,PR_NOCODE:N,PR_PLAIN:F,PR_PUNCTUATION:L,PR_SOURCE:J,PR_STRING:C,PR_TAG:m,PR_TYPE:O}})();PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_DECLARATION,/^<!\w[^>]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^<script\b[^>]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:<!--|-->)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment