Snippet data

The recommended way to convey information from the snippets to the components is to use HTML5 custom data-* attributes.

The data-* attributes do not affect layout or presentation and are valid HTML5 markup.

Since data-* are DOM attributes, they can be retrieved using getAttribute(attributeName) or the new HTML5 dataset property.

The data-* attributes names are turned into camel case for access through dataset. For example, the attribute data-g-my-test is accessed with this.elt.dataset.gMyTest in a component.

Example

gwc.componentSet.FileTransfer = function(type) {
  window.open(this.elt.dataset.gValue);
}