ic-style-src - The Style Source Attribute

Summary

The ic-style-src attribute binds a given HTML element's style 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-style-src, it will issue a GET and will replace the current element's style value with resulting text fragment.

Syntax

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

Dependencies

ic-style-src implies a mutation to any dependency on its path, and Intercooler will issue GET requests for elements that depend on that path after the POST completes.

See Dependencies for more information.

Example

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

  <div ic-style-src="color:/color" ic-poll="200ms">I'm turning red!</div>
      
Help! I'm turning red!