static getInheritedAttribute_(element, attributeName, nsName) {
    let ret = null;
    const TXml = shaka.util.TXml;
    while (!ret) {
      ret = nsName ?
          TXml.getAttributeNS(element, nsName, attributeName) :
          element.attributes[attributeName];
      if (ret) {
        break;
      }

      // Element.parentNode can lead to XMLDocument, which is not an Element and
      // has no getAttribute().
      const parentNode = element.parent;
      if (parentNode) {
        element = parentNode;
      } else {
        break;
      }
    }
    return ret;
  }
Traverses upwards from a given node until a given attribute is found.

@param {!shaka.extern.xml.Node} element
@param {string} attributeName
@param {string=} nsName
@return {?string}
@private