Repository: facebook/react
File: packages/react-dom-bindings/src/client/ReactDOMComponent.js (JavaScript)

Code before:
// Apply the diff.
export function updatePropertiesWithDiff(
  domElement: Element,
  updatePayload: Array<any>,
  tag: string,
  lastProps: Object,
  nextProps: Object,
): void {
  switch (tag) {
    case 'div':
    case 'span':
    case 'svg':
    case 'path':
    case 'a':
    case 'g':
    case 'p':
    case 'li': {
      // Fast track the most common tag types
      break;
    }
    case 'input': {
      const name = nextProps.name;
      const type = nextProps.type;
      const value = nextProps.value;
      const defaultValue = nextProps.defaultValue;
      const oldDefaultValue = lastProps.defaultValue;
      const checked = nextProps.checked;
      const defaultChecked = nextProps.defaultChecked;
      for (let i = 0; i < updatePayload.length; i += 2) {
        const propKey = updatePayload[i];
        const propValue = updatePayload[i + 1];
        switch (propKey) {
          case 'type': {
            // Fast path since 'type' is very common on inputs
            if (
              propValue != null &&
              typeof propValue !== 'function' &&
              typeof propValue !== 'symbol' &&
              typeof propValue !== 'boolean'
            ) {
              if (__DEV__) {
                checkAttributeStringCoercion(propValue, propKey);
              }
              domElement.setAttribute(propKey, propValue);
            } else {
              domElement.removeAttribute(propKey);
            }
            break;
          }
          case 'name': {
            break;

Review comment (suggestion):
Nit: `lastDefaultValue`. We use the term `last` instead of `old` everywhere else here.

Code after:
// Apply the diff.
export function updatePropertiesWithDiff(
  domElement: Element,
  updatePayload: Array<any>,
  tag: string,
  lastProps: Object,
  nextProps: Object,
): void {
  switch (tag) {
    case 'div':
    case 'span':
    case 'svg':
    case 'path':
    case 'a':
    case 'g':
    case 'p':
    case 'li': {
      // Fast track the most common tag types
      break;
    }
    case 'input': {
      const name = nextProps.name;
      const type = nextProps.type;
      const value = nextProps.value;
      const defaultValue = nextProps.defaultValue;
      const lastDefaultValue = lastProps.defaultValue;
      const checked = nextProps.checked;
      const defaultChecked = nextProps.defaultChecked;
      for (let i = 0; i < updatePayload.length; i += 2) {
        const propKey = updatePayload[i];
        const propValue = updatePayload[i + 1];
        switch (propKey) {
          case 'type': {
            // Fast path since 'type' is very common on inputs
            if (
              propValue != null &&
              typeof propValue !== 'function' &&
              typeof propValue !== 'symbol' &&
              typeof propValue !== 'boolean'
            ) {
              if (__DEV__) {
                checkAttributeStringCoercion(propValue, propKey);
              }
              domElement.setAttribute(propKey, propValue);
            } else {
              domElement.removeAttribute(propKey);
            }
            break;
          }
          case 'name': {
            break;