function verifyRequiredSubElements(node, emit, isAdInline) {
  const required = requiredValues[node.nodeName];
  // Do not verify subelement if node is a child of wrapper, but verify it if node is the Wrapper itself
  // Wrapper child have no required subElement. (Only InLine does)
  const isInWrapperButNotWrapperItself =
    !isAdInline && node.nodeName !== 'Wrapper';
  if (!required || isInWrapperButNotWrapperItself) {
    return;
  }

  if (required.subElements) {
    const requiredSubElements = required.subElements;
    const missingSubElements = requiredSubElements.filter(
      (subElementName) => !parserUtils.childByName(node, subElementName)
    );

    if (missingSubElements.length > 0) {
      emitMissingValueWarning(
        {
          name: node.nodeName,
          parentName: node.parentNode.nodeName,
          subElements: missingSubElements,
        },
        emit
      );
    }
  }

  // When InLine format is used some nodes (i.e <NonLinear>, <Companion>, or <Icon>)
  // require at least one of the following resources: StaticResource, IFrameResource, HTMLResource
  if (!isAdInline || !required.oneOfinLineResources) {
    return;
  }

  const resourceFound = required.oneOfinLineResources.some((resource) => {
    return parserUtils.childByName(node, resource);
  });
  if (!resourceFound) {
    emitMissingValueWarning(
      {
        name: node.nodeName,
        parentName: node.parentNode.nodeName,
        oneOfResources: required.oneOfinLineResources,
      },
      emit
    );
  }
}
/**
 * Verify and trigger warnings if node required sub element are not set.
 * @param  {Node} node - The node element
 * @param  {Boolean} isAdInline - True if node is contained in a inline
 * @param  {Function} emit - Emit function used to trigger Warning event.
 * @emits  VASTParser#VAST-warning
 */
Verify and trigger warnings if node required sub element are not set.
@param  {Node} node - The node element
@param  {Boolean} isAdInline - True if node is contained in a inline
@param  {Function} emit - Emit function used to trigger Warning event.
Verify and trigger warnings if node required sub element are not set . @param { Node } node - The node element @param { Boolean } isAdInline - True if node is contained in a inline @param { Function } emit - Emit function used to trigger Warning event .
function verifyRequiredSubElements(node, emit, isAdInline) {
  const required = requiredValues[node.nodeName];
  const isInWrapperButNotWrapperItself =
    !isAdInline && node.nodeName !== 'Wrapper';
  if (!required || isInWrapperButNotWrapperItself) {
    return;
  }
  if (required.subElements) {
    const requiredSubElements = required.subElements;
    const missingSubElements = requiredSubElements.filter(
      (subElementName) => !parserUtils.childByName(node, subElementName)
    );
    if (missingSubElements.length > 0) {
      emitMissingValueWarning(
        {
          name: node.nodeName,
          parentName: node.parentNode.nodeName,
          subElements: missingSubElements,
        },
        emit
      );
    }
  }
  if (!isAdInline || !required.oneOfinLineResources) {
    return;
  }
  const resourceFound = required.oneOfinLineResources.some((resource) => {
    return parserUtils.childByName(node, resource);
  });
  if (!resourceFound) {
    emitMissingValueWarning(
      {
        name: node.nodeName,
        parentName: node.parentNode.nodeName,
        oneOfResources: required.oneOfinLineResources,
      },
      emit
    );
  }
}
function verifyRequiredSubElements ( node , emit , isAdInline ) { const required = requiredValues [ node . nodeName ] ; const isInWrapperButNotWrapperItself = ! isAdInline && node . nodeName !== 'Wrapper' ; if ( ! required || isInWrapperButNotWrapperItself ) { return ; } if ( required . subElements ) { const requiredSubElements = required . subElements ; const missingSubElements = requiredSubElements . filter ( ( subElementName ) => ! parserUtils . childByName ( node , subElementName ) ) ; if ( missingSubElements . length > 0 ) { emitMissingValueWarning ( { name : node . nodeName , parentName : node . parentNode . nodeName , subElements : missingSubElements , } , emit ) ; } } if ( ! isAdInline || ! required . oneOfinLineResources ) { return ; } const resourceFound = required . oneOfinLineResources . some ( ( resource ) => { return parserUtils . childByName ( node , resource ) ; } ) ; if ( ! resourceFound ) { emitMissingValueWarning ( { name : node . nodeName , parentName : node . parentNode . nodeName , oneOfResources : required . oneOfinLineResources , } , emit ) ; } }
Verify and trigger warnings if node required sub element are not set.
Verify and trigger warnings if node required sub element are not set .
// Do not verify subelement if node is a child of wrapper, but verify it if node is the Wrapper itself // Wrapper child have no required subElement. (Only InLine does) // When InLine format is used some nodes (i.e <NonLinear>, <Companion>, or <Icon>) // require at least one of the following resources: StaticResource, IFrameResource, HTMLResource