Alien-GvaScript
view release on metacpan or search on metacpan
doc/html/ProtoExtensions.html view on Meta::CPAN
<div class="TN_node" id="String_extensions">
<h3 class="TN_label">String extensions</h3>
<div class="TN_content">
<div class="TN_node" id="chomp">
<h4 class="TN_label">chomp</h4>
<div class="TN_content">
<p>Strips any trailing line breaks (\r\n) from a String.</p>
</div>
</div>
</div>
</div>
<div class="TN_node" id="Element_extensions">
<h3 class="TN_label">Element extensions</h3>
<div class="TN_content">
<div class="TN_node" id="flash">
<h4 class="TN_label">flash</h4>
<div class="TN_content">
<p>only applied to ['SPAN', 'DIV', 'INPUT', 'BUTTON', 'TEXTAREA', 'A'] elements.</p>
<p>used to set a classname to the element for a brief moment of time.</p>
<pre> Element.flash(elem, {duration: I<time_mes>, classname: I<classname_to_set>});</pre>
</div>
</div>
<div class="TN_node" id="hasAnyClass">
<h4 class="TN_label">hasAnyClass</h4>
<div class="TN_content">
<pre> if (Element.hasAnyClass(elem, ["class1", "class2", ...]) {...}
if (Element.hasAnyClass(elem, "class1") {...}</pre>
<p>Returns true if the supplied element has any of the given classes.
For convenience, also accepts a single string instead of an array
when testing for a single class.</p>
</div>
</div>
<div class="TN_node" id="getElementsByClassNames">
<h4 class="TN_label">getElementsByClassNames</h4>
<div class="TN_content">
<pre> var subElements
= Element.getElementsByClassNames(rootElement, ["class1", "class2", ...]);</pre>
<p>Returns an array of children of <code>rootElement</code> that have any
of the given class names.</p>
</div>
</div>
<div class="TN_node" id="navigateDom">
<h4 class="TN_label">navigateDom</h4>
<div class="TN_content">
<pre> var wantedClasses = ["class1", "class2", ...];
// which direction to navigate (could be "parentNode", etc.)
var direction = "nextSibling";
// some criteria for stopping navigation (can be anything, here a stupid
// example)
var stopCondition = function(elem) {return elem.innerHTML.length > 10}
var nextElement
= Element.navigateDom(startElement, direction, wantedClasses,
stopCondition);</pre>
<p>Returns an extended (prototype's <code>Element.extend()</code>) copy of HTMLElement.</p>
<p>Walks through the DOM in the given direction, until finding an
element that has one of the given classnames, or finding a stop
condition (in which case <code>null</code> is returned).</p>
</div>
</div>
<div class="TN_node" id="autoScroll">
<h4 class="TN_label">autoScroll</h4>
<div class="TN_content">
<pre> Element.autoScroll(elem, percentage)</pre>
<p>Makes sure that <code>elem</code> is visible in the central area of
its offset parent; if not, the parent is scrolled.
<code>percentage</code> is the ratio between the parent height and the
margin at which scrolling must occur, i.e. if
<code>percentage = 20</code> (the default), then scrolling
occurs if the element is in the higher than the top 20% or
lower than the bottom 20% of the viewport.</p>
</div>
</div>
<div class="TN_node" id="outerHTML">
<h4 class="TN_label">outerHTML</h4>
<div class="TN_content">
<pre> Element.outerHTML(elem)</pre>
<p>Returns a string representation of the DOM element,
including tags and attributes. Implemented through
the native <code>outerHTML</code> property, if present; otherwise
constructs a string from tag name, attributes and
innerHTML property.</p>
</div>
</div>
</div>
</div>
<div class="TN_node" id="Form_Element_extensions">
<h3 class="TN_label">Form.Element extensions</h3>
<div class="TN_content">
<div class="TN_node" id="setValue">
<h4 class="TN_label">setValue</h4>
<div class="TN_content">
<p>Form.Element.setValue method is wrapped to fire a
'value:change' custom event with oldvalue and newvalue
properties set in the event.memo</p>
</div>
</div>
</div>
</div>
<div class="TN_node" id="Event_extensions">
<h3 class="TN_label">Event extensions</h3>
( run in 0.589 second using v1.01-cache-2.11-cpan-02777c243ea )