Repository: angular/angular
File: packages/core/src/render3/i18n/i18n_parse.ts (TypeScript)

Code before:
            const attr = elAttrs.item(i)!;
            const lowerAttrName = attr.name.toLowerCase();
            const hasBinding = !!attr.value.match(BINDING_REGEXP);
            if (hasBinding) {
              if (VALID_ATTRS.hasOwnProperty(lowerAttrName)) {
                if (URI_ATTRS[lowerAttrName]) {
                  generateBindingUpdateOpCodes(
                    update,
                    attr.value,
                    newIndex,
                    attr.name,
                    0,
                    _sanitizeUrl,
                  );
                } else {
                  generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, null);
                }
              } else {
                ngDevMode &&
                  console.warn(
                    `WARNING: ignoring unsafe attribute value ` +
                      `${lowerAttrName} on element ${tagName} ` +
                      `(see ${XSS_SECURITY_URL})`,
                  );
              }
            } else {
              if (VALID_ATTRS[lowerAttrName]) {
                if (URI_ATTRS[lowerAttrName]) {
                  // Don't sanitize, because no value is acceptable in sensitive attributes.
                  // Translators are not allowed to create URIs.
                  if (typeof ngDevMode !== 'undefined' && ngDevMode) {
                    console.warn(
                      `WARNING: ignoring unsafe attribute ` +
                        `${lowerAttrName} on element ${tagName} ` +
                        `(see ${XSS_SECURITY_URL})`,
                    );
                  }
                  addCreateAttribute(create, newIndex, attr.name, 'unsafe:blocked');
                } else {
                  addCreateAttribute(create, newIndex, attr.name, attr.value);
                }
              } else {
                if (typeof ngDevMode !== 'undefined' && ngDevMode) {
                  console.warn(
                    `WARNING: ignoring unknown attribute name ` +
                      `${lowerAttrName} on element ${tagName} ` +
                      `(see ${XSS_SECURITY_URL})`,
                  );
                }
              }
            }

Review comment (suggestion):
NIT: Considering combing the `if` with the previous `else`

```suggestion
            } else if (VALID_ATTRS[lowerAttrName]) {
```

Code after:
            const attr = elAttrs.item(i)!;
            const lowerAttrName = attr.name.toLowerCase();
            const hasBinding = !!attr.value.match(BINDING_REGEXP);
            if (hasBinding) {
              if (VALID_ATTRS.hasOwnProperty(lowerAttrName)) {
                if (URI_ATTRS[lowerAttrName]) {
                  generateBindingUpdateOpCodes(
                    update,
                    attr.value,
                    newIndex,
                    attr.name,
                    0,
                    _sanitizeUrl,
                  );
                } else {
                  generateBindingUpdateOpCodes(update, attr.value, newIndex, attr.name, 0, null);
                }
              } else {
                ngDevMode &&
                  console.warn(
                    `WARNING: ignoring unsafe attribute value ` +
                      `${lowerAttrName} on element ${tagName} ` +
                      `(see ${XSS_SECURITY_URL})`,
                  );
              }
            } else if (VALID_ATTRS[lowerAttrName]) {
              if (URI_ATTRS[lowerAttrName]) {
                // Don't sanitize, because no value is acceptable in sensitive attributes.
                // Translators are not allowed to create URIs.
                if (typeof ngDevMode !== 'undefined' && ngDevMode) {
                  console.warn(
                    `WARNING: ignoring unsafe attribute ` +
                      `${lowerAttrName} on element ${tagName} ` +
                      `(see ${XSS_SECURITY_URL})`,
                  );
                }
                addCreateAttribute(create, newIndex, attr.name, 'unsafe:blocked');
              } else {
                addCreateAttribute(create, newIndex, attr.name, attr.value);
              }
            } else {
              if (typeof ngDevMode !== 'undefined' && ngDevMode) {
                console.warn(
                  `WARNING: ignoring unknown attribute name ` +
                    `${lowerAttrName} on element ${tagName} ` +
                    `(see ${XSS_SECURITY_URL})`,
                );
              }
            }
          }
          const elementNode: I18nElementNode = {