DOMAssistant 2.7.2 Adds triggerEvent And replace Methods

DOMAssistant has just announced the release of DOMAssistant 2.7.2 beyond the bug fixes they introduced to new methods triggerEvent and replace. Bug fixed include:

  • Fixed regression bug on $ with multiple arguments
  • Fixed passed parameters not checked before their usage in attrToXpath()
  • Fixed buggy :checked behavior in non-IE browsers
  • Two new methods preview: triggerEvent() and replace()

Looking at the two new method:

triggerEvent(evt, target)

Calls the event handler for event evt of the current element. You can optionally specify the target element to which the event is dispatched. Note that the actual event does not happen - it merely triggers the event handler itself.

Example:

$$(”myButton”).triggerEvent(”click”);

$(”tr.blue”).triggerEvent(”customevent”, myelement);

replace(content, returnNew) 

This method differs from replaceContent() in that it does not replace the content - it replaces the current element with the new content. Content can be string, numbers or element. By default this method returns the replaced element, but you can have the new element returned by setting returnNew to true.

Example:

$$(”para”).replace(”<div>Testing <i>new</i> method</div>”, true);

$(”div.odd”).replace(myelement);

Download the new version

 Go to the download page and try it out!

0

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)