Elements and Attributes ======================= PorterJS tries to do all the dirty work for you in trying to figure out what you want to happen. One way it operates is to use ``data-*`` attributes on elements. Many other frameworks (we won't mention which ones) spurn the HTML specifications and run custom attribute names. But not PorterJS. It is designed to work with HTML5 compliant source code. Here are all of the recognized attributes. Attributes ---------- ``data-bind`` ++++++++++++++++ * **Purpose**: To enable two-way binding between an ```` and the `DataStack`_. * **Value**: A key in the DataStack, accessible as: ``p.stack.get('someKey')``. * **Example**: .. code-block:: html ``data-class`` ++++++++++++++ See also ``.toggler`` below. * **Purpose**: To define the class that should be toggled. * **Value**: The class name to be toggled. * **Example**: .. code-block:: html toggle link ``data-hash`` ++++++++++++++ * **Purpose**: To change the location hash on click. * **Value**: The hash to be assigned to the location. * **Example**: .. code-block:: html Visit here ``data-method`` +++++++++++++++ * **Purpose**: To change the HTTP request method for any element that triggers a call. * **Default**: ``GET``, except on a ``form`` element that defaults to ``POST`` * **Value**: Can be: ``GET``, ``POST``, ``PATCH``, ``PUT``, ``DELETE`` * **Example**: .. code-block:: html link to call a patch ``data-model`` +++++++++++++++ * **Purpose**: To update the value or text if an element upon the change of a `DataStack`_ key. * **Default**: * **Value**: * **Example**: .. code-block:: html or .. code-block:: html ``data-target`` (when used on a ``.toggler`` element) +++++++++++++++++++++++++++++++++++++++++++++++++++++ See also ``.toggler`` below. * **Purpose**: To define the element ``id`` of the intended target. * **Value**: The ``id`` of the target. * **Example**: .. code-block:: html toggle link ``data-target`` (when used on an ```` element) +++++++++++++++++++++++++++++++++++++++++++++++++++++ * **Purpose**: To define the ``
``data-url`` ++++++++++++ * **Purpose**: * **Default**: * **Value**: * **Example**: .. code-block:: html ... ``data-