Chapter 14.5.5. Other DOM Functions

MochiKit provides the following useful additional functions for working with the DOM. These functions are straightforward to use and are not covered elsewhere in this chapter.

  • currentDocument() Returns the document object unless withDocument or withWindow is executing

  • currentWindow() Returns the window object unless withWindow is executing

  • escapeHTML(s) Make a string safe for inclusion in HTML

  • formContents(element) Returns a two-element array of names and values for every subelement of element that has name and value attributes

  • getNodeAttribute(node, attr) Gets the value of the given attribute for a DOM node, returning null if there’s no match

  • removeElement(node) Removes and returns node from a DOM tree

  • scrapeText(node, ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.