Skip to content

HtmlElementProperty class

One settable property on an HtmlElement --- returned by HtmlElementProperties.Item. Carries the property's Value plus a Properties accessor that lets the addin drill into nested DOM property structures (.style.color, .chart.data.datasets(0).borderWidth, …).

Almost always written in shorthand --- neither HtmlElementProperty nor its parent HtmlElementProperties is typically named in addin code; the compiler resolves chains like .style.color = "red" through their default-members:

vb
element.style.color = "red"
'   ↑ HtmlElement.Properties      (HtmlElement's DefaultMember)
'     .Item("style")               (HtmlElementProperties' DefaultMember)
'           .Properties            (HtmlElementProperty.Properties — nested bag)
'           .Item("color")         (the same DefaultMember chain again)
'                 .Value = "red"   (HtmlElementProperty.Value, the leaf)

Properties

Properties

A nested HtmlElementProperties for properties that themselves have sub-properties (the canonical example is style, whose sub-properties are the individual CSS-style names). Read-only at the accessor level; the inner bag is mutable.

Syntax: property.Properties As HtmlElementProperties

Value

The property's value. Read returns the current value as a Variant; assigning writes the new value back. DefaultMember --- so propertyObj = "red" is equivalent to propertyObj.Value = "red".

Syntax: property [ = value ]

The interface is [COMExtensible(True)] --- see Dynamic DOM property resolution on the package overview. Property names that route through Properties are resolved against the live DOM at run time, not declared statically.

twinBASIC and LOGO copyright of "WaynePhillipsEA" author