ic-attr-src - The Attribute Source Attribute

Summary

The ic-attr-src attribute binds a given HTML element's attribute to a URL. It does not cause any requests to happen by itself, but it can respond to events caused by other attributes.

When Intercooler issues a request for an element with an ic-attr-src, it will issue a GET and will replace the current element attribute value with resulting text fragment.

Syntax

The value of the attribute should be a valid attribute name, followed by a colon, then a valid relative path (e.g. ic-attr-src="style:/foo/bar").

Dependencies

ic-attr-src implies a dependency on its path, and Intercooler will issue requests for elements whenever it detects an action that the path depends on. See Dependencies for more information.

Example

Here is a simple example, using a poll interval to update:

  <div ic-style-src="style:/style" ic-poll="1s">Cause you move to a different sound</div>
      
Cause you move to a different sound