diff --git a/parsers/parserXML/popcorn.parserXML.js b/parsers/parserXML/popcorn.parserXML.js index d33895ae..5a95d45c 100644 --- a/parsers/parserXML/popcorn.parserXML.js +++ b/parsers/parserXML/popcorn.parserXML.js @@ -41,7 +41,8 @@ for ( var i = 0, nal = nodeAttributes.length; i < nal; i++ ) { var key = nodeAttributes.item(i).nodeName, - data = nodeAttributes.item(i).nodeValue; + data = nodeAttributes.item(i).nodeValue, + manifestItem = manifestData[ data ]; // converts in into start if (key === "in") { @@ -51,7 +52,13 @@ returnObject.end = toSeconds( data ); // this is where ids in the manifest are linked } else if ( key === "resourceid" ) { - Popcorn.extend( returnObject, manifestData[data] ); + for ( var item in manifestItem ) { + if ( manifestItem.hasOwnProperty( item ) ) { + if ( !returnObject[ item ] && item !== "id" ) { + returnObject[ item ] = manifestItem[ item ]; + } + } + } // everything else } else { returnObject[key] = data; diff --git a/parsers/parserXML/popcorn.parserXML.unit.js b/parsers/parserXML/popcorn.parserXML.unit.js index 0c5fb5f9..c153ae1d 100644 --- a/parsers/parserXML/popcorn.parserXML.unit.js +++ b/parsers/parserXML/popcorn.parserXML.unit.js @@ -1,54 +1,32 @@ -asyncTest( "Popcorn 0.1 XML Parser Plugin", function () { - - var expects = 7, - count = 0, - interval, - poppercorn = Popcorn( "#video" ); - - function plus() { - if ( ++count === expects ) { - start(); - } - } - - expect(expects); +asyncTest( "Popcorn 0.1 XML Parser Plugin", 7, function () { + + var poppercorn = Popcorn( "#video" ); Popcorn.plugin( "parserTest1", { - start: function ( event, options ) { ok( options.item2 === "item2", "parserTest1 has data directly from manifest" ); - plus(); ok( options.item3 === "item3", "parserTest1 has cascading data from manifest" ); - plus(); - }, - end: function ( event, options ) {} + } }); Popcorn.plugin( "parserTest2", { - start: function ( event, options ) { ok( options.text === "item4", "parserTest2 has text data" ); - plus(); ok( options.item1 === "item1", "parserTest2 has cascading data from parent" ); - plus(); - }, - end: function ( event, options ) {} + } }); Popcorn.plugin( "parserTest3", { - start: function ( event, options ) { ok( options.item1 === "item1", "parserTest3 has cascading data from parent" ); - plus(); ok( options.item2 === "item2", "parserTest3 has data directly from manifest" ); - plus(); ok( options.item3 === "item3", "parserTest3 has cascading data from manifest" ); - plus(); - }, - end: function ( event, options ) {} + start(); + } }); poppercorn.parseXML( "data/unit.XML", function() { - poppercorn.currentTime(5).play(); - }); + poppercorn.play( 5 ); + poppercorn.mute(); + }); });