The me/my/I Reference

Syntax

  me
  I

Description

Most hyperscript features run within the context of an HTML element. For example, <div _="on click ..."> is an event handler that runs in the context of the <div> that contains it. Within these scripts, you can use the me expression as a link back to their associated HTML element.

I is an alias for me, useful for more natural English phrasing: if I match .active.

For possessive expressions, my will also work, as in my property instead of me.property.

Examples

This uses the put command to update the contents of the associated element.

<button data-script="on click put 'I have been clicked' into me">
    click me
    </button>

This uses a possessive expression and an attribute reference to display a custom message.

<span
    data-script="on mouseover alert my @data-message"
    data-message="Keep Out!">
    Hover Over Me...
</span>

This demonstrates the possessive expression along with the increment command to makes a simple click counter.

<div data-script="on click increment my innerHTML">1</div>