Basic Attributes

setAttributes() provides a unified chainable API for mutating DOM attributes.

Boolean attributes are handled automatically while preserving direct native DOM behavior.

Important

setAttributes() works directly on native DOM attributes.

DOMPP does not create abstraction layers around the browser attribute system.

Boolean attributes like disabled, checked, and readonly are handled automatically.

Code

const basicAttributes =
  document
    .createElement("div")
    .setAttributes({
      class: "card"
    })
    .setChildren(
      document
        .createElement("input")
        .setAttributes({
          type:
            "text",
          placeholder:
            "Your name",
          value:
            "DOM++",
          disabled:
            false
        })
    );

app.setChildren(
  basicAttributes
);
Notes
  • setAttributes() mutates native DOM attributes directly
  • boolean attributes are automatically normalized
  • setters remain chainable because the original DOM element instance is returned

Live Preview