diff --git a/plugins/wordriver/popcorn.wordriver.js b/plugins/wordriver/popcorn.wordriver.js index 640f8cf2e..e69a973cd 100755 --- a/plugins/wordriver/popcorn.wordriver.js +++ b/plugins/wordriver/popcorn.wordriver.js @@ -131,7 +131,7 @@ _teardown: function( options ) { // removes word span from generated container - options._container.removeChild( options.word ); + options.word.parentNode && options._container.removeChild( options.word ); // if no more word spans exist in container, remove container container[ options.target ] && diff --git a/plugins/wordriver/popcorn.wordriver.unit.js b/plugins/wordriver/popcorn.wordriver.unit.js index 6dcc4b285..1cc8e90f9 100755 --- a/plugins/wordriver/popcorn.wordriver.unit.js +++ b/plugins/wordriver/popcorn.wordriver.unit.js @@ -40,11 +40,19 @@ test( "Popcorn wordriver Plugin", function () { text: "world", target: "wordriverdiv", color: "blue" - }) - .volume(0); + }); secondTrack = popped.getLastTrackEventId(); + popped.wordriver({ + start: 20, // seconds + end: 24, // seconds + text: "nothing here", + target: "wordriverdiv", + color: "green" + }) + .volume(0); + popped.exec( 0, function() { equals( wordriverdiv.children[0].childElementCount, 1, "wordriverdiv now has one inner element" ); plus(); @@ -82,7 +90,7 @@ test( "Popcorn wordriver Plugin", function () { plus(); popped.pause().removeTrackEvent( secondTrack ); - equals( wordriverdiv.childElementCount, 0, "wordriverdiv now has no inner element" ); + equals( wordriverdiv.childElementCount, 0, "wordriverdiv now has no inner element, even though one still exists, but was never called" ); plus(); });