Categories

jQuery.metaparse()

Categories: Utilities

jQuery.metaparse( element, [ options ] )Returns: jQuery

Plugin: jQuery.metaparse

Description: Run jQuery methods instantly without script tags.

  • jQuery.metaparse( element, [ options ] )

    version added: 1.0

    element   A DOM element.

    options   A set of key/value pairs that configure the .metaparse() call. A default are set for any option by jQuery.metaparseSettings.

The jQuery.metaparse() method is capable of runnig meta code extracted from classes, random attributes, child elements and HTML5 data-* attributes.

The syntax: write jQuery methods without selector and use single quotes, the extracted code will be applied to the element which containted the code.

If you wnat to run code from jQuery sub classes write the name of the sub class object before the first dot. Be sure the sub class was defined on the global window object like this window.$sub = $.sub().

  • Run meta code extracted from a class.

    HTML:
    <ul>
      <li class="metaparse .fadeTo(0.5)" id="fade"></li>
    </ul>
    Code:
    $.metaparse( document.getElementById('fade'), {type: 'class'});
    Results:
    <ul>
      <li class="metaparse " style="opacity:0.5;"></li>
    </ul>
  • type

    version added: 1.0

    An extraction type 'class', 'elem', 'attr' or 'html5'.

    Default: 'class'

  • name

    version added: 1.0

    The name of the attribute, html5 data-* attribute or element to extract the code.

    Default: 'metaparse'