Skip to content

Commit

Permalink
Remove reliance on node.children.
Browse files Browse the repository at this point in the history
Use the slightly more old-fashioned childNodes property instead.

Change-Id: Iade1ff63b4f86d53712ac818024c02f5e9b658b7
  • Loading branch information
joeyparrish committed Apr 21, 2015
1 parent 9ebd522 commit a849f03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
14 changes: 7 additions & 7 deletions lib/dash/mpd_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ shaka.dash.mpd.ContentProtection.prototype.parse = function(parent, elem) {
// could be application-specific. Therefore we must capture whatever it
// contains, and let the application choose a scheme and map it to a key
// system.
this.children = elem.children;
this.children = Array.prototype.slice.call(elem.childNodes);
};


Expand Down Expand Up @@ -1375,14 +1375,14 @@ shaka.dash.mpd.parseChild_ = function(parent, elem, constructor) {
shaka.dash.mpd.findChild_ = function(elem, name) {
var childElement = null;

for (var i = 0; i < elem.children.length; i++) {
if (elem.children[i].tagName != name) {
for (var i = 0; i < elem.childNodes.length; i++) {
if (elem.childNodes[i].tagName != name) {
continue;
}
if (childElement) {
return null;
}
childElement = elem.children[i];
childElement = elem.childNodes[i];
}

return childElement;
Expand All @@ -1402,12 +1402,12 @@ shaka.dash.mpd.findChild_ = function(elem, name) {
shaka.dash.mpd.parseChildren_ = function(parent, elem, constructor) {
var parsedChildren = [];

for (var i = 0; i < elem.children.length; i++) {
if (elem.children[i].tagName != constructor.TAG_NAME) {
for (var i = 0; i < elem.childNodes.length; i++) {
if (elem.childNodes[i].tagName != constructor.TAG_NAME) {
continue;
}
var parsedChild = new constructor();
parsedChild.parse.call(parsedChild, parent, elem.children[i]);
parsedChild.parse.call(parsedChild, parent, elem.childNodes[i]);
parsedChildren.push(parsedChild);
}

Expand Down
3 changes: 1 addition & 2 deletions support.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ function testForKeySystem(ks, required) {
testForClass(window, 'HTMLMediaElement', true);
testForClass(window, 'MediaSource', true);
testForClass(window, 'Promise', true);
testForProperty(document, 'children', true);

// Optional:
testForClass(window, 'VTTCue', false);
Expand Down Expand Up @@ -314,7 +313,7 @@ function onAsyncComplete() {
// Synthesize a summary at the top from other properties.
// Must be done after all async tasks are complete.
var requiredFeatures = found['HTMLMediaElement'] && found['MediaSource'] &&
found['Promise'] && found['children'];
found['Promise'];
var qoe = found['getVideoPlaybackQuality'] || found['droppedFrameCount'];
var subtitles = found['VTTCue'];
var emeApi = found['MediaKeys'] || found['generateKeyRequest'];
Expand Down

0 comments on commit a849f03

Please sign in to comment.