src/model/page-config-resolver.js
/**
   * Obtains the product ID that meets the requirements
   * - child of an item of one of ALLOWED_TYPES
   * - Not a child of an item of type 'Section'
   * - child of an item of type 'productID'
   * @param {!Element} root An element that is an item of an ALLOWED_TYPES
   * @return {?string} product ID, if found
   * @private
   */
Obtains the product ID that meets the requirements
- child of an item of one of ALLOWED_TYPES
- Not a child of an item of type 'Section'
- child of an item of type 'productID'
@param {!Element} root An element that is an item of an ALLOWED_TYPES
@return {?string} product ID, if found
@private
Obtains the product ID that meets the requirements - child of an item of one of ALLOWED_TYPES - Not a child of an item of type ' Section ' - child of an item of type ' productID ' @param { !Element } root An element that is an item of an ALLOWED_TYPES @return { ?string } product ID if found @private
discoverProductId_(root) {
    const ALREADY_SEEN = 'alreadySeenForProductInfo';
    const nodeList = root.querySelectorAll('[itemprop="productID"]');
    for (let i = 0; nodeList[i]; i++) {
      const element = nodeList[i];
      const content = element.getAttribute('content') || element.textContent;
      const item = element.closest('[itemtype][itemscope]');
      const type = item.getAttribute('itemtype');
      if (type.indexOf('http://schema.org/Product') <= -1) {
        continue;
      }
      if (this.isValidElement_(item.parentElement, root, ALREADY_SEEN)) {
        return content;
      }
    }
    return null;
  }
discoverProductId_ ( root ) { const ALREADY_SEEN = 'alreadySeenForProductInfo' ; const nodeList = root . querySelectorAll ( '[itemprop="productID"]' ) ; for ( let i = 0 ; nodeList [ i ] ; i ++ ) { const element = nodeList [ i ] ; const content = element . getAttribute ( 'content' ) || element . textContent ; const item = element . closest ( '[itemtype][itemscope]' ) ; const type = item . getAttribute ( 'itemtype' ) ; if ( type . indexOf ( 'http://schema.org/Product' ) <= - 1 ) { continue ; } if ( this . isValidElement_ ( item . parentElement , root , ALREADY_SEEN ) ) { return content ; } } return null ; }
Obtains the product ID that meets the requirements
 - child of an item of one of ALLOWED_TYPES
 - Not a child of an item of type 'Section'
 - child of an item of type 'productID'
 @param {!Element} root An element that is an item of an ALLOWED_TYPES
 @return {?string} product ID, if found
 @private
Obtains the product ID that meets the requirements - child of an item of one of ALLOWED_TYPES - Not a child of an item of type ' Section ' - child of an item of type ' productID ' @param { !Element } root An element that is an item of an ALLOWED_TYPES @return { ?string } product ID if found @private