HasAs
API reference › HTML Attribute › HasAs
Used by 1 type
Provides an immutable API for the as attribute.
See also: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/link#as.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
as() | Sets the as attribute. | HasAs |
Method details
Section titled “Method details”public function as(string|Stringable|UnitEnum|null $value): staticSets the as attribute.
Identifies the resource type for preload and modulepreload links.
Parameters
| Parameter | Type | Description |
|---|---|---|
$value | string|Stringable|UnitEnum| | Resource type token, or null to remove the attribute. |
Returns
static: New instance with the updated as attribute. AsValue for predefined enum values.
Throws
InvalidArgumentException: If the value is not valid.